You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2014/10/02 00:24:27 UTC
[1/5] git commit: ACCUMULO-3192 add -np to accumulo fate command
Repository: accumulo
Updated Branches:
refs/heads/master 43ef53ed3 -> 2b689a2f6
ACCUMULO-3192 add -np to accumulo fate command
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/c5afc5a4
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c5afc5a4
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c5afc5a4
Branch: refs/heads/master
Commit: c5afc5a44fa9bf44301c86d632fcd43758184222
Parents: 2ad4074
Author: Eric C. Newton <er...@gmail.com>
Authored: Wed Oct 1 18:19:24 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Wed Oct 1 18:19:24 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/core/util/shell/commands/FateCommand.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5afc5a4/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
index e3be645..ce670cb 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FateCommand.java
@@ -55,6 +55,7 @@ public class FateCommand extends Command {
private Option secretOption;
private Option statusOption;
+ private Option disablePaginationOpt;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws ParseException, KeeperException, InterruptedException,
@@ -131,7 +132,7 @@ public class FateCommand extends Command {
StringBuilder buf = new StringBuilder(8096);
Formatter fmt = new Formatter(buf);
admin.print(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, fmt, filterTxid, filterStatus);
- shellState.printLines(Collections.singletonList(buf.toString()).iterator(), true);
+ shellState.printLines(Collections.singletonList(buf.toString()).iterator(), !cl.hasOption(disablePaginationOpt.getOpt()));
} else {
throw new ParseException("Invalid command option");
}
@@ -170,6 +171,8 @@ public class FateCommand extends Command {
statusOption.setArgs(Option.UNLIMITED_VALUES);
statusOption.setOptionalArg(false);
o.addOption(statusOption);
+ disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output");
+ o.addOption(disablePaginationOpt);
return o;
}
[5/5] git commit: Merge branch '1.6'
Posted by ec...@apache.org.
Merge branch '1.6'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2b689a2f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2b689a2f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2b689a2f
Branch: refs/heads/master
Commit: 2b689a2f686a5f895fb97fc33e97029ec204074c
Parents: 0559d9c 3c90ee9
Author: Eric C. Newton <er...@gmail.com>
Authored: Wed Oct 1 18:23:00 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Wed Oct 1 18:23:00 2014 -0400
----------------------------------------------------------------------
----------------------------------------------------------------------
[4/5] git commit: Merge remote-tracking branch 'origin/master'
Posted by ec...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/0559d9ce
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0559d9ce
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0559d9ce
Branch: refs/heads/master
Commit: 0559d9ceb0c964af8530f09eda4a2a2e753c8630
Parents: 404f571 43ef53e
Author: Eric C. Newton <er...@gmail.com>
Authored: Wed Oct 1 18:22:53 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Wed Oct 1 18:22:53 2014 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/master/FateServiceHandler.java | 2 +-
.../org/apache/accumulo/tserver/tablet/RootFiles.java | 2 +-
.../apache/accumulo/test/functional/SlowIterator.java | 13 ++++++-------
.../test/functional/AccumuloInputFormatIT.java | 5 ++---
.../apache/accumulo/test/functional/ExamplesIT.java | 3 ++-
5 files changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
[3/5] git commit: Merge remote-tracking branch 'origin/1.6' into 1.6
Posted by ec...@apache.org.
Merge remote-tracking branch 'origin/1.6' into 1.6
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3c90ee9a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3c90ee9a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3c90ee9a
Branch: refs/heads/master
Commit: 3c90ee9a86691f2d7ee759aa313d9515323680ca
Parents: c5afc5a d3586ea
Author: Eric C. Newton <er...@gmail.com>
Authored: Wed Oct 1 18:22:44 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Wed Oct 1 18:22:44 2014 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/master/FateServiceHandler.java | 2 +-
.../java/org/apache/accumulo/tserver/RootFiles.java | 2 +-
.../apache/accumulo/test/functional/SlowIterator.java | 13 ++++++-------
.../test/functional/AccumuloInputFormatIT.java | 4 +++-
.../apache/accumulo/test/functional/ExamplesIT.java | 3 ++-
5 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[2/5] git commit: Merge branch '1.6'
Posted by ec...@apache.org.
Merge branch '1.6'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/404f5714
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/404f5714
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/404f5714
Branch: refs/heads/master
Commit: 404f571458ffef9b5fd794ce8b363501171f6900
Parents: bedf402 c5afc5a
Author: Eric C. Newton <er...@gmail.com>
Authored: Wed Oct 1 18:22:00 2014 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Wed Oct 1 18:22:00 2014 -0400
----------------------------------------------------------------------
.../java/org/apache/accumulo/shell/commands/FateCommand.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/404f5714/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
----------------------------------------------------------------------
diff --cc shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
index 4d7a43f,0000000..85dc6b5
mode 100644,000000..100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
@@@ -1,181 -1,0 +1,184 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.shell.commands;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Formatter;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
+import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.AdminUtil;
+import org.apache.accumulo.fate.ReadOnlyTStore.TStatus;
+import org.apache.accumulo.fate.ZooStore;
+import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
+import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.shell.Shell;
+import org.apache.accumulo.shell.Shell.Command;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.zookeeper.KeeperException;
+
+/**
+ * Manage FATE transactions
+ *
+ */
+public class FateCommand extends Command {
+
+ private static final String SCHEME = "digest";
+
+ private static final String USER = "accumulo";
+
+ private Option secretOption;
+ private Option statusOption;
++ private Option disablePaginationOpt;
+
+ @Override
+ public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws ParseException, KeeperException, InterruptedException,
+ IOException {
+ Instance instance = shellState.getInstance();
+ String[] args = cl.getArgs();
+ if (args.length <= 0) {
+ throw new ParseException("Must provide a command to execute");
+ }
+ String cmd = args[0];
+ boolean failedCommand = false;
+
+ AdminUtil<FateCommand> admin = new AdminUtil<FateCommand>(false);
+
+ String path = ZooUtil.getRoot(instance) + Constants.ZFATE;
+ String masterPath = ZooUtil.getRoot(instance) + Constants.ZMASTER_LOCK;
+ IZooReaderWriter zk = getZooReaderWriter(shellState.getInstance(), cl.getOptionValue(secretOption.getOpt()));
+ ZooStore<FateCommand> zs = new ZooStore<FateCommand>(path, zk);
+
+ if ("fail".equals(cmd)) {
+ if (args.length <= 1) {
+ throw new ParseException("Must provide transaction ID");
+ }
+ for (int i = 1; i < args.length; i++) {
+ if (!admin.prepFail(zs, zk, masterPath, args[i])) {
+ System.out.printf("Could not fail transaction: %s%n", args[i]);
+ failedCommand = true;
+ }
+ }
+ } else if ("delete".equals(cmd)) {
+ if (args.length <= 1) {
+ throw new ParseException("Must provide transaction ID");
+ }
+ for (int i = 1; i < args.length; i++) {
+ if (admin.prepDelete(zs, zk, masterPath, args[i])) {
+ admin.deleteLocks(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, args[i]);
+ } else {
+ System.out.printf("Could not delete transaction: %s%n", args[i]);
+ failedCommand = true;
+ }
+ }
+ } else if ("list".equals(cmd) || "print".equals(cmd)) {
+ // Parse transaction ID filters for print display
+ Set<Long> filterTxid = null;
+ if (args.length >= 2) {
+ filterTxid = new HashSet<Long>(args.length);
+ for (int i = 1; i < args.length; i++) {
+ try {
+ Long val = Long.parseLong(args[i], 16);
+ filterTxid.add(val);
+ } catch (NumberFormatException nfe) {
+ // Failed to parse, will exit instead of displaying everything since the intention was to potentially filter some data
+ System.out.printf("Invalid transaction ID format: %s%n", args[i]);
+ return 1;
+ }
+ }
+ }
+
+ // Parse TStatus filters for print display
+ EnumSet<TStatus> filterStatus = null;
+ if (cl.hasOption(statusOption.getOpt())) {
+ filterStatus = EnumSet.noneOf(TStatus.class);
+ String[] tstat = cl.getOptionValues(statusOption.getOpt());
+ for (int i = 0; i < tstat.length; i++) {
+ try {
+ filterStatus.add(TStatus.valueOf(tstat[i]));
+ } catch (IllegalArgumentException iae) {
+ System.out.printf("Invalid transaction status name: %s%n", tstat[i]);
+ return 1;
+ }
+ }
+ }
+
+ StringBuilder buf = new StringBuilder(8096);
+ Formatter fmt = new Formatter(buf);
+ admin.print(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, fmt, filterTxid, filterStatus);
- shellState.printLines(Collections.singletonList(buf.toString()).iterator(), true);
++ shellState.printLines(Collections.singletonList(buf.toString()).iterator(), !cl.hasOption(disablePaginationOpt.getOpt()));
+ } else {
+ throw new ParseException("Invalid command option");
+ }
+
+ return failedCommand ? 1 : 0;
+ }
+
+ protected synchronized IZooReaderWriter getZooReaderWriter(Instance instance, String secret) {
+
+ if (secret == null) {
+ AccumuloConfiguration conf = SiteConfiguration.getInstance(DefaultConfiguration.getInstance());
+ secret = conf.get(Property.INSTANCE_SECRET);
+ }
+
+ return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), SCHEME, (USER + ":" + secret).getBytes());
+ }
+
+ @Override
+ public String description() {
+ return "manage FATE transactions";
+ }
+
+ @Override
+ public String usage() {
+ return getName() + " fail <txid>... | delete <txid>... | print [<txid>...]";
+ }
+
+ @Override
+ public Options getOptions() {
+ final Options o = new Options();
+ secretOption = new Option("s", "secret", true, "specify the instance secret to use");
+ secretOption.setOptionalArg(false);
+ o.addOption(secretOption);
+ statusOption = new Option("t", "status-type", true,
+ "filter 'print' on the transaction status type(s) {NEW, IN_PROGRESS, FAILED_IN_PROGRESS, FAILED, SUCCESSFUL}");
+ statusOption.setArgs(Option.UNLIMITED_VALUES);
+ statusOption.setOptionalArg(false);
+ o.addOption(statusOption);
++ disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output");
++ o.addOption(disablePaginationOpt);
+ return o;
+ }
+
+ @Override
+ public int numArgs() {
+ // Arg length varies between 1 to n
+ return -1;
+ }
+}