Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT Conflicts: core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java core/src/test/java/org/apache/accumulo/core/client/mapreduce/EmptySplitsAccumuloInputFormat.java 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/14e2b64f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/14e2b64f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/14e2b64f Branch: refs/heads/1.6.0-SNAPSHOT Commit: 14e2b64f74c5ecb1e9f906045d461830daa278ae Parents: 88f24d2 5363d78 Author: Christopher Tubbs <ctubb...@apache.org> Authored: Mon Apr 7 20:31:35 2014 -0400 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Mon Apr 7 20:31:35 2014 -0400 ---------------------------------------------------------------------- .../core/client/mapred/InputFormatBase.java | 1 + .../client/mapreduce/AccumuloInputFormat.java | 2 +- .../core/client/mapreduce/InputFormatBase.java | 1 + .../EmptySplitsAccumuloInputFormat.java | 10 ++++---- .../org/apache/accumulo/fate/ReadOnlyStore.java | 22 ++++++++--------- .../java/org/apache/accumulo/fate/TStore.java | 16 ++++++------- .../apache/accumulo/master/util/FateAdmin.java | 25 ++++++++++---------- 7 files changed, 39 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/14e2b64f/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/14e2b64f/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/14e2b64f/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/14e2b64f/core/src/test/java/org/apache/accumulo/core/client/mapreduce/EmptySplitsAccumuloInputFormat.java ---------------------------------------------------------------------- diff --cc core/src/test/java/org/apache/accumulo/core/client/mapreduce/EmptySplitsAccumuloInputFormat.java index 7d3dde6,68ac78f..dd531c0 --- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/EmptySplitsAccumuloInputFormat.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/EmptySplitsAccumuloInputFormat.java @@@ -27,19 -27,11 +27,19 @@@ import org.apache.hadoop.mapreduce.JobC * AccumuloInputFormat which returns an "empty" RangeInputSplit */ public class EmptySplitsAccumuloInputFormat extends AccumuloInputFormat { - + @Override public List<InputSplit> getSplits(JobContext context) throws IOException { - super.getSplits(context); + List<InputSplit> oldSplits = super.getSplits(context); + List<InputSplit> newSplits = new ArrayList<InputSplit>(oldSplits.size()); - + - return Arrays.<InputSplit> asList(new org.apache.accumulo.core.client.mapreduce.RangeInputSplit()); + // Copy only the necessary information + for (InputSplit oldSplit : oldSplits) { - org.apache.accumulo.core.client.mapreduce.RangeInputSplit newSplit = new org.apache.accumulo.core.client.mapreduce.RangeInputSplit((org.apache.accumulo.core.client.mapreduce.RangeInputSplit) oldSplit); ++ org.apache.accumulo.core.client.mapreduce.RangeInputSplit newSplit = new org.apache.accumulo.core.client.mapreduce.RangeInputSplit( ++ (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) oldSplit); + newSplits.add(newSplit); + } - - ++ + return newSplits; } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/14e2b64f/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 4e72832,0000000..759bb70 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,93 -1,0 +1,94 @@@ +/* + * 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.List; + +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.ZooStore; +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>(); + } - ++ + @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()); + 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"); - ++ ++ 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.getRetryingInstance(); + ZooStore<Master> zs = new ZooStore<Master>(path, zk); - ++ + if (jc.getParsedCommand().equals("fail")) { + if (!admin.prepFail(zs, zk, masterPath, args[1])) { + System.exit(1); + } + } else if (jc.getParsedCommand().equals("delete")) { + if (!admin.prepDelete(zs, zk, masterPath, args[1])) { + System.exit(1); + } + admin.deleteLocks(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, args[1]); + } else if (jc.getParsedCommand().equals("print")) { - admin.print(new ReadOnlyStore(zs), zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS); ++ admin.print(new ReadOnlyStore<Master>(zs), zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS); + } + } +}