My Bad. Will add them.
On Wed, Sep 18, 2013 at 5:51 PM, Aaron McCurry <[email protected]> wrote: > These files need Apache License headers. > > Aaron > > > On Tue, Sep 17, 2013 at 11:56 PM, <[email protected]> wrote: > > > Updated Branches: > > refs/heads/master a30a1da56 -> 453a0dd61 > > > > > > Exposed snapshot functionality through the shell > > > > > > Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo > > Commit: > > http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/5bb71276 > > Tree: > http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/5bb71276 > > Diff: > http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/5bb71276 > > > > Branch: refs/heads/master > > Commit: 5bb71276a3d701682e2baafd44c8145d816f345c > > Parents: a30a1da > > Author: Rahul Challapalli <[email protected]> > > Authored: Mon Sep 16 23:29:36 2013 -0700 > > Committer: Rahul Challapalli <[email protected]> > > Committed: Mon Sep 16 23:29:36 2013 -0700 > > > > ---------------------------------------------------------------------- > > .../blur/thrift/BlurControllerServer.java | 19 ++++--- > > .../blur/shell/CreateSnapshotCommand.java | 37 ++++++++++++++ > > .../apache/blur/shell/ListSnapshotsCommand.java | 52 > ++++++++++++++++++++ > > .../main/java/org/apache/blur/shell/Main.java | 5 +- > > .../blur/shell/RemoveSnapshotCommand.java | 35 +++++++++++++ > > 5 files changed, 141 insertions(+), 7 deletions(-) > > ---------------------------------------------------------------------- > > > > > > > > > http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/5bb71276/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java > > ---------------------------------------------------------------------- > > diff --git > > > a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java > > > b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java > > index 1376898..b1b0bf7 100644 > > --- > > > a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java > > +++ > > > b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java > > @@ -853,9 +853,11 @@ public class BlurControllerServer extends TableAdmin > > implements Iface { > > } > > }); > > } catch (Exception e) { > > - LOG.error("Unknown error while trying to create a snapshot of > table > > [{0}] snapshot name", e, table, name); > > - throw new BException("Unknown error while trying to create a > > snapshot of table [{0}] snapshot name", e, table, > > - name); > > + if (e instanceof BlurException) { > > + throw (BlurException) e; > > + } > > + LOG.error("Unknown error while trying to create a snapshot [{0}] > of > > table [{1}]", e, name, table); > > + throw new BException("Unknown error while trying to create a > > snapshot [{0}] of table [{1}]", e, name, table); > > } > > } > > > > @@ -871,9 +873,11 @@ public class BlurControllerServer extends TableAdmin > > implements Iface { > > } > > }); > > } catch (Exception e) { > > - LOG.error("Unknown error while trying to remove a snapshot of > table > > [{0}] snapshot name", e, table, name); > > - throw new BException("Unknown error while trying to remove a > > snapshot of table [{0}] snapshot name", e, table, > > - name); > > + if (e instanceof BlurException) { > > + throw (BlurException) e; > > + } > > + LOG.error("Unknown error while trying to remove a snapshot [{0}] > of > > table [{1}]", e, name, table); > > + throw new BException("Unknown error while trying to remove a > > snapshot [{0}] of table [{1}]", e, name, table); > > } > > } > > > > @@ -908,6 +912,9 @@ public class BlurControllerServer extends TableAdmin > > implements Iface { > > } > > }); > > } catch (Exception e) { > > + if (e instanceof BlurException) { > > + throw (BlurException) e; > > + } > > LOG.error("Unknown error while trying to get the list of snapshots > > for table [{0}]", e, table); > > throw new BException("Unknown error while trying to get the list > of > > snapshots for table [{0}]", e, table); > > } > > > > > > > http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/5bb71276/blur-shell/src/main/java/org/apache/blur/shell/CreateSnapshotCommand.java > > ---------------------------------------------------------------------- > > diff --git > > > a/blur-shell/src/main/java/org/apache/blur/shell/CreateSnapshotCommand.java > > > b/blur-shell/src/main/java/org/apache/blur/shell/CreateSnapshotCommand.java > > new file mode 100644 > > index 0000000..0e04696 > > --- /dev/null > > +++ > > > b/blur-shell/src/main/java/org/apache/blur/shell/CreateSnapshotCommand.java > > @@ -0,0 +1,37 @@ > > +package org.apache.blur.shell; > > + > > +import java.io.PrintWriter; > > + > > +import org.apache.blur.thirdparty.thrift_0_9_0.TException; > > +import org.apache.blur.thrift.generated.Blur.Iface; > > +import org.apache.blur.thrift.generated.BlurException; > > + > > +public class CreateSnapshotCommand extends Command { > > + > > + @Override > > + public void doit(PrintWriter out, Iface client, String[] args) > > + throws CommandException, TException, BlurException { > > + if (args.length != 3) { > > + throw new CommandException("Invalid args: " + help()); > > + } > > + String tablename = args[1]; > > + String snapshotName = args[2]; > > + client.createSnapshot(tablename, snapshotName); > > + } > > + > > + @Override > > + public String description() { > > + return "Create a named snapshot"; > > + } > > + > > + @Override > > + public String usage() { > > + return "<tablename> <snapshotname>"; > > + } > > + > > + @Override > > + public String name() { > > + return "create-snapshot"; > > + } > > + > > +} > > > > > > > http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/5bb71276/blur-shell/src/main/java/org/apache/blur/shell/ListSnapshotsCommand.java > > ---------------------------------------------------------------------- > > diff --git > > > a/blur-shell/src/main/java/org/apache/blur/shell/ListSnapshotsCommand.java > > > b/blur-shell/src/main/java/org/apache/blur/shell/ListSnapshotsCommand.java > > new file mode 100644 > > index 0000000..8b4261b > > --- /dev/null > > +++ > > > b/blur-shell/src/main/java/org/apache/blur/shell/ListSnapshotsCommand.java > > @@ -0,0 +1,52 @@ > > +package org.apache.blur.shell; > > + > > +import java.io.PrintWriter; > > +import java.util.List; > > +import java.util.Map; > > +import java.util.Map.Entry; > > + > > +import org.apache.blur.thirdparty.thrift_0_9_0.TException; > > +import org.apache.blur.thrift.generated.BlurException; > > +import org.apache.blur.thrift.generated.Blur.Iface; > > + > > +public class ListSnapshotsCommand extends Command { > > + > > + @Override > > + public void doit(PrintWriter out, Iface client, String[] args) > > + throws CommandException, TException, BlurException { > > + if (args.length != 2) { > > + throw new CommandException("Invalid args: " + help()); > > + } > > + String tablename = args[1]; > > + Map<String, List<String>> snapshotsPerShard = > > client.listSnapshots(tablename); > > + for (Entry<String, List<String>> entry : > > snapshotsPerShard.entrySet()) { > > + String shard = entry.getKey(); > > + out.print(shard + " : "); > > + int count = 0; > > + for (String snapshot : entry.getValue()) { > > + count++; > > + if (count == entry.getValue().size()) { > > + out.println(snapshot); > > + } else { > > + out.print(snapshot + ", "); > > + } > > + } > > + } > > + } > > + > > + @Override > > + public String description() { > > + return "List the existing snapshots of a table"; > > + } > > + > > + @Override > > + public String usage() { > > + return "<tablename>"; > > + } > > + > > + @Override > > + public String name() { > > + return "list-snapshots"; > > + } > > + > > +} > > > > > > > http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/5bb71276/blur-shell/src/main/java/org/apache/blur/shell/Main.java > > ---------------------------------------------------------------------- > > diff --git a/blur-shell/src/main/java/org/apache/blur/shell/Main.java > > b/blur-shell/src/main/java/org/apache/blur/shell/Main.java > > index 27362d7..5868cd3 100644 > > --- a/blur-shell/src/main/java/org/apache/blur/shell/Main.java > > +++ b/blur-shell/src/main/java/org/apache/blur/shell/Main.java > > @@ -301,7 +301,7 @@ public class Main { > > > > public static String[] tableCommands = { "create", "enable", > "disable", > > "remove", "truncate", "describe", "list", > > "schema", "stats", "layout", "parse", "definecolumn" }; > > - public static String[] dataCommands = { "query", "get", "mutate", > > "delete", "highlight", "selector", "terms" }; > > + public static String[] dataCommands = { "query", "get", "mutate", > > "delete", "highlight", "selector", "terms", "create-snapshot", > > "remove-snapshot", "list-snapshots"}; > > public static String[] clusterCommands = { "controllers", "shards", > > "clusterlist", "cluster", "safemodewait", "top" }; > > public static String[] shellCommands = { "help", "debug", "timed", > > "quit", "reset" }; > > > > @@ -554,6 +554,9 @@ public class Main { > > register(builder, new SelectorCommand()); > > register(builder, new AddColumnDefinitionCommand()); > > register(builder, new ResetCommand()); > > + register(builder, new CreateSnapshotCommand()); > > + register(builder, new RemoveSnapshotCommand()); > > + register(builder, new ListSnapshotsCommand()); > > commands = builder.build(); > > } > > > > > > > > > http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/5bb71276/blur-shell/src/main/java/org/apache/blur/shell/RemoveSnapshotCommand.java > > ---------------------------------------------------------------------- > > diff --git > > > a/blur-shell/src/main/java/org/apache/blur/shell/RemoveSnapshotCommand.java > > > b/blur-shell/src/main/java/org/apache/blur/shell/RemoveSnapshotCommand.java > > new file mode 100644 > > index 0000000..a56e6c7 > > --- /dev/null > > +++ > > > b/blur-shell/src/main/java/org/apache/blur/shell/RemoveSnapshotCommand.java > > @@ -0,0 +1,35 @@ > > +package org.apache.blur.shell; > > + > > +import java.io.PrintWriter; > > + > > +import org.apache.blur.thirdparty.thrift_0_9_0.TException; > > +import org.apache.blur.thrift.generated.BlurException; > > +import org.apache.blur.thrift.generated.Blur.Iface; > > + > > +public class RemoveSnapshotCommand extends Command { > > + @Override > > + public void doit(PrintWriter out, Iface client, String[] args) > > + throws CommandException, TException, BlurException { > > + if (args.length != 3) { > > + throw new CommandException("Invalid args: " + help()); > > + } > > + String tablename = args[1]; > > + String snapshotName = args[2]; > > + client.removeSnapshot(tablename, snapshotName); > > + } > > + > > + @Override > > + public String description() { > > + return "Remove a named snapshot"; > > + } > > + > > + @Override > > + public String usage() { > > + return "<tablename> <snapshotname>"; > > + } > > + > > + @Override > > + public String name() { > > + return "remove-snapshot"; > > + } > > +} > > > > >
