You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by keith-turner <gi...@git.apache.org> on 2016/02/27 01:09:20 UTC
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
GitHub user keith-turner opened a pull request:
https://github.com/apache/accumulo/pull/77
ACCUMULO-4152 add fate dump command
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/keith-turner/accumulo ACCUMULO-4152
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/accumulo/pull/77.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #77
----
commit 71aa908e66d66e6b1cdd80913f7b32cfbafb600c
Author: Keith Turner <kt...@apache.org>
Date: 2016-02-24T23:20:32Z
ACCUMULO-4152 add fate dump command
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner closed the pull request at:
https://github.com/apache/accumulo/pull/77
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54439428
--- Diff: fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ---
@@ -458,4 +458,43 @@ public Serializable getProperty(long tid, String prop) {
throw new RuntimeException(e);
}
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ReadOnlyRepo<T>> getStack(long tid) {
+ String txpath = getTXPath(tid);
+
+ outer: while (true) {
+ List<String> ops;
+ try {
+ ops = zk.getChildren(txpath);
+ } catch (KeeperException.NoNodeException e) {
+ return null;
--- End diff --
Empty list would be much nicer, I'll make that change.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54329398
--- Diff: fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ---
@@ -458,4 +458,43 @@ public Serializable getProperty(long tid, String prop) {
throw new RuntimeException(e);
}
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ReadOnlyRepo<T>> getStack(long tid) {
+ String txpath = getTXPath(tid);
+
+ outer: while (true) {
+ List<String> ops;
+ try {
+ ops = zk.getChildren(txpath);
+ } catch (KeeperException.NoNodeException e) {
+ return null;
--- End diff --
Empty list instead of null?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54452009
--- Diff: fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ---
@@ -458,4 +458,43 @@ public Serializable getProperty(long tid, String prop) {
throw new RuntimeException(e);
}
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ReadOnlyRepo<T>> getStack(long tid) {
+ String txpath = getTXPath(tid);
+
+ outer: while (true) {
+ List<String> ops;
+ try {
+ ops = zk.getChildren(txpath);
+ } catch (KeeperException.NoNodeException e) {
+ return null;
+ } catch (KeeperException | InterruptedException e1) {
+ throw new RuntimeException(e1);
+ }
+
+ ops = new ArrayList<String>(ops);
+ Collections.sort(ops, Collections.reverseOrder());
+
+ ArrayList<ReadOnlyRepo<T>> dops = new ArrayList<>();
+
+ for (String child : ops) {
+ if (child.startsWith("repo_")) {
+ byte[] ser;
+ try {
+ ser = zk.getData(txpath + "/" + child, null);
+ dops.add((ReadOnlyRepo<T>) deserialize(ser));
--- End diff --
I wanted more narrow supression, but was not quite sure how to achieve that
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54462324
--- Diff: shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java ---
@@ -53,6 +67,51 @@
private static final String USER = "accumulo";
+ // this class serializes references to interfaces with the concrete class name
+ private static class InterfaceSerializer<T> implements JsonSerializer<T> {
+ @Override
+ public JsonElement serialize(T link, Type type, JsonSerializationContext context) {
+ JsonElement je = context.serialize(link, link.getClass());
+ JsonObject jo = new JsonObject();
+ jo.add(link.getClass().getName(), je);
+ return jo;
+ }
+ }
+
+ // the purpose of this class is to be serialized as JSon for display
+ private static class ByteArrayContainer {
+ @SuppressWarnings("unused")
--- End diff --
Maybe just make them public?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54441134
--- Diff: fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ---
@@ -458,4 +458,43 @@ public Serializable getProperty(long tid, String prop) {
throw new RuntimeException(e);
}
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ReadOnlyRepo<T>> getStack(long tid) {
+ String txpath = getTXPath(tid);
+
+ outer: while (true) {
+ List<String> ops;
+ try {
+ ops = zk.getChildren(txpath);
+ } catch (KeeperException.NoNodeException e) {
+ return null;
+ } catch (KeeperException | InterruptedException e1) {
+ throw new RuntimeException(e1);
+ }
+
+ ops = new ArrayList<String>(ops);
+ Collections.sort(ops, Collections.reverseOrder());
+
+ ArrayList<ReadOnlyRepo<T>> dops = new ArrayList<>();
+
+ for (String child : ops) {
+ if (child.startsWith("repo_")) {
+ byte[] ser;
+ try {
+ ser = zk.getData(txpath + "/" + child, null);
+ dops.add((ReadOnlyRepo<T>) deserialize(ser));
--- End diff --
You can limit the unchecked cast warning suppression to just this parameter, if you assign it to a variable and put the warnings suppression on that variable, instead of the whole method.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54451601
--- Diff: shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java ---
@@ -53,6 +67,51 @@
private static final String USER = "accumulo";
+ // this class serializes references to interfaces with the concrete class name
+ private static class InterfaceSerializer<T> implements JsonSerializer<T> {
+ @Override
+ public JsonElement serialize(T link, Type type, JsonSerializationContext context) {
+ JsonElement je = context.serialize(link, link.getClass());
+ JsonObject jo = new JsonObject();
+ jo.add(link.getClass().getName(), je);
+ return jo;
+ }
+ }
+
+ // the purpose of this class is to be serialized as JSon for display
+ private static class ByteArrayContainer {
+ @SuppressWarnings("unused")
--- End diff --
there is a comment for the class mentioning its used for Json serialization.... thats why the instance vars are not read
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54451870
--- Diff: shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java ---
@@ -53,6 +67,51 @@
private static final String USER = "accumulo";
+ // this class serializes references to interfaces with the concrete class name
+ private static class InterfaceSerializer<T> implements JsonSerializer<T> {
+ @Override
+ public JsonElement serialize(T link, Type type, JsonSerializationContext context) {
+ JsonElement je = context.serialize(link, link.getClass());
+ JsonObject jo = new JsonObject();
+ jo.add(link.getClass().getName(), je);
+ return jo;
+ }
+ }
+
+ // the purpose of this class is to be serialized as JSon for display
+ private static class ByteArrayContainer {
+ @SuppressWarnings("unused")
--- End diff --
I will add some more comments
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54329410
--- Diff: fate/src/main/java/org/apache/accumulo/fate/ZooStore.java ---
@@ -458,4 +458,43 @@ public Serializable getProperty(long tid, String prop) {
throw new RuntimeException(e);
}
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ReadOnlyRepo<T>> getStack(long tid) {
+ String txpath = getTXPath(tid);
+
+ outer: while (true) {
+ List<String> ops;
+ try {
+ ops = zk.getChildren(txpath);
+ } catch (KeeperException.NoNodeException e) {
+ return null;
--- End diff --
Oh, I see you check for null down below. I think an empty list would be nicer (less of a chance for surprise), but would be happy with a javadoc update to `Store.getStack(long)` that says it might return null (since this isn't user-facing).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by ctubbsii <gi...@git.apache.org>.
Github user ctubbsii commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/77#discussion_r54441340
--- Diff: shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java ---
@@ -53,6 +67,51 @@
private static final String USER = "accumulo";
+ // this class serializes references to interfaces with the concrete class name
+ private static class InterfaceSerializer<T> implements JsonSerializer<T> {
+ @Override
+ public JsonElement serialize(T link, Type type, JsonSerializationContext context) {
+ JsonElement je = context.serialize(link, link.getClass());
+ JsonObject jo = new JsonObject();
+ jo.add(link.getClass().getName(), je);
+ return jo;
+ }
+ }
+
+ // the purpose of this class is to be serialized as JSon for display
+ private static class ByteArrayContainer {
+ @SuppressWarnings("unused")
--- End diff --
Would be better to delete these, rather than suppress warnings. If they are needed, then please add a comment explaining why they should be left in place with the warning suppression (here, and other occurrences below).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
Re: [GitHub] accumulo pull request: ACCUMULO-4152 add fate dump command
Posted by Chris Rigano <ch...@gmail.com>.
Please remove me from the list.
On Fri, Feb 26, 2016 at 7:09 PM, keith-turner <gi...@git.apache.org> wrote:
> GitHub user keith-turner opened a pull request:
>
> https://github.com/apache/accumulo/pull/77
>
> ACCUMULO-4152 add fate dump command
>
>
>
> You can merge this pull request into a Git repository by running:
>
> $ git pull https://github.com/keith-turner/accumulo ACCUMULO-4152
>
> Alternatively you can review and apply these changes as the patch at:
>
> https://github.com/apache/accumulo/pull/77.patch
>
> To close this pull request, make a commit to your master/trunk branch
> with (at least) the following in the commit message:
>
> This closes #77
>
> ----
> commit 71aa908e66d66e6b1cdd80913f7b32cfbafb600c
> Author: Keith Turner <kt...@apache.org>
> Date: 2016-02-24T23:20:32Z
>
> ACCUMULO-4152 add fate dump command
>
> ----
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---
>
--
=========================
Christopher P. Rigano
WWGD? Namaste