You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/07/18 02:07:56 UTC
[1/8] accumulo git commit: ACCUMULO-3934 Formatting.
Repository: accumulo
Updated Branches:
refs/heads/1.6 68dd75013 -> 967100dda
refs/heads/1.7 4911f855d -> e8df6f0f2
refs/heads/master 7ec6291a3 -> 4f3d58d0d
ACCUMULO-3934 Formatting.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/39f8e732
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/39f8e732
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/39f8e732
Branch: refs/heads/master
Commit: 39f8e7324acc510fea70952519596a89e9d9b0b4
Parents: 38baaa8
Author: Josh Elser <el...@apache.org>
Authored: Fri Jul 10 18:41:06 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Jul 10 18:41:06 2015 -0400
----------------------------------------------------------------------
.../main/java/org/apache/accumulo/core/client/BatchScanner.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/39f8e732/core/src/main/java/org/apache/accumulo/core/client/BatchScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/BatchScanner.java b/core/src/main/java/org/apache/accumulo/core/client/BatchScanner.java
index de82d2f..494bf56 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/BatchScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/BatchScanner.java
@@ -30,9 +30,8 @@ import org.apache.accumulo.core.data.Range;
* If you want to lookup a few ranges and expect those ranges to contain a lot of data, then use the Scanner instead. Also, the Scanner will return data in
* sorted order, this will not.
*
- * A BatchScanner instance will use no more threads than provided in the construction of the BatchScanner
- * implementation. Multiple invocations of <code>iterator()</code> will all share the same resources of the instance.
- * A new BatchScanner instance should be created to use allocate additional threads.
+ * A BatchScanner instance will use no more threads than provided in the construction of the BatchScanner implementation. Multiple invocations of
+ * <code>iterator()</code> will all share the same resources of the instance. A new BatchScanner instance should be created to use allocate additional threads.
*/
public interface BatchScanner extends ScannerBase {
[2/8] accumulo git commit: ACCUMULO-3937 Allow configuration in
killing a tserver due to HDFS failures
Posted by ct...@apache.org.
ACCUMULO-3937 Allow configuration in killing a tserver due to HDFS failures
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4911f855
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4911f855
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4911f855
Branch: refs/heads/master
Commit: 4911f855d9f8eea94e5b0ae848cc37fcef355252
Parents: 39f8e73
Author: Josh Elser <el...@apache.org>
Authored: Fri Jul 10 18:41:12 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Jul 10 18:41:12 2015 -0400
----------------------------------------------------------------------
.../java/org/apache/accumulo/core/conf/Property.java | 5 +++++
.../java/org/apache/accumulo/tserver/TabletServer.java | 8 +++++---
.../apache/accumulo/tserver/log/TabletServerLogger.java | 12 +++++++-----
3 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/4911f855/core/src/main/java/org/apache/accumulo/core/conf/Property.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index b0ade7a..3e2b2e7 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -245,6 +245,11 @@ public enum Property {
+ "must be made, which is slower. However opening too many files at once can cause problems."),
TSERV_WALOG_MAX_SIZE("tserver.walog.max.size", "1G", PropertyType.MEMORY,
"The maximum size for each write-ahead log. See comment for property tserver.memory.maps.max"),
+ TSERV_WALOG_TOLERATED_CREATION_FAILURES("tserver.walog.tolerated.creation.failures", "15", PropertyType.COUNT,
+ "The maximum number of failures tolerated when creating a new WAL file within the period specified by tserver.walog.failures.period."
+ + " Exceeding this number of failures in the period causes the TabletServer to exit."),
+ TSERV_WALOG_TOLERATED_CREATION_FAILURES_PERIOD("tserver.walog.tolerated.creation.failures.period", "10s", PropertyType.TIMEDURATION,
+ "The period in which the number of failures to create a WAL file in HDFS causes the TabletServer to exit."),
TSERV_MAJC_DELAY("tserver.compaction.major.delay", "30s", PropertyType.TIMEDURATION,
"Time a tablet server will sleep between checking which tablets need compaction."),
TSERV_MAJC_THREAD_MAXOPEN("tserver.compaction.major.thread.files.open.max", "10", PropertyType.COUNT,
http://git-wip-us.apache.org/repos/asf/accumulo/blob/4911f855/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 8b6ad30..4be001a 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -343,12 +343,14 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
}
}, 5000, 5000);
- long walogMaxSize = getConfiguration().getMemoryInBytes(Property.TSERV_WALOG_MAX_SIZE);
- long minBlockSize = CachedConfiguration.getInstance().getLong("dfs.namenode.fs-limits.min-block-size", 0);
+ final long walogMaxSize = getConfiguration().getMemoryInBytes(Property.TSERV_WALOG_MAX_SIZE);
+ final long minBlockSize = CachedConfiguration.getInstance().getLong("dfs.namenode.fs-limits.min-block-size", 0);
if (minBlockSize != 0 && minBlockSize > walogMaxSize)
throw new RuntimeException("Unable to start TabletServer. Logger is set to use blocksize " + walogMaxSize + " but hdfs minimum block size is "
+ minBlockSize + ". Either increase the " + Property.TSERV_WALOG_MAX_SIZE + " or decrease dfs.namenode.fs-limits.min-block-size in hdfs-site.xml.");
- logger = new TabletServerLogger(this, walogMaxSize, syncCounter, flushCounter);
+ final long toleratedWalCreationFailures = getConfiguration().getCount(Property.TSERV_WALOG_TOLERATED_CREATION_FAILURES);
+ final long toleratedWalCreationFailuresPeriod = getConfiguration().getTimeInMillis(Property.TSERV_WALOG_TOLERATED_CREATION_FAILURES_PERIOD);
+ logger = new TabletServerLogger(this, walogMaxSize, syncCounter, flushCounter, toleratedWalCreationFailures, toleratedWalCreationFailuresPeriod);
this.resourceManager = new TabletServerResourceManager(this, fs);
this.security = AuditedSecurityOperation.getInstance(this);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/4911f855/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
index 1d385d9..a1921c2 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@ -92,9 +92,8 @@ public class TabletServerLogger {
private final AtomicLong syncCounter;
private final AtomicLong flushCounter;
- private final static int HALT_AFTER_ERROR_COUNT = 5;
- // Die if we get 5 WAL creation errors in 10 seconds
- private final Cache<Long,Object> walErrors = CacheBuilder.newBuilder().maximumSize(HALT_AFTER_ERROR_COUNT).expireAfterWrite(10, TimeUnit.SECONDS).build();
+ private final long toleratedFailures;
+ private final Cache<Long,Object> walErrors;
static private abstract class TestCallWithWriteLock {
abstract boolean test();
@@ -139,11 +138,14 @@ public class TabletServerLogger {
}
}
- public TabletServerLogger(TabletServer tserver, long maxSize, AtomicLong syncCounter, AtomicLong flushCounter) {
+ public TabletServerLogger(TabletServer tserver, long maxSize, AtomicLong syncCounter, AtomicLong flushCounter, long toleratedWalCreationFailures,
+ long toleratedFailuresPeriodMillis) {
this.tserver = tserver;
this.maxSize = maxSize;
this.syncCounter = syncCounter;
this.flushCounter = flushCounter;
+ this.toleratedFailures = toleratedWalCreationFailures;
+ this.walErrors = CacheBuilder.newBuilder().maximumSize(toleratedFailures).expireAfterWrite(toleratedFailuresPeriodMillis, TimeUnit.MILLISECONDS).build();
}
private int initializeLoggers(final List<DfsLogger> copy) throws IOException {
@@ -204,7 +206,7 @@ public class TabletServerLogger {
return;
} catch (Exception t) {
walErrors.put(System.currentTimeMillis(), "");
- if (walErrors.size() >= HALT_AFTER_ERROR_COUNT) {
+ if (walErrors.size() > toleratedFailures) {
Halt.halt("Experienced too many errors creating WALs, giving up");
}
throw new RuntimeException(t);
[7/8] accumulo git commit: Merge branch '1.6' into 1.7
Posted by ct...@apache.org.
Merge branch '1.6' into 1.7
Conflicts:
shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e8df6f0f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e8df6f0f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e8df6f0f
Branch: refs/heads/1.7
Commit: e8df6f0f22f39f825ee0ea2d54659358353bfebb
Parents: 4911f85 967100d
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Jul 17 19:48:29 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Jul 17 19:48:29 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/mapreduce/RangeInputSplit.java | 2 +-
.../core/client/mapreduce/AccumuloInputFormatTest.java | 12 +++++-------
.../java/org/apache/accumulo/shell/ShellConfigTest.java | 10 +++++-----
3 files changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8df6f0f/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8df6f0f/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index a14560c,1801b37..83662e8
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@@ -300,29 -301,9 +300,29 @@@ public class AccumuloInputFormatTest
}
@Test
+ public void testMapWithBatchScanner() throws Exception {
+ final String INSTANCE_NAME = PREFIX + "_mapreduce_instance";
+ final String TEST_TABLE_2 = PREFIX + "_mapreduce_table_2";
+
+ MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+ Connector c = mockInstance.getConnector("root", new PasswordToken(""));
+ c.tableOperations().create(TEST_TABLE_2);
+ BatchWriter bw = c.createBatchWriter(TEST_TABLE_2, new BatchWriterConfig());
+ for (int i = 0; i < 100; i++) {
+ Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
+ m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
+ bw.addMutation(m);
+ }
+ bw.close();
+
- Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_2, INSTANCE_NAME, AccumuloInputFormat.class.getCanonicalName(), "True"}));
++ Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_2, INSTANCE_NAME, AccumuloInputFormat.class.getName(), "True"}));
+ assertNull(e1);
+ assertNull(e2);
+ }
+
+ @Test
public void testCorrectRangeInputSplits() throws Exception {
- @SuppressWarnings("deprecation")
- Job job = new Job(new Configuration(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
+ Job job = Job.getInstance(new Configuration(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
String username = "user", table = "table", instance = "mapreduce_testCorrectRangeInputSplits";
PasswordToken password = new PasswordToken("password");
@@@ -383,10 -364,10 +383,8 @@@
}
bw.close();
-- Assert.assertEquals(
-- 0,
-- MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration",
- EmptySplitsAccumuloInputFormat.class.getCanonicalName()}));
- EmptySplitsAccumuloInputFormat.class.getName()}));
++ Assert.assertEquals(0,
++ MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration", EmptySplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8df6f0f/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --cc shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index bbeef56,0000000..64bad82
mode 100644,000000..100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@@ -1,150 -1,0 +1,150 @@@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.HashMap;
+import java.util.Map;
+
+import jline.console.ConsoleReader;
+
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.shell.ShellTest.TestOutputStream;
+import org.apache.log4j.Level;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.beust.jcommander.ParameterException;
+
+public class ShellConfigTest {
+ TestOutputStream output;
+ Shell shell;
+ PrintStream out;
+ File config;
+ private static final Logger log = LoggerFactory.getLogger(ShellConfigTest.class);
+
+ @Before
+ public void setUp() throws Exception {
+ Shell.log.setLevel(Level.ERROR);
+
+ out = System.out;
+ output = new TestOutputStream();
+ System.setOut(new PrintStream(output));
+ config = Files.createTempFile(null, null).toFile();
+
+ shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), output), new PrintWriter(output));
+ shell.setLogErrorsToConsole();
+ }
+
+ @After
+ public void teardown() throws Exception {
+ shell.shutdown();
+ output.clear();
+ System.setOut(out);
+ if (config.exists()) {
+ if (!config.delete()) {
+ log.error("Unable to delete {}", config);
+ }
+ }
+ }
+
+ public String[] args(String... args) {
+ // Avoid a locally installed client configuration file from breaking the test
+ String[] finalArgs = new String[args.length + 2];
+ int i = 0;
+ finalArgs[i++] = "--config-file";
+ finalArgs[i++] = config.toString();
+ for (String arg : args) {
+ finalArgs[i++] = arg;
+ }
+ return finalArgs;
+ }
+
+ @Test
+ public void testHelp() {
+ assertFalse(shell.config(args("--help")));
+ assertTrue("Did not print usage", output.get().startsWith("Usage"));
+ }
+
+ @Test
+ public void testBadArg() {
+ assertFalse(shell.config(args("--bogus")));
+ assertTrue("Did not print usage", output.get().startsWith("Usage"));
+ }
+
+ @Test
+ public void testTokenWithoutOptions() {
- assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getCanonicalName())));
- assertFalse(output.get().contains(ParameterException.class.getCanonicalName()));
++ assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
++ assertFalse(output.get().contains(ParameterException.class.getName()));
+ }
+
+ @Test
+ public void testTokenAndOption() {
- assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-u", "foo", "-l", "password=foo")));
++ assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
+ }
+
+ @Test
+ public void testTokenAndOptionAndPassword() {
- assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-l", "password=foo", "-p", "bar")));
- assertTrue(output.get().contains(ParameterException.class.getCanonicalName()));
++ assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
++ assertTrue(output.get().contains(ParameterException.class.getName()));
+ }
+
+ @Test
+ public void testZooKeeperHostFallBackToSite() throws Exception {
+ ClientConfiguration clientConfig = new ClientConfiguration();
+ Map<String,String> data = new HashMap<>();
+ data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname");
+ AccumuloConfiguration conf = new ConfigurationCopy(data);
+ assertEquals("site_hostname", Shell.getZooKeepers(null, clientConfig, conf));
+ }
+
+ @Test
+ public void testZooKeeperHostFromClientConfig() throws Exception {
+ ClientConfiguration clientConfig = new ClientConfiguration();
+ clientConfig.withZkHosts("cc_hostname");
+ Map<String,String> data = new HashMap<>();
+ data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname");
+ AccumuloConfiguration conf = new ConfigurationCopy(data);
+ assertEquals("cc_hostname", Shell.getZooKeepers(null, clientConfig, conf));
+ }
+
+ @Test
+ public void testZooKeeperHostFromOption() throws Exception {
+ ClientConfiguration clientConfig = new ClientConfiguration();
+ clientConfig.withZkHosts("cc_hostname");
+ Map<String,String> data = new HashMap<>();
+ data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname");
+ AccumuloConfiguration conf = new ConfigurationCopy(data);
+ assertEquals("opt_hostname", Shell.getZooKeepers("opt_hostname", clientConfig, conf));
+ }
+}
[3/8] accumulo git commit: ACCUMULO-3938 Remove incorrect
getCanonicalName() usage
Posted by ct...@apache.org.
ACCUMULO-3938 Remove incorrect getCanonicalName() usage
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/967100dd
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/967100dd
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/967100dd
Branch: refs/heads/1.6
Commit: 967100ddad5cfc0a525b951e3730b3270c20ef54
Parents: 68dd750
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Jul 17 19:33:39 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Jul 17 19:33:39 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/mapreduce/RangeInputSplit.java | 2 +-
.../core/client/mapreduce/AccumuloInputFormatTest.java | 6 +++---
.../apache/accumulo/core/util/shell/ShellConfigTest.java | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index 803f835..874aaa8 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
@@ -301,7 +301,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
if (null != token && null != tokenFile) {
throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
} else if (null != token) {
- out.writeUTF(token.getClass().getCanonicalName());
+ out.writeUTF(token.getClass().getName());
out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
} else {
out.writeUTF(tokenFile);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index ed4965d..1801b37 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -295,7 +295,7 @@ public class AccumuloInputFormatTest {
}
bw.close();
- Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getCanonicalName()}));
+ Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
@@ -367,7 +367,7 @@ public class AccumuloInputFormatTest {
Assert.assertEquals(
0,
MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration",
- EmptySplitsAccumuloInputFormat.class.getCanonicalName()}));
+ EmptySplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
@@ -392,7 +392,7 @@ public class AccumuloInputFormatTest {
Assert.assertEquals(
1,
MRTester.main(new String[] {user, "", "testtable", "testPartialFailedInputSplitDelegationToConfiguration",
- BadPasswordSplitsAccumuloInputFormat.class.getCanonicalName()}));
+ BadPasswordSplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
index c61b6f0..c4c6667 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
@@ -80,19 +80,19 @@ public class ShellConfigTest {
@Test
public void testTokenWithoutOptions() {
- assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName()));
- assertFalse(output.get().contains(ParameterException.class.getCanonicalName()));
+ assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getName()));
+ assertFalse(output.get().contains(ParameterException.class.getName()));
}
@Test
public void testTokenAndOption() {
- assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-u", "foo", "-l", "password=foo"));
+ assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo"));
}
@Test
public void testTokenAndOptionAndPassword() {
- assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-l", "password=foo", "-p", "bar"));
- assertTrue(output.get().contains(ParameterException.class.getCanonicalName()));
+ assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar"));
+ assertTrue(output.get().contains(ParameterException.class.getName()));
}
@Test
[6/8] accumulo git commit: Merge branch '1.6' into 1.7
Posted by ct...@apache.org.
Merge branch '1.6' into 1.7
Conflicts:
shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e8df6f0f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e8df6f0f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e8df6f0f
Branch: refs/heads/master
Commit: e8df6f0f22f39f825ee0ea2d54659358353bfebb
Parents: 4911f85 967100d
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Jul 17 19:48:29 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Jul 17 19:48:29 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/mapreduce/RangeInputSplit.java | 2 +-
.../core/client/mapreduce/AccumuloInputFormatTest.java | 12 +++++-------
.../java/org/apache/accumulo/shell/ShellConfigTest.java | 10 +++++-----
3 files changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8df6f0f/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8df6f0f/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index a14560c,1801b37..83662e8
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@@ -300,29 -301,9 +300,29 @@@ public class AccumuloInputFormatTest
}
@Test
+ public void testMapWithBatchScanner() throws Exception {
+ final String INSTANCE_NAME = PREFIX + "_mapreduce_instance";
+ final String TEST_TABLE_2 = PREFIX + "_mapreduce_table_2";
+
+ MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+ Connector c = mockInstance.getConnector("root", new PasswordToken(""));
+ c.tableOperations().create(TEST_TABLE_2);
+ BatchWriter bw = c.createBatchWriter(TEST_TABLE_2, new BatchWriterConfig());
+ for (int i = 0; i < 100; i++) {
+ Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
+ m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
+ bw.addMutation(m);
+ }
+ bw.close();
+
- Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_2, INSTANCE_NAME, AccumuloInputFormat.class.getCanonicalName(), "True"}));
++ Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_2, INSTANCE_NAME, AccumuloInputFormat.class.getName(), "True"}));
+ assertNull(e1);
+ assertNull(e2);
+ }
+
+ @Test
public void testCorrectRangeInputSplits() throws Exception {
- @SuppressWarnings("deprecation")
- Job job = new Job(new Configuration(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
+ Job job = Job.getInstance(new Configuration(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
String username = "user", table = "table", instance = "mapreduce_testCorrectRangeInputSplits";
PasswordToken password = new PasswordToken("password");
@@@ -383,10 -364,10 +383,8 @@@
}
bw.close();
-- Assert.assertEquals(
-- 0,
-- MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration",
- EmptySplitsAccumuloInputFormat.class.getCanonicalName()}));
- EmptySplitsAccumuloInputFormat.class.getName()}));
++ Assert.assertEquals(0,
++ MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration", EmptySplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8df6f0f/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --cc shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
index bbeef56,0000000..64bad82
mode 100644,000000..100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@@ -1,150 -1,0 +1,150 @@@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.HashMap;
+import java.util.Map;
+
+import jline.console.ConsoleReader;
+
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ConfigurationCopy;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.shell.ShellTest.TestOutputStream;
+import org.apache.log4j.Level;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.beust.jcommander.ParameterException;
+
+public class ShellConfigTest {
+ TestOutputStream output;
+ Shell shell;
+ PrintStream out;
+ File config;
+ private static final Logger log = LoggerFactory.getLogger(ShellConfigTest.class);
+
+ @Before
+ public void setUp() throws Exception {
+ Shell.log.setLevel(Level.ERROR);
+
+ out = System.out;
+ output = new TestOutputStream();
+ System.setOut(new PrintStream(output));
+ config = Files.createTempFile(null, null).toFile();
+
+ shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), output), new PrintWriter(output));
+ shell.setLogErrorsToConsole();
+ }
+
+ @After
+ public void teardown() throws Exception {
+ shell.shutdown();
+ output.clear();
+ System.setOut(out);
+ if (config.exists()) {
+ if (!config.delete()) {
+ log.error("Unable to delete {}", config);
+ }
+ }
+ }
+
+ public String[] args(String... args) {
+ // Avoid a locally installed client configuration file from breaking the test
+ String[] finalArgs = new String[args.length + 2];
+ int i = 0;
+ finalArgs[i++] = "--config-file";
+ finalArgs[i++] = config.toString();
+ for (String arg : args) {
+ finalArgs[i++] = arg;
+ }
+ return finalArgs;
+ }
+
+ @Test
+ public void testHelp() {
+ assertFalse(shell.config(args("--help")));
+ assertTrue("Did not print usage", output.get().startsWith("Usage"));
+ }
+
+ @Test
+ public void testBadArg() {
+ assertFalse(shell.config(args("--bogus")));
+ assertTrue("Did not print usage", output.get().startsWith("Usage"));
+ }
+
+ @Test
+ public void testTokenWithoutOptions() {
- assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getCanonicalName())));
- assertFalse(output.get().contains(ParameterException.class.getCanonicalName()));
++ assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
++ assertFalse(output.get().contains(ParameterException.class.getName()));
+ }
+
+ @Test
+ public void testTokenAndOption() {
- assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-u", "foo", "-l", "password=foo")));
++ assertTrue(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo")));
+ }
+
+ @Test
+ public void testTokenAndOptionAndPassword() {
- assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-l", "password=foo", "-p", "bar")));
- assertTrue(output.get().contains(ParameterException.class.getCanonicalName()));
++ assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
++ assertTrue(output.get().contains(ParameterException.class.getName()));
+ }
+
+ @Test
+ public void testZooKeeperHostFallBackToSite() throws Exception {
+ ClientConfiguration clientConfig = new ClientConfiguration();
+ Map<String,String> data = new HashMap<>();
+ data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname");
+ AccumuloConfiguration conf = new ConfigurationCopy(data);
+ assertEquals("site_hostname", Shell.getZooKeepers(null, clientConfig, conf));
+ }
+
+ @Test
+ public void testZooKeeperHostFromClientConfig() throws Exception {
+ ClientConfiguration clientConfig = new ClientConfiguration();
+ clientConfig.withZkHosts("cc_hostname");
+ Map<String,String> data = new HashMap<>();
+ data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname");
+ AccumuloConfiguration conf = new ConfigurationCopy(data);
+ assertEquals("cc_hostname", Shell.getZooKeepers(null, clientConfig, conf));
+ }
+
+ @Test
+ public void testZooKeeperHostFromOption() throws Exception {
+ ClientConfiguration clientConfig = new ClientConfiguration();
+ clientConfig.withZkHosts("cc_hostname");
+ Map<String,String> data = new HashMap<>();
+ data.put(Property.INSTANCE_ZK_HOST.getKey(), "site_hostname");
+ AccumuloConfiguration conf = new ConfigurationCopy(data);
+ assertEquals("opt_hostname", Shell.getZooKeepers("opt_hostname", clientConfig, conf));
+ }
+}
[5/8] accumulo git commit: ACCUMULO-3938 Remove incorrect
getCanonicalName() usage
Posted by ct...@apache.org.
ACCUMULO-3938 Remove incorrect getCanonicalName() usage
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/967100dd
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/967100dd
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/967100dd
Branch: refs/heads/1.7
Commit: 967100ddad5cfc0a525b951e3730b3270c20ef54
Parents: 68dd750
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Jul 17 19:33:39 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Jul 17 19:33:39 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/mapreduce/RangeInputSplit.java | 2 +-
.../core/client/mapreduce/AccumuloInputFormatTest.java | 6 +++---
.../apache/accumulo/core/util/shell/ShellConfigTest.java | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index 803f835..874aaa8 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
@@ -301,7 +301,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
if (null != token && null != tokenFile) {
throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
} else if (null != token) {
- out.writeUTF(token.getClass().getCanonicalName());
+ out.writeUTF(token.getClass().getName());
out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
} else {
out.writeUTF(tokenFile);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index ed4965d..1801b37 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -295,7 +295,7 @@ public class AccumuloInputFormatTest {
}
bw.close();
- Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getCanonicalName()}));
+ Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
@@ -367,7 +367,7 @@ public class AccumuloInputFormatTest {
Assert.assertEquals(
0,
MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration",
- EmptySplitsAccumuloInputFormat.class.getCanonicalName()}));
+ EmptySplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
@@ -392,7 +392,7 @@ public class AccumuloInputFormatTest {
Assert.assertEquals(
1,
MRTester.main(new String[] {user, "", "testtable", "testPartialFailedInputSplitDelegationToConfiguration",
- BadPasswordSplitsAccumuloInputFormat.class.getCanonicalName()}));
+ BadPasswordSplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
index c61b6f0..c4c6667 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
@@ -80,19 +80,19 @@ public class ShellConfigTest {
@Test
public void testTokenWithoutOptions() {
- assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName()));
- assertFalse(output.get().contains(ParameterException.class.getCanonicalName()));
+ assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getName()));
+ assertFalse(output.get().contains(ParameterException.class.getName()));
}
@Test
public void testTokenAndOption() {
- assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-u", "foo", "-l", "password=foo"));
+ assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo"));
}
@Test
public void testTokenAndOptionAndPassword() {
- assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-l", "password=foo", "-p", "bar"));
- assertTrue(output.get().contains(ParameterException.class.getCanonicalName()));
+ assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar"));
+ assertTrue(output.get().contains(ParameterException.class.getName()));
}
@Test
[8/8] accumulo git commit: Merge branch '1.7'
Posted by ct...@apache.org.
Merge branch '1.7'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4f3d58d0
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4f3d58d0
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4f3d58d0
Branch: refs/heads/master
Commit: 4f3d58d0d66791e290ffad3f76bd5990daa23b5f
Parents: 7ec6291 e8df6f0
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Jul 17 20:07:19 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Jul 17 20:07:19 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/mapreduce/RangeInputSplit.java | 2 +-
.../java/org/apache/accumulo/core/conf/Property.java | 5 +++++
.../core/client/mapreduce/AccumuloInputFormatTest.java | 12 +++++-------
.../java/org/apache/accumulo/tserver/TabletServer.java | 8 +++++---
.../apache/accumulo/tserver/log/TabletServerLogger.java | 12 +++++++-----
.../java/org/apache/accumulo/shell/ShellConfigTest.java | 10 +++++-----
6 files changed, 28 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/4f3d58d0/core/src/main/java/org/apache/accumulo/core/conf/Property.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/4f3d58d0/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/4f3d58d0/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
index e6d7185,a1921c2..386de35
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@@ -151,17 -144,20 +151,19 @@@ public class TabletServerLogger
this.maxSize = maxSize;
this.syncCounter = syncCounter;
this.flushCounter = flushCounter;
+ this.toleratedFailures = toleratedWalCreationFailures;
+ this.walErrors = CacheBuilder.newBuilder().maximumSize(toleratedFailures).expireAfterWrite(toleratedFailuresPeriodMillis, TimeUnit.MILLISECONDS).build();
}
- private int initializeLoggers(final List<DfsLogger> copy) throws IOException {
- final int[] result = {-1};
- testLockAndRun(logSetLock, new TestCallWithWriteLock() {
+ private DfsLogger initializeLoggers(final AtomicInteger logIdOut) throws IOException {
+ final AtomicReference<DfsLogger> result = new AtomicReference<DfsLogger>();
+ testLockAndRun(logIdLock, new TestCallWithWriteLock() {
@Override
boolean test() {
- copy.clear();
- copy.addAll(loggers);
- if (!loggers.isEmpty())
- result[0] = logSetId.get();
- return loggers.isEmpty();
+ result.set(currentLog);
+ if (currentLog != null)
+ logIdOut.set(logId.get());
+ return currentLog == null;
}
@Override
@@@ -208,22 -199,14 +210,22 @@@
}
try {
- DfsLogger alog = new DfsLogger(tserver.getServerConfig(), syncCounter, flushCounter);
- alog.open(tserver.getClientAddressString());
- loggers.add(alog);
- logSetId.incrementAndGet();
- return;
+ startLogMaker();
+ Object next = nextLog.take();
+ if (next instanceof Exception) {
+ throw (Exception) next;
+ }
+ if (next instanceof DfsLogger) {
+ currentLog = (DfsLogger) next;
+ logId.incrementAndGet();
+ log.info("Using next log " + currentLog.getFileName());
+ return;
+ } else {
+ throw new RuntimeException("Error: unexpected type seen: " + next);
+ }
} catch (Exception t) {
walErrors.put(System.currentTimeMillis(), "");
- if (walErrors.size() >= HALT_AFTER_ERROR_COUNT) {
+ if (walErrors.size() > toleratedFailures) {
Halt.halt("Experienced too many errors creating WALs, giving up");
}
throw new RuntimeException(t);
[4/8] accumulo git commit: ACCUMULO-3938 Remove incorrect
getCanonicalName() usage
Posted by ct...@apache.org.
ACCUMULO-3938 Remove incorrect getCanonicalName() usage
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/967100dd
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/967100dd
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/967100dd
Branch: refs/heads/master
Commit: 967100ddad5cfc0a525b951e3730b3270c20ef54
Parents: 68dd750
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Jul 17 19:33:39 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Jul 17 19:33:39 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/mapreduce/RangeInputSplit.java | 2 +-
.../core/client/mapreduce/AccumuloInputFormatTest.java | 6 +++---
.../apache/accumulo/core/util/shell/ShellConfigTest.java | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index 803f835..874aaa8 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
@@ -301,7 +301,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
if (null != token && null != tokenFile) {
throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
} else if (null != token) {
- out.writeUTF(token.getClass().getCanonicalName());
+ out.writeUTF(token.getClass().getName());
out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
} else {
out.writeUTF(tokenFile);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index ed4965d..1801b37 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -295,7 +295,7 @@ public class AccumuloInputFormatTest {
}
bw.close();
- Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getCanonicalName()}));
+ Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
@@ -367,7 +367,7 @@ public class AccumuloInputFormatTest {
Assert.assertEquals(
0,
MRTester.main(new String[] {user, "", "testtable", "testPartialInputSplitDelegationToConfiguration",
- EmptySplitsAccumuloInputFormat.class.getCanonicalName()}));
+ EmptySplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
@@ -392,7 +392,7 @@ public class AccumuloInputFormatTest {
Assert.assertEquals(
1,
MRTester.main(new String[] {user, "", "testtable", "testPartialFailedInputSplitDelegationToConfiguration",
- BadPasswordSplitsAccumuloInputFormat.class.getCanonicalName()}));
+ BadPasswordSplitsAccumuloInputFormat.class.getName()}));
assertNull(e1);
assertNull(e2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/967100dd/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
index c61b6f0..c4c6667 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/shell/ShellConfigTest.java
@@ -80,19 +80,19 @@ public class ShellConfigTest {
@Test
public void testTokenWithoutOptions() {
- assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName()));
- assertFalse(output.get().contains(ParameterException.class.getCanonicalName()));
+ assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getName()));
+ assertFalse(output.get().contains(ParameterException.class.getName()));
}
@Test
public void testTokenAndOption() {
- assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-u", "foo", "-l", "password=foo"));
+ assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo"));
}
@Test
public void testTokenAndOptionAndPassword() {
- assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-l", "password=foo", "-p", "bar"));
- assertTrue(output.get().contains(ParameterException.class.getCanonicalName()));
+ assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar"));
+ assertTrue(output.get().contains(ParameterException.class.getName()));
}
@Test