accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [10/12] accumulo git commit: Merge branch '1.5' into 1.6
Date Fri, 23 Jan 2015 22:26:56 GMT
Merge branch '1.5' into 1.6

Conflicts:
	server/master/src/main/java/org/apache/accumulo/master/util/FateAdmin.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/69ca8c9c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/69ca8c9c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/69ca8c9c

Branch: refs/heads/master
Commit: 69ca8c9c0b1d4b069df82e47fba5b823e18f503e
Parents: 9f2fcf4 145f83a
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Fri Jan 23 17:24:26 2015 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Fri Jan 23 17:24:26 2015 -0500

----------------------------------------------------------------------
 .../accumulo/core/file/rfile/SplitLarge.java    |  3 +--
 .../org/apache/accumulo/server/util/ZooZap.java | 18 ++++++-------
 .../apache/accumulo/master/util/FateAdmin.java  | 28 +++++++++++++-------
 3 files changed, 28 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/69ca8c9c/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/69ca8c9c/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
----------------------------------------------------------------------
diff --cc server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
index fe1cc3c,0000000..f9bb208
mode 100644,000000..100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
@@@ -1,110 -1,0 +1,108 @@@
 +/*
 + * 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.server.util;
 +
 +import java.util.List;
 +
 +import org.apache.accumulo.core.Constants;
 +import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 +import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
 +import org.apache.accumulo.server.cli.ClientOpts;
 +import org.apache.accumulo.server.zookeeper.ZooLock;
 +import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 +
 +import com.beust.jcommander.JCommander;
 +import com.beust.jcommander.Parameter;
 +
 +public class ZooZap {
 +
-   static boolean verbose = false;
- 
-   private static void message(String msg) {
-     if (verbose)
++  private static void message(String msg, Opts opts) {
++    if (opts.verbose)
 +      System.out.println(msg);
 +  }
 +
 +  static class Opts extends ClientOpts {
 +    @Parameter(names = "-master", description = "remove master locks")
 +    boolean zapMaster = false;
 +    @Parameter(names = "-tservers", description = "remove tablet server locks")
 +    boolean zapTservers = false;
 +    @Parameter(names = "-tracers", description = "remove tracer locks")
 +    boolean zapTracers = false;
 +    @Parameter(names = "-verbose", description = "print out messages about progress")
 +    boolean verbose = false;
 +  }
 +
 +  public static void main(String[] args) {
 +    Opts opts = new Opts();
 +    opts.parseArgs(ZooZap.class.getName(), args);
 +
 +    if (!opts.zapMaster && !opts.zapTservers && !opts.zapTracers) {
 +      new JCommander(opts).usage();
 +      return;
 +    }
 +
 +    String iid = opts.getInstance().getInstanceID();
 +    IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 +
 +    if (opts.zapMaster) {
 +      String masterLockPath = Constants.ZROOT + "/" + iid + Constants.ZMASTER_LOCK;
 +
-       zapDirectory(zoo, masterLockPath);
++      zapDirectory(zoo, masterLockPath, opts);
 +    }
 +
 +    if (opts.zapTservers) {
 +      String tserversPath = Constants.ZROOT + "/" + iid + Constants.ZTSERVERS;
 +      try {
 +        List<String> children = zoo.getChildren(tserversPath);
 +        for (String child : children) {
-           message("Deleting " + tserversPath + "/" + child + " from zookeeper");
++          message("Deleting " + tserversPath + "/" + child + " from zookeeper", opts);
 +
 +          if (opts.zapMaster)
 +            ZooReaderWriter.getInstance().recursiveDelete(tserversPath + "/" + child, NodeMissingPolicy.SKIP);
 +          else {
 +            String path = tserversPath + "/" + child;
 +            if (zoo.getChildren(path).size() > 0) {
 +              if (!ZooLock.deleteLock(path, "tserver")) {
-                 message("Did not delete " + tserversPath + "/" + child);
++                message("Did not delete " + tserversPath + "/" + child, opts);
 +              }
 +            }
 +          }
 +        }
 +      } catch (Exception e) {
 +        e.printStackTrace();
 +      }
 +    }
 +
 +    if (opts.zapTracers) {
 +      String path = Constants.ZROOT + "/" + iid + Constants.ZTRACERS;
-       zapDirectory(zoo, path);
++      zapDirectory(zoo, path, opts);
 +    }
 +
 +  }
 +
-   private static void zapDirectory(IZooReaderWriter zoo, String path) {
++  private static void zapDirectory(IZooReaderWriter zoo, String path, Opts opts) {
 +    try {
 +      List<String> children = zoo.getChildren(path);
 +      for (String child : children) {
-         message("Deleting " + path + "/" + child + " from zookeeper");
++        message("Deleting " + path + "/" + child + " from zookeeper", opts);
 +        zoo.recursiveDelete(path + "/" + child, NodeMissingPolicy.SKIP);
 +      }
 +    } catch (Exception e) {
 +      e.printStackTrace();
 +    }
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/69ca8c9c/server/master/src/main/java/org/apache/accumulo/master/util/FateAdmin.java
----------------------------------------------------------------------
diff --cc server/master/src/main/java/org/apache/accumulo/master/util/FateAdmin.java
index 5ab5d75,0000000..953d630
mode 100644,000000..100644
--- a/server/master/src/main/java/org/apache/accumulo/master/util/FateAdmin.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/util/FateAdmin.java
@@@ -1,94 -1,0 +1,104 @@@
 +/*
 + * 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.master.util;
 +
 +import java.util.ArrayList;
++import java.util.LinkedHashMap;
 +import java.util.List;
++import java.util.Map.Entry;
 +
 +import org.apache.accumulo.core.Constants;
 +import org.apache.accumulo.core.cli.Help;
 +import org.apache.accumulo.core.client.Instance;
 +import org.apache.accumulo.core.zookeeper.ZooUtil;
 +import org.apache.accumulo.fate.AdminUtil;
 +import org.apache.accumulo.fate.ReadOnlyStore;
 +import org.apache.accumulo.fate.ZooStore;
 +import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 +import org.apache.accumulo.master.Master;
 +import org.apache.accumulo.server.client.HdfsZooInstance;
 +import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 +
 +import com.beust.jcommander.JCommander;
 +import com.beust.jcommander.Parameter;
 +import com.beust.jcommander.Parameters;
 +
 +/**
 + * A utility to administer FATE operations
 + */
 +public class FateAdmin {
 +
 +  static class TxOpts {
-     @Parameter(description = "<txid>", required = true)
-     List<String> args = new ArrayList<String>();
++    @Parameter(description = "<txid>...", required = true)
++    List<String> txids = new ArrayList<String>();
 +  }
 +
 +  @Parameters(commandDescription = "Stop an existing FATE by transaction id")
 +  static class FailOpts extends TxOpts {}
 +
 +  @Parameters(commandDescription = "Delete an existing FATE by transaction id")
 +  static class DeleteOpts extends TxOpts {}
 +
 +  @Parameters(commandDescription = "List the existing FATE transactions")
 +  static class PrintOpts {}
 +
 +  public static void main(String[] args) throws Exception {
 +    Help opts = new Help();
 +    JCommander jc = new JCommander(opts);
 +    jc.setProgramName(FateAdmin.class.getName());
-     jc.addCommand("fail", new FailOpts());
-     jc.addCommand("delete", new DeleteOpts());
++    LinkedHashMap<String,TxOpts> txOpts = new LinkedHashMap<String,TxOpts>(2);
++    txOpts.put("fail", new FailOpts());
++    txOpts.put("delete", new DeleteOpts());
++    for (Entry<String,TxOpts> entry : txOpts.entrySet()) {
++      jc.addCommand(entry.getKey(), entry.getValue());
++    }
 +    jc.addCommand("print", new PrintOpts());
 +    jc.parse(args);
 +    if (opts.help || jc.getParsedCommand() == null) {
 +      jc.usage();
 +      System.exit(1);
 +    }
 +
 +    System.err
 +        .printf("This tool has been deprecated%nFATE administration now available within
'accumulo shell'%n$ fate fail <txid>... | delete <txid>... | print [<txid>...]%n%n");
 +
 +    AdminUtil<Master> admin = new AdminUtil<Master>();
 +
 +    Instance instance = HdfsZooInstance.getInstance();
 +    String path = ZooUtil.getRoot(instance) + Constants.ZFATE;
 +    String masterPath = ZooUtil.getRoot(instance) + Constants.ZMASTER_LOCK;
 +    IZooReaderWriter zk = ZooReaderWriter.getInstance();
 +    ZooStore<Master> zs = new ZooStore<Master>(path, zk);
 +
 +    if (jc.getParsedCommand().equals("fail")) {
-       if (!admin.prepFail(zs, zk, masterPath, args[1])) {
-         System.exit(1);
++      for (String txid : txOpts.get(jc.getParsedCommand()).txids) {
++        if (!admin.prepFail(zs, zk, masterPath, txid)) {
++          System.exit(1);
++        }
 +      }
 +    } else if (jc.getParsedCommand().equals("delete")) {
-       if (!admin.prepDelete(zs, zk, masterPath, args[1])) {
-         System.exit(1);
++      for (String txid : txOpts.get(jc.getParsedCommand()).txids) {
++        if (!admin.prepDelete(zs, zk, masterPath, txid)) {
++          System.exit(1);
++        }
++        admin.deleteLocks(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, txid);
 +      }
-       admin.deleteLocks(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, args[1]);
 +    } else if (jc.getParsedCommand().equals("print")) {
 +      admin.print(new ReadOnlyStore<Master>(zs), zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS);
 +    }
 +  }
 +}


Mime
View raw message