[4/6] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Conflicts: server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f6ba154f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f6ba154f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f6ba154f Branch: refs/heads/master Commit: f6ba154f2d919961b092e50c89f94efc7f7763be Parents: caef59e d5e26b5 Author: Christopher Tubbs ctubb...@apache.org Authored: Wed May 27 16:28:43 2015 -0400 Committer: Christopher Tubbs ctubb...@apache.org Committed: Wed May 27 16:28:43 2015 -0400 -- .../src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/f6ba154f/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java -- diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java index abf3d1a,000..6d5adce mode 100644,00..100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java @@@ -1,147 -1,0 +1,147 @@@ +/* + * 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.tserver.scan; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.RunnableFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.accumulo.tserver.TabletServer; + +public abstract class ScanTaskT implements RunnableFutureT { + + protected final TabletServer server; + protected AtomicBoolean interruptFlag; + protected ArrayBlockingQueueObject resultQueue; + protected AtomicInteger state; + protected AtomicReferenceScanRunState runState; + + private static final int INITIAL = 1; + private static final int ADDED = 2; + private static final int CANCELED = 3; + + ScanTask(TabletServer server) { +this.server = server; +interruptFlag = new AtomicBoolean(false); +runState = new AtomicReferenceScanRunState(ScanRunState.QUEUED); +state = new AtomicInteger(INITIAL); +resultQueue = new ArrayBlockingQueueObject(1); + } + + protected void addResult(Object o) { +if (state.compareAndSet(INITIAL, ADDED)) + resultQueue.add(o); +else if (state.get() == ADDED) + throw new IllegalStateException(Tried to add more than one result); + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { +if (!mayInterruptIfRunning) + throw new IllegalArgumentException(Cancel will always attempt to interupt running next batch task); + +if (state.get() == CANCELED) + return true; + +if (state.compareAndSet(INITIAL, CANCELED)) { + interruptFlag.set(true); + resultQueue = null; + return true; +} + +return false; + } + + @Override + public T get() throws InterruptedException, ExecutionException { +throw new UnsupportedOperationException(); + } + + @Override + public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + +ArrayBlockingQueueObject localRQ = resultQueue; + +if (isCancelled()) + throw new CancellationException(); + +if (localRQ == null) { + int st = state.get(); + String stateStr; + switch (st) { +case ADDED: + stateStr = ADDED; + break; +case CANCELED: + stateStr = CANCELED; + break; +case INITIAL: + stateStr = INITIAL; + break; +
[5/6] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Conflicts: server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f6ba154f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f6ba154f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f6ba154f Branch: refs/heads/1.7 Commit: f6ba154f2d919961b092e50c89f94efc7f7763be Parents: caef59e d5e26b5 Author: Christopher Tubbs ctubb...@apache.org Authored: Wed May 27 16:28:43 2015 -0400 Committer: Christopher Tubbs ctubb...@apache.org Committed: Wed May 27 16:28:43 2015 -0400 -- .../src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/f6ba154f/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java -- diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java index abf3d1a,000..6d5adce mode 100644,00..100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java @@@ -1,147 -1,0 +1,147 @@@ +/* + * 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.tserver.scan; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.RunnableFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.accumulo.tserver.TabletServer; + +public abstract class ScanTaskT implements RunnableFutureT { + + protected final TabletServer server; + protected AtomicBoolean interruptFlag; + protected ArrayBlockingQueueObject resultQueue; + protected AtomicInteger state; + protected AtomicReferenceScanRunState runState; + + private static final int INITIAL = 1; + private static final int ADDED = 2; + private static final int CANCELED = 3; + + ScanTask(TabletServer server) { +this.server = server; +interruptFlag = new AtomicBoolean(false); +runState = new AtomicReferenceScanRunState(ScanRunState.QUEUED); +state = new AtomicInteger(INITIAL); +resultQueue = new ArrayBlockingQueueObject(1); + } + + protected void addResult(Object o) { +if (state.compareAndSet(INITIAL, ADDED)) + resultQueue.add(o); +else if (state.get() == ADDED) + throw new IllegalStateException(Tried to add more than one result); + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { +if (!mayInterruptIfRunning) + throw new IllegalArgumentException(Cancel will always attempt to interupt running next batch task); + +if (state.get() == CANCELED) + return true; + +if (state.compareAndSet(INITIAL, CANCELED)) { + interruptFlag.set(true); + resultQueue = null; + return true; +} + +return false; + } + + @Override + public T get() throws InterruptedException, ExecutionException { +throw new UnsupportedOperationException(); + } + + @Override + public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + +ArrayBlockingQueueObject localRQ = resultQueue; + +if (isCancelled()) + throw new CancellationException(); + +if (localRQ == null) { + int st = state.get(); + String stateStr; + switch (st) { +case ADDED: + stateStr = ADDED; + break; +case CANCELED: + stateStr = CANCELED; + break; +case INITIAL: + stateStr = INITIAL; + break; +
[6/6] accumulo git commit: Merge branch '1.7'
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/535e2f35 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/535e2f35 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/535e2f35 Branch: refs/heads/master Commit: 535e2f357bfb80af5188bb6120cee66fd610b1b3 Parents: 650f1f9 f6ba154 Author: Christopher Tubbs ctubb...@apache.org Authored: Wed May 27 16:28:54 2015 -0400 Committer: Christopher Tubbs ctubb...@apache.org Committed: Wed May 27 16:28:54 2015 -0400 -- .../src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[1/6] accumulo git commit: ACCUMULO-3857 Fix possible null pointer dereference
Repository: accumulo Updated Branches: refs/heads/1.6 de2763e47 - d5e26b5dd refs/heads/1.7 caef59e4a - f6ba154f2 refs/heads/master 650f1f9fe - 535e2f357 ACCUMULO-3857 Fix possible null pointer dereference Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d5e26b5d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d5e26b5d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d5e26b5d Branch: refs/heads/1.6 Commit: d5e26b5dd7d7e4c7dcf332b27fc5149f833899c6 Parents: de2763e Author: Christopher Tubbs ctubb...@apache.org Authored: Wed May 27 15:56:33 2015 -0400 Committer: Christopher Tubbs ctubb...@apache.org Committed: Wed May 27 16:05:15 2015 -0400 -- .../apache/accumulo/tserver/TabletServer.java | 21 ++-- 1 file changed, 19 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d5e26b5d/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 4de42a7..c502166 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 @@ -771,8 +771,25 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu if (state.get() == CANCELED) throw new CancellationException(); - if (localRQ == null state.get() == ADDED) -throw new IllegalStateException(Tried to get result twice); + if (localRQ == null) { +int st = state.get(); +String stateStr; +switch (st) { + case ADDED: +stateStr = ADDED; +break; + case CANCELED: +stateStr = CANCELED; +break; + case INITIAL: +stateStr = INITIAL; +break; + default: +stateStr = UNKNOWN; +break; +} +throw new IllegalStateException(Tried to get result twice [state= + stateStr + ( + st + )]); + } Object r = localRQ.poll(timeout, unit);
[2/6] accumulo git commit: ACCUMULO-3857 Fix possible null pointer dereference
ACCUMULO-3857 Fix possible null pointer dereference Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d5e26b5d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d5e26b5d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d5e26b5d Branch: refs/heads/1.7 Commit: d5e26b5dd7d7e4c7dcf332b27fc5149f833899c6 Parents: de2763e Author: Christopher Tubbs ctubb...@apache.org Authored: Wed May 27 15:56:33 2015 -0400 Committer: Christopher Tubbs ctubb...@apache.org Committed: Wed May 27 16:05:15 2015 -0400 -- .../apache/accumulo/tserver/TabletServer.java | 21 ++-- 1 file changed, 19 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d5e26b5d/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 4de42a7..c502166 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 @@ -771,8 +771,25 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu if (state.get() == CANCELED) throw new CancellationException(); - if (localRQ == null state.get() == ADDED) -throw new IllegalStateException(Tried to get result twice); + if (localRQ == null) { +int st = state.get(); +String stateStr; +switch (st) { + case ADDED: +stateStr = ADDED; +break; + case CANCELED: +stateStr = CANCELED; +break; + case INITIAL: +stateStr = INITIAL; +break; + default: +stateStr = UNKNOWN; +break; +} +throw new IllegalStateException(Tried to get result twice [state= + stateStr + ( + st + )]); + } Object r = localRQ.poll(timeout, unit);
[07/17] accumulo git commit: Merge branch '1.5' into 1.6
Merge branch '1.5' 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/c9f33d09 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c9f33d09 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c9f33d09 Branch: refs/heads/1.7 Commit: c9f33d090ab887423714d673fb5e3e336274f33c Parents: de2763e 11f108e Author: Josh Elser els...@apache.org Authored: Wed May 27 16:20:08 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:20:08 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/pom.xml -- diff --cc proxy/pom.xml index 2bade1d,b75935a..ee106c7 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@@ -82,24 -90,16 +82,29 @@@ scopetest/scope /dependency dependency - groupIdorg.apache.zookeeper/groupId - artifactIdzookeeper/artifactId + groupIdorg.slf4j/groupId + artifactIdslf4j-log4j12/artifactId scopetest/scope /dependency + dependency + groupIdorg.easymock/groupId + artifactIdeasymock/artifactId + scopetest/scope + /dependency /dependencies + build +pluginManagement + plugins +plugin + groupIdorg.codehaus.mojo/groupId + artifactIdfindbugs-maven-plugin/artifactId + configuration + excludeFilterFilesrc/main/findbugs/exclude-filter.xml/excludeFilterFile + /configuration +/plugin + /plugins +/pluginManagement + /build profiles profile idthrift/id http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java --
[01/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush
Repository: accumulo Updated Branches: refs/heads/1.5 5db68dad3 - 11f108e25 refs/heads/1.6 d5e26b5dd - 0cf5b9ca0 refs/heads/1.7 f6ba154f2 - 7e5145a28 refs/heads/master 535e2f357 - b37ee94ba ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/11f108e2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/11f108e2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/11f108e2 Branch: refs/heads/1.5 Commit: 11f108e252f8358a3ac8b79843f1ebd77bee647e Parents: 5db68da Author: Josh Elser els...@apache.org Authored: Wed May 27 16:19:32 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:19:32 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/pom.xml -- diff --git a/proxy/pom.xml b/proxy/pom.xml index d66a329..b75935a 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -94,6 +94,11 @@ artifactIdzookeeper/artifactId scopetest/scope /dependency +dependency + groupIdorg.easymock/groupId + artifactIdeasymock/artifactId + scopetest/scope +/dependency /dependencies profiles profile http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java -- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index f873010..538fb03 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -1088,21 +1088,29 @@ public class ProxyServer implements AccumuloProxy.Iface { public void updateAndFlush(ByteBuffer login, String tableName, MapByteBuffer,ListColumnUpdate cells) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.MutationsRejectedException, TException { +BatchWriterPlusException bwpe = null; try { - BatchWriterPlusException bwpe = getWriter(login, tableName, null); + bwpe = getWriter(login, tableName, null); addCellsToWriter(cells, bwpe); if (bwpe.exception != null) throw bwpe.exception; bwpe.writer.flush(); - bwpe.writer.close(); } catch (Exception e) { handleExceptionMRE(e); +} finally { + if (null != bwpe) { +try { + bwpe.writer.close(); +} catch (MutationsRejectedException e) { + handleExceptionMRE(e); +} + } } } private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility(); - private void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { + void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { if (bwpe.exception != null) return; @@ -1217,7 +1225,7 @@ public class ProxyServer implements AccumuloProxy.Iface { return bwpe; } - private BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { + BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { BatchWriterConfig cfg = new BatchWriterConfig(); if (opts != null) { if (opts.maxMemory != 0) http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java -- diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java new file mode 100644 index 000..ed4f313 --- /dev/null +++ b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java @@ -0,0 +1,114 @@ +/* + * 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 + * + *
[03/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush
ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/11f108e2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/11f108e2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/11f108e2 Branch: refs/heads/1.7 Commit: 11f108e252f8358a3ac8b79843f1ebd77bee647e Parents: 5db68da Author: Josh Elser els...@apache.org Authored: Wed May 27 16:19:32 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:19:32 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/pom.xml -- diff --git a/proxy/pom.xml b/proxy/pom.xml index d66a329..b75935a 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -94,6 +94,11 @@ artifactIdzookeeper/artifactId scopetest/scope /dependency +dependency + groupIdorg.easymock/groupId + artifactIdeasymock/artifactId + scopetest/scope +/dependency /dependencies profiles profile http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java -- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index f873010..538fb03 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -1088,21 +1088,29 @@ public class ProxyServer implements AccumuloProxy.Iface { public void updateAndFlush(ByteBuffer login, String tableName, MapByteBuffer,ListColumnUpdate cells) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.MutationsRejectedException, TException { +BatchWriterPlusException bwpe = null; try { - BatchWriterPlusException bwpe = getWriter(login, tableName, null); + bwpe = getWriter(login, tableName, null); addCellsToWriter(cells, bwpe); if (bwpe.exception != null) throw bwpe.exception; bwpe.writer.flush(); - bwpe.writer.close(); } catch (Exception e) { handleExceptionMRE(e); +} finally { + if (null != bwpe) { +try { + bwpe.writer.close(); +} catch (MutationsRejectedException e) { + handleExceptionMRE(e); +} + } } } private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility(); - private void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { + void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { if (bwpe.exception != null) return; @@ -1217,7 +1225,7 @@ public class ProxyServer implements AccumuloProxy.Iface { return bwpe; } - private BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { + BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { BatchWriterConfig cfg = new BatchWriterConfig(); if (opts != null) { if (opts.maxMemory != 0) http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java -- diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java new file mode 100644 index 000..ed4f313 --- /dev/null +++ b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java @@ -0,0 +1,114 @@ +/* + * 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
[12/17] accumulo git commit: Merge branch '1.6' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6
Merge branch '1.6' of https://git-wip-us.apache.org/repos/asf/accumulo 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/0cf5b9ca Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0cf5b9ca Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0cf5b9ca Branch: refs/heads/1.6 Commit: 0cf5b9ca07d10c43a00889e4506c7acd6f311dd1 Parents: c9f33d0 d5e26b5 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:45:56 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:45:56 2015 -0400 -- .../apache/accumulo/tserver/TabletServer.java | 21 ++-- 1 file changed, 19 insertions(+), 2 deletions(-) --
[08/17] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Conflicts: proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6dab32ed Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6dab32ed Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6dab32ed Branch: refs/heads/master Commit: 6dab32ed2c2f5c901592d216a170578df5a3f2a4 Parents: caef59e c9f33d0 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:45:46 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:45:46 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/6dab32ed/proxy/pom.xml -- diff --cc proxy/pom.xml index 5da2763,ee106c7..1b3f122 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@@ -82,6 -77,11 +82,11 @@@ scopetest/scope /dependency dependency - groupIdorg.apache.accumulo/groupId - artifactIdaccumulo-test/artifactId ++ groupIdorg.easymock/groupId ++ artifactIdeasymock/artifactId + scopetest/scope + /dependency + dependency groupIdorg.slf4j/groupId artifactIdslf4j-log4j12/artifactId scopetest/scope http://git-wip-us.apache.org/repos/asf/accumulo/blob/6dab32ed/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java -- diff --cc proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index e2dabe5,abd225c..88dad8d --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@@ -1182,8 -1139,9 +1182,9 @@@ public class ProxyServer implements Acc public void updateAndFlush(ByteBuffer login, String tableName, MapByteBuffer,ListColumnUpdate cells) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.MutationsRejectedException, TException { -BatchWriterPlusException bwpe = null; ++BatchWriterPlusProblem bwpe = null; try { - BatchWriterPlusProblem bwpe = getWriter(login, tableName, null); + bwpe = getWriter(login, tableName, null); addCellsToWriter(cells, bwpe); if (bwpe.exception != null) throw bwpe.exception; @@@ -1196,7 -1161,7 +1204,7 @@@ private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility(); - private void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusProblem bwpe) { - void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { ++ void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusProblem bwpe) { if (bwpe.exception != null) return; @@@ -1320,7 -1285,7 +1328,7 @@@ return bwpe; } - private BatchWriterPlusProblem getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { - BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { ++ BatchWriterPlusProblem getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { BatchWriterConfig cfg = new BatchWriterConfig(); if (opts != null) { if (opts.maxMemory != 0) http://git-wip-us.apache.org/repos/asf/accumulo/blob/6dab32ed/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java -- diff --cc proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java index 000,ed4f313..24201e7 mode 00,100644..100644 --- a/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java +++ b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java @@@ -1,0 -1,114 +1,114 @@@ + /* + * 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
[06/17] accumulo git commit: Merge branch '1.5' into 1.6
Merge branch '1.5' 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/c9f33d09 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c9f33d09 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c9f33d09 Branch: refs/heads/master Commit: c9f33d090ab887423714d673fb5e3e336274f33c Parents: de2763e 11f108e Author: Josh Elser els...@apache.org Authored: Wed May 27 16:20:08 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:20:08 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/pom.xml -- diff --cc proxy/pom.xml index 2bade1d,b75935a..ee106c7 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@@ -82,24 -90,16 +82,29 @@@ scopetest/scope /dependency dependency - groupIdorg.apache.zookeeper/groupId - artifactIdzookeeper/artifactId + groupIdorg.slf4j/groupId + artifactIdslf4j-log4j12/artifactId scopetest/scope /dependency + dependency + groupIdorg.easymock/groupId + artifactIdeasymock/artifactId + scopetest/scope + /dependency /dependencies + build +pluginManagement + plugins +plugin + groupIdorg.codehaus.mojo/groupId + artifactIdfindbugs-maven-plugin/artifactId + configuration + excludeFilterFilesrc/main/findbugs/exclude-filter.xml/excludeFilterFile + /configuration +/plugin + /plugins +/pluginManagement + /build profiles profile idthrift/id http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java --
[04/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush
ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/11f108e2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/11f108e2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/11f108e2 Branch: refs/heads/master Commit: 11f108e252f8358a3ac8b79843f1ebd77bee647e Parents: 5db68da Author: Josh Elser els...@apache.org Authored: Wed May 27 16:19:32 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:19:32 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/pom.xml -- diff --git a/proxy/pom.xml b/proxy/pom.xml index d66a329..b75935a 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -94,6 +94,11 @@ artifactIdzookeeper/artifactId scopetest/scope /dependency +dependency + groupIdorg.easymock/groupId + artifactIdeasymock/artifactId + scopetest/scope +/dependency /dependencies profiles profile http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java -- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index f873010..538fb03 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -1088,21 +1088,29 @@ public class ProxyServer implements AccumuloProxy.Iface { public void updateAndFlush(ByteBuffer login, String tableName, MapByteBuffer,ListColumnUpdate cells) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.MutationsRejectedException, TException { +BatchWriterPlusException bwpe = null; try { - BatchWriterPlusException bwpe = getWriter(login, tableName, null); + bwpe = getWriter(login, tableName, null); addCellsToWriter(cells, bwpe); if (bwpe.exception != null) throw bwpe.exception; bwpe.writer.flush(); - bwpe.writer.close(); } catch (Exception e) { handleExceptionMRE(e); +} finally { + if (null != bwpe) { +try { + bwpe.writer.close(); +} catch (MutationsRejectedException e) { + handleExceptionMRE(e); +} + } } } private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility(); - private void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { + void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { if (bwpe.exception != null) return; @@ -1217,7 +1225,7 @@ public class ProxyServer implements AccumuloProxy.Iface { return bwpe; } - private BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { + BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { BatchWriterConfig cfg = new BatchWriterConfig(); if (opts != null) { if (opts.maxMemory != 0) http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java -- diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java new file mode 100644 index 000..ed4f313 --- /dev/null +++ b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java @@ -0,0 +1,114 @@ +/* + * 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
[16/17] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7e5145a2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7e5145a2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7e5145a2 Branch: refs/heads/master Commit: 7e5145a28b71b3dadb726da3b2e0ab83cac12277 Parents: faee4f8 0cf5b9c Author: Josh Elser els...@apache.org Authored: Wed May 27 16:46:19 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:46:19 2015 -0400 -- --
[11/17] accumulo git commit: Merge branch '1.6' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6
Merge branch '1.6' of https://git-wip-us.apache.org/repos/asf/accumulo 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/0cf5b9ca Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0cf5b9ca Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0cf5b9ca Branch: refs/heads/1.7 Commit: 0cf5b9ca07d10c43a00889e4506c7acd6f311dd1 Parents: c9f33d0 d5e26b5 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:45:56 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:45:56 2015 -0400 -- .../apache/accumulo/tserver/TabletServer.java | 21 ++-- 1 file changed, 19 insertions(+), 2 deletions(-) --
[10/17] accumulo git commit: Merge branch '1.6' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6
Merge branch '1.6' of https://git-wip-us.apache.org/repos/asf/accumulo 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/0cf5b9ca Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0cf5b9ca Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0cf5b9ca Branch: refs/heads/master Commit: 0cf5b9ca07d10c43a00889e4506c7acd6f311dd1 Parents: c9f33d0 d5e26b5 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:45:56 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:45:56 2015 -0400 -- .../apache/accumulo/tserver/TabletServer.java | 21 ++-- 1 file changed, 19 insertions(+), 2 deletions(-) --
[13/17] accumulo git commit: Merge branch '1.7' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.7
Merge branch '1.7' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.7 Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/faee4f8a Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/faee4f8a Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/faee4f8a Branch: refs/heads/1.7 Commit: faee4f8ac0fceb0baf2c98bcc76ff3ea9458df95 Parents: 6dab32e f6ba154 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:46:15 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:46:15 2015 -0400 -- .../src/main/java/org/apache/accumulo/tserver/scan/ScanTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[09/17] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Conflicts: proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6dab32ed Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6dab32ed Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6dab32ed Branch: refs/heads/1.7 Commit: 6dab32ed2c2f5c901592d216a170578df5a3f2a4 Parents: caef59e c9f33d0 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:45:46 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:45:46 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/6dab32ed/proxy/pom.xml -- diff --cc proxy/pom.xml index 5da2763,ee106c7..1b3f122 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@@ -82,6 -77,11 +82,11 @@@ scopetest/scope /dependency dependency - groupIdorg.apache.accumulo/groupId - artifactIdaccumulo-test/artifactId ++ groupIdorg.easymock/groupId ++ artifactIdeasymock/artifactId + scopetest/scope + /dependency + dependency groupIdorg.slf4j/groupId artifactIdslf4j-log4j12/artifactId scopetest/scope http://git-wip-us.apache.org/repos/asf/accumulo/blob/6dab32ed/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java -- diff --cc proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index e2dabe5,abd225c..88dad8d --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@@ -1182,8 -1139,9 +1182,9 @@@ public class ProxyServer implements Acc public void updateAndFlush(ByteBuffer login, String tableName, MapByteBuffer,ListColumnUpdate cells) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.MutationsRejectedException, TException { -BatchWriterPlusException bwpe = null; ++BatchWriterPlusProblem bwpe = null; try { - BatchWriterPlusProblem bwpe = getWriter(login, tableName, null); + bwpe = getWriter(login, tableName, null); addCellsToWriter(cells, bwpe); if (bwpe.exception != null) throw bwpe.exception; @@@ -1196,7 -1161,7 +1204,7 @@@ private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility(); - private void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusProblem bwpe) { - void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { ++ void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusProblem bwpe) { if (bwpe.exception != null) return; @@@ -1320,7 -1285,7 +1328,7 @@@ return bwpe; } - private BatchWriterPlusProblem getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { - BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { ++ BatchWriterPlusProblem getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { BatchWriterConfig cfg = new BatchWriterConfig(); if (opts != null) { if (opts.maxMemory != 0) http://git-wip-us.apache.org/repos/asf/accumulo/blob/6dab32ed/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java -- diff --cc proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java index 000,ed4f313..24201e7 mode 00,100644..100644 --- a/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java +++ b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java @@@ -1,0 -1,114 +1,114 @@@ + /* + * 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
[02/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush
ACCUMULO-3856 Ensure batchwriter gets closed in updateAndFlush Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/11f108e2 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/11f108e2 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/11f108e2 Branch: refs/heads/1.6 Commit: 11f108e252f8358a3ac8b79843f1ebd77bee647e Parents: 5db68da Author: Josh Elser els...@apache.org Authored: Wed May 27 16:19:32 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:19:32 2015 -0400 -- proxy/pom.xml | 5 + .../org/apache/accumulo/proxy/ProxyServer.java | 16 ++- .../apache/accumulo/proxy/ProxyServerTest.java | 114 +++ 3 files changed, 131 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/pom.xml -- diff --git a/proxy/pom.xml b/proxy/pom.xml index d66a329..b75935a 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -94,6 +94,11 @@ artifactIdzookeeper/artifactId scopetest/scope /dependency +dependency + groupIdorg.easymock/groupId + artifactIdeasymock/artifactId + scopetest/scope +/dependency /dependencies profiles profile http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java -- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index f873010..538fb03 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -1088,21 +1088,29 @@ public class ProxyServer implements AccumuloProxy.Iface { public void updateAndFlush(ByteBuffer login, String tableName, MapByteBuffer,ListColumnUpdate cells) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableNotFoundException, org.apache.accumulo.proxy.thrift.MutationsRejectedException, TException { +BatchWriterPlusException bwpe = null; try { - BatchWriterPlusException bwpe = getWriter(login, tableName, null); + bwpe = getWriter(login, tableName, null); addCellsToWriter(cells, bwpe); if (bwpe.exception != null) throw bwpe.exception; bwpe.writer.flush(); - bwpe.writer.close(); } catch (Exception e) { handleExceptionMRE(e); +} finally { + if (null != bwpe) { +try { + bwpe.writer.close(); +} catch (MutationsRejectedException e) { + handleExceptionMRE(e); +} + } } } private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility(); - private void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { + void addCellsToWriter(MapByteBuffer,ListColumnUpdate cells, BatchWriterPlusException bwpe) { if (bwpe.exception != null) return; @@ -1217,7 +1225,7 @@ public class ProxyServer implements AccumuloProxy.Iface { return bwpe; } - private BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { + BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception { BatchWriterConfig cfg = new BatchWriterConfig(); if (opts != null) { if (opts.maxMemory != 0) http://git-wip-us.apache.org/repos/asf/accumulo/blob/11f108e2/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java -- diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java new file mode 100644 index 000..ed4f313 --- /dev/null +++ b/proxy/src/test/java/org/apache/accumulo/proxy/ProxyServerTest.java @@ -0,0 +1,114 @@ +/* + * 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
[2/5] accumulo git commit: ACCUMULO-3853 Addendum -- update queueSize in ZTC and do all updates while holding lock.
ACCUMULO-3853 Addendum -- update queueSize in ZTC and do all updates while holding lock. Missed an area where the sendQueue was modified in another class. Also fixed all invocations to only update the size when the lock is held just to be sure the changes to the queue and size are made in tandem. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b477dbcd Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b477dbcd Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b477dbcd Branch: refs/heads/1.7 Commit: b477dbcdb6fb9f2ae34b31a47d6e105097f2e873 Parents: 7e5145a Author: Josh Elser els...@apache.org Authored: Wed May 27 16:25:15 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:49:17 2015 -0400 -- .../main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java | 4 ++-- .../src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b477dbcd/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java -- diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java index d3a2fc5..28a9088 100644 --- a/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java +++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java @@ -113,8 +113,8 @@ public abstract class AsyncSpanReceiverSpanKey,Destination implements SpanRece synchronized (sendQueue) { sendQueue.remove(); sendQueue.notifyAll(); + sendQueueSize.decrementAndGet(); } -sendQueueSize.decrementAndGet(); continue; } SpanKey dest = getSpanKey(s.data); @@ -132,8 +132,8 @@ public abstract class AsyncSpanReceiverSpanKey,Destination implements SpanRece synchronized (sendQueue) { sendQueue.remove(); sendQueue.notifyAll(); +sendQueueSize.decrementAndGet(); } - sendQueueSize.decrementAndGet(); sent = true; } catch (Exception ex) { log.warn(Got error sending to + dest + , refreshing client, ex); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b477dbcd/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java -- diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java index 3cfc5bc..aa5a9ee 100644 --- a/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java +++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java @@ -133,6 +133,7 @@ public class ZooTraceClient extends SendSpansViaThrift implements Watcher { synchronized (sendQueue) { sendQueue.clear(); sendQueue.notifyAll(); + sendQueueSize.set(0); } } } else {
[5/5] accumulo git commit: Merge branch '1.7'
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/d1cb76a4 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d1cb76a4 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d1cb76a4 Branch: refs/heads/master Commit: d1cb76a488a7083b287c6954f35426d39c7d4312 Parents: b37ee94 7bd6634 Author: Josh Elser els...@apache.org Authored: Wed May 27 16:54:36 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:54:36 2015 -0400 -- .../accumulo/tracer/AsyncSpanReceiver.java | 4 +-- .../apache/accumulo/tracer/ZooTraceClient.java | 1 + .../accumulo/test/proxy/SimpleProxyBase.java| 32 ++-- 3 files changed, 26 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d1cb76a4/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java -- diff --cc test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java index 6828c40,000..e4bb836 mode 100644,00..100644 --- a/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java @@@ -1,1906 -1,0 +1,1920 @@@ +/* + * 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.test.proxy; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeMap; +import java.util.UUID; + +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.accumulo.core.conf.DefaultConfiguration; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.file.FileOperations; +import org.apache.accumulo.core.file.FileSKVWriter; +import org.apache.accumulo.core.iterators.DevNull; +import org.apache.accumulo.core.iterators.SortedKeyValueIterator; +import org.apache.accumulo.core.iterators.user.SummingCombiner; +import org.apache.accumulo.core.iterators.user.VersioningIterator; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.util.ByteBufferUtil; +import org.apache.accumulo.core.util.UtilWaitThread; +import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint; +import org.apache.accumulo.harness.SharedMiniClusterIT; +import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; +import org.apache.accumulo.proxy.Proxy; +import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; +import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; +import org.apache.accumulo.proxy.thrift.ActiveCompaction; +import org.apache.accumulo.proxy.thrift.ActiveScan; +import org.apache.accumulo.proxy.thrift.BatchScanOptions; +import org.apache.accumulo.proxy.thrift.Column; +import org.apache.accumulo.proxy.thrift.ColumnUpdate; +import org.apache.accumulo.proxy.thrift.CompactionReason; +import org.apache.accumulo.proxy.thrift.CompactionStrategyConfig; +import org.apache.accumulo.proxy.thrift.CompactionType; +import org.apache.accumulo.proxy.thrift.Condition; +import org.apache.accumulo.proxy.thrift.ConditionalStatus; +import
[4/5] accumulo git commit: ACCUMULO-3853 Addendum -- update queueSize in ZTC and do all updates while holding lock.
ACCUMULO-3853 Addendum -- update queueSize in ZTC and do all updates while holding lock. Missed an area where the sendQueue was modified in another class. Also fixed all invocations to only update the size when the lock is held just to be sure the changes to the queue and size are made in tandem. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b477dbcd Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b477dbcd Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b477dbcd Branch: refs/heads/master Commit: b477dbcdb6fb9f2ae34b31a47d6e105097f2e873 Parents: 7e5145a Author: Josh Elser els...@apache.org Authored: Wed May 27 16:25:15 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:49:17 2015 -0400 -- .../main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java | 4 ++-- .../src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b477dbcd/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java -- diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java index d3a2fc5..28a9088 100644 --- a/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java +++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/AsyncSpanReceiver.java @@ -113,8 +113,8 @@ public abstract class AsyncSpanReceiverSpanKey,Destination implements SpanRece synchronized (sendQueue) { sendQueue.remove(); sendQueue.notifyAll(); + sendQueueSize.decrementAndGet(); } -sendQueueSize.decrementAndGet(); continue; } SpanKey dest = getSpanKey(s.data); @@ -132,8 +132,8 @@ public abstract class AsyncSpanReceiverSpanKey,Destination implements SpanRece synchronized (sendQueue) { sendQueue.remove(); sendQueue.notifyAll(); +sendQueueSize.decrementAndGet(); } - sendQueueSize.decrementAndGet(); sent = true; } catch (Exception ex) { log.warn(Got error sending to + dest + , refreshing client, ex); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b477dbcd/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java -- diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java index 3cfc5bc..aa5a9ee 100644 --- a/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java +++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/ZooTraceClient.java @@ -133,6 +133,7 @@ public class ZooTraceClient extends SendSpansViaThrift implements Watcher { synchronized (sendQueue) { sendQueue.clear(); sendQueue.notifyAll(); + sendQueueSize.set(0); } } } else {
[1/5] accumulo git commit: ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests
Repository: accumulo Updated Branches: refs/heads/1.7 7e5145a28 - 7bd66343a refs/heads/master b37ee94ba - d1cb76a48 ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7bd66343 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7bd66343 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7bd66343 Branch: refs/heads/1.7 Commit: 7bd66343a4d56d9199ad02727359476394f8f3b0 Parents: b477dbc Author: Josh Elser els...@apache.org Authored: Wed May 27 16:44:38 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:49:17 2015 -0400 -- .../apache/accumulo/proxy/SimpleProxyBase.java | 32 ++-- 1 file changed, 23 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bd66343/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java -- diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java index efdc4f1..1e071df 100644 --- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java @@ -1122,7 +1122,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { } boolean success = false; -for (int i = 0; i 5; i++) { +for (int i = 0; i 15; i++) { String batchWriter = client.createWriter(creds, table, writerOptions); client.update(batchWriter, mutation(row1, cf, cq, x)); client.update(batchWriter, mutation(row1, cf, cq, x)); @@ -1165,7 +1165,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { writerOptions.setTimeoutMs(10); success = false; -for (int i = 0; i 5; i++) { +for (int i = 0; i 15; i++) { try { String batchWriter = client.createWriter(creds, table, writerOptions); @@ -1658,15 +1658,29 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { assertScan(new String[][] { {00345, data, img, 1234567890}, {00345, meta, seq, 3}, {00346, meta, seq, 1}, {00347, data, count, 1}, {00347, data, img, 1234567890}}, table); -// test a mutation that violated a constraint -updates.clear(); -updates.put(s2bb(00347), -new ConditionalUpdates(Arrays.asList(newCondition(data, img, 1234567890)), Arrays.asList(newColUpdate(data, count, A; +ConditionalStatus status = null; +for (int i = 0; i 20; i++) { + // test a mutation that violated a constraint + updates.clear(); + updates.put(s2bb(00347), + new ConditionalUpdates(Arrays.asList(newCondition(data, img, 1234567890)), Arrays.asList(newColUpdate(data, count, A; -results = client.updateRowsConditionally(cwid, updates); + results = client.updateRowsConditionally(cwid, updates); -assertEquals(1, results.size()); -assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb(00347))); + assertEquals(1, results.size()); + status = results.get(s2bb(00347)); + if (ConditionalStatus.VIOLATED != status) { +log.info(ConditionalUpdate was not rejected by server due to table constraint. Sleeping and retrying); +Thread.sleep(3000); +continue; + } + + assertEquals(ConditionalStatus.VIOLATED, status); + break; +} + +// Final check to make sure we succeeded and didn't exceed the retries +assertEquals(ConditionalStatus.VIOLATED, status); assertScan(new String[][] { {00345, data, img, 1234567890}, {00345, meta, seq, 3}, {00346, meta, seq, 1}, {00347, data, count, 1}, {00347, data, img, 1234567890}}, table);
[3/5] accumulo git commit: ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests
ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7bd66343 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7bd66343 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7bd66343 Branch: refs/heads/master Commit: 7bd66343a4d56d9199ad02727359476394f8f3b0 Parents: b477dbc Author: Josh Elser els...@apache.org Authored: Wed May 27 16:44:38 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 16:49:17 2015 -0400 -- .../apache/accumulo/proxy/SimpleProxyBase.java | 32 ++-- 1 file changed, 23 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bd66343/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java -- diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java index efdc4f1..1e071df 100644 --- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java @@ -1122,7 +1122,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { } boolean success = false; -for (int i = 0; i 5; i++) { +for (int i = 0; i 15; i++) { String batchWriter = client.createWriter(creds, table, writerOptions); client.update(batchWriter, mutation(row1, cf, cq, x)); client.update(batchWriter, mutation(row1, cf, cq, x)); @@ -1165,7 +1165,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { writerOptions.setTimeoutMs(10); success = false; -for (int i = 0; i 5; i++) { +for (int i = 0; i 15; i++) { try { String batchWriter = client.createWriter(creds, table, writerOptions); @@ -1658,15 +1658,29 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { assertScan(new String[][] { {00345, data, img, 1234567890}, {00345, meta, seq, 3}, {00346, meta, seq, 1}, {00347, data, count, 1}, {00347, data, img, 1234567890}}, table); -// test a mutation that violated a constraint -updates.clear(); -updates.put(s2bb(00347), -new ConditionalUpdates(Arrays.asList(newCondition(data, img, 1234567890)), Arrays.asList(newColUpdate(data, count, A; +ConditionalStatus status = null; +for (int i = 0; i 20; i++) { + // test a mutation that violated a constraint + updates.clear(); + updates.put(s2bb(00347), + new ConditionalUpdates(Arrays.asList(newCondition(data, img, 1234567890)), Arrays.asList(newColUpdate(data, count, A; -results = client.updateRowsConditionally(cwid, updates); + results = client.updateRowsConditionally(cwid, updates); -assertEquals(1, results.size()); -assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb(00347))); + assertEquals(1, results.size()); + status = results.get(s2bb(00347)); + if (ConditionalStatus.VIOLATED != status) { +log.info(ConditionalUpdate was not rejected by server due to table constraint. Sleeping and retrying); +Thread.sleep(3000); +continue; + } + + assertEquals(ConditionalStatus.VIOLATED, status); + break; +} + +// Final check to make sure we succeeded and didn't exceed the retries +assertEquals(ConditionalStatus.VIOLATED, status); assertScan(new String[][] { {00345, data, img, 1234567890}, {00345, meta, seq, 3}, {00346, meta, seq, 1}, {00347, data, count, 1}, {00347, data, img, 1234567890}}, table);
[6/6] accumulo git commit: Merge branch '1.7'
Merge branch '1.7' Conflicts: test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ae2255c8 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ae2255c8 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ae2255c8 Branch: refs/heads/master Commit: ae2255c875176e5072bc6338bc5c0092b79894cd Parents: d1cb76a 98fbe4f Author: Josh Elser els...@apache.org Authored: Wed May 27 22:03:13 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 22:03:13 2015 -0400 -- .../apache/accumulo/tserver/tablet/Tablet.java | 1 + .../test/functional/WatchTheWatchCountIT.java | 47 +++- .../accumulo/test/proxy/SimpleProxyBase.java| 58 +--- .../accumulo/test/proxy/TestProxyClient.java| 7 +++ 4 files changed, 91 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/ae2255c8/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/ae2255c8/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java -- diff --cc test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java index e4bb836,000..8344156 mode 100644,00..100644 --- a/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java @@@ -1,1920 -1,0 +1,1962 @@@ +/* + * 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.test.proxy; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeMap; +import java.util.UUID; + +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.accumulo.core.conf.DefaultConfiguration; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.file.FileOperations; +import org.apache.accumulo.core.file.FileSKVWriter; +import org.apache.accumulo.core.iterators.DevNull; +import org.apache.accumulo.core.iterators.SortedKeyValueIterator; +import org.apache.accumulo.core.iterators.user.SummingCombiner; +import org.apache.accumulo.core.iterators.user.VersioningIterator; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.util.ByteBufferUtil; +import org.apache.accumulo.core.util.UtilWaitThread; +import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint; +import org.apache.accumulo.harness.SharedMiniClusterIT; +import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; +import org.apache.accumulo.proxy.Proxy; +import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; +import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; +import org.apache.accumulo.proxy.thrift.ActiveCompaction; +import org.apache.accumulo.proxy.thrift.ActiveScan; +import org.apache.accumulo.proxy.thrift.BatchScanOptions; +import
[1/6] accumulo git commit: ACCUMULO-3828 Further stabilization and debug for Proxy ITs
Repository: accumulo Updated Branches: refs/heads/1.7 7bd66343a - 98fbe4f14 refs/heads/master d1cb76a48 - ae2255c87 ACCUMULO-3828 Further stabilization and debug for Proxy ITs Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/bd759af0 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/bd759af0 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/bd759af0 Branch: refs/heads/1.7 Commit: bd759af0efbe7302afcc81ab755cd5e443183137 Parents: 7bd6634 Author: Josh Elser els...@apache.org Authored: Wed May 27 18:25:48 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 20:22:59 2015 -0400 -- .../apache/accumulo/proxy/TestProxyClient.java | 7 +++ .../apache/accumulo/tserver/tablet/Tablet.java | 1 + .../apache/accumulo/proxy/SimpleProxyBase.java | 58 +--- 3 files changed, 58 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd759af0/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java -- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java b/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java index 99ebb38..fb23484 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java @@ -59,6 +59,13 @@ public class TestProxyClient { transport.open(); } + public synchronized void close() { +if (null != transport) { + transport.close(); + transport = null; +} + } + public AccumuloProxy.Client proxy() { return proxy; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd759af0/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java -- diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java index 1f4625b..a75b35d 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java @@ -533,6 +533,7 @@ public class Tablet implements TabletCommitter { tableConfiguration.addObserver(configObserver = new ConfigurationObserver() { private void reloadConstraints() { +log.debug(Reloading constraints for extent: + extent); constraintChecker.set(new ConstraintChecker(tableConfiguration)); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd759af0/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java -- diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java index 1e071df..8895e9e 100644 --- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java @@ -130,7 +130,9 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { private static final long ZOOKEEPER_PROPAGATION_TIME = 10 * 1000; private static TServer proxyServer; private static int proxyPort; - private static org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client; + + private TestProxyClient proxyClient; + private org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client; private static MapString,String properties = new HashMap(); private static ByteBuffer creds = null; @@ -168,8 +170,6 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { proxyServer = Proxy.createProxyServer(HostAndPort.fromParts(localhost, proxyPort), factory, props).server; while (!proxyServer.isServing()) UtilWaitThread.sleep(100); -client = new TestProxyClient(localhost, proxyPort, factory).proxy(); -creds = client.login(root, properties); } @AfterClass @@ -185,6 +185,11 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { @Before public void setup() throws Exception { +// Create a new client for each test +proxyClient = new TestProxyClient(localhost, proxyPort, factory); +client = proxyClient.proxy(); +creds = client.login(root, properties); + // Create 'user' client.createLocalUser(creds, user, s2bb(SharedMiniClusterIT.getRootPassword())); // Log in as 'user' @@ -208,6 +213,11 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { log.warn(Failed to delete test table, e); } } + +// Close the transport after the test +if (null != proxyClient) { +
[5/6] accumulo git commit: Merge branch '1.7'
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ae2255c8/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java -- diff --cc test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java index 8d3863b,000..5529d37 mode 100644,00..100644 --- a/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java +++ b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java @@@ -1,176 -1,0 +1,183 @@@ +/* + * 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.test.proxy; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.nio.ByteBuffer; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.apache.accumulo.core.client.IteratorSetting; +import org.apache.accumulo.core.iterators.user.RegExFilter; +import org.apache.accumulo.proxy.Util; +import org.apache.accumulo.proxy.thrift.AccumuloProxy; +import org.apache.accumulo.proxy.thrift.ColumnUpdate; +import org.apache.accumulo.proxy.thrift.Key; +import org.apache.accumulo.proxy.thrift.ScanResult; +import org.apache.accumulo.proxy.thrift.TimeType; +import org.apache.thrift.protocol.TCompactProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; + +public class TestProxyClient { + + protected AccumuloProxy.Client proxy; + protected TTransport transport; + + public TestProxyClient(String host, int port) throws TTransportException { +this(host, port, new TCompactProtocol.Factory()); + } + + public TestProxyClient(String host, int port, TProtocolFactory protoFactory) throws TTransportException { +final TSocket socket = new TSocket(host, port); +socket.setTimeout(60); +transport = new TFramedTransport(socket); +final TProtocol protocol = protoFactory.getProtocol(transport); +proxy = new AccumuloProxy.Client(protocol); +transport.open(); + } + ++ public synchronized void close() { ++if (null != transport) { ++ transport.close(); ++ transport = null; ++} ++ } ++ + public AccumuloProxy.Client proxy() { +return proxy; + } + + public static void main(String[] args) throws Exception { + +TestProxyClient tpc = new TestProxyClient(localhost, 42424); +String principal = root; +MapString,String props = new TreeMapString,String(); +props.put(password, secret); + +System.out.println(Logging in); +ByteBuffer login = tpc.proxy.login(principal, props); + +System.out.println(Creating user: ); +if (!tpc.proxy().listLocalUsers(login).contains(testuser)) { + tpc.proxy().createLocalUser(login, testuser, ByteBuffer.wrap(testpass.getBytes(UTF_8))); +} +System.out.println(UserList: + tpc.proxy().listLocalUsers(login)); + +System.out.println(Listing: + tpc.proxy().listTables(login)); + +System.out.println(Deleting: ); +String testTable = testtableOMGOMGOMG; + +System.out.println(Creating: ); + +if (tpc.proxy().tableExists(login, testTable)) + tpc.proxy().deleteTable(login, testTable); + +tpc.proxy().createTable(login, testTable, true, TimeType.MILLIS); + +System.out.println(Listing: + tpc.proxy().listTables(login)); + +System.out.println(Writing: ); +Date start = new Date(); +Date then = new Date(); +int maxInserts = 100; +String format = %1$05d; +MapByteBuffer,ListColumnUpdate mutations = new HashMapByteBuffer,ListColumnUpdate(); +for (int i = 0; i maxInserts; i++) { + String result = String.format(format, i); + ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap((cf + i).getBytes(UTF_8)), ByteBuffer.wrap((cq + i).getBytes(UTF_8))); + update.setValue(Util.randStringBuffer(10)); +
[2/6] accumulo git commit: ACCUMULO-3828 Further stabilization and debug for Proxy ITs
ACCUMULO-3828 Further stabilization and debug for Proxy ITs Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/bd759af0 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/bd759af0 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/bd759af0 Branch: refs/heads/master Commit: bd759af0efbe7302afcc81ab755cd5e443183137 Parents: 7bd6634 Author: Josh Elser els...@apache.org Authored: Wed May 27 18:25:48 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 20:22:59 2015 -0400 -- .../apache/accumulo/proxy/TestProxyClient.java | 7 +++ .../apache/accumulo/tserver/tablet/Tablet.java | 1 + .../apache/accumulo/proxy/SimpleProxyBase.java | 58 +--- 3 files changed, 58 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd759af0/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java -- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java b/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java index 99ebb38..fb23484 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java @@ -59,6 +59,13 @@ public class TestProxyClient { transport.open(); } + public synchronized void close() { +if (null != transport) { + transport.close(); + transport = null; +} + } + public AccumuloProxy.Client proxy() { return proxy; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd759af0/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java -- diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java index 1f4625b..a75b35d 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java @@ -533,6 +533,7 @@ public class Tablet implements TabletCommitter { tableConfiguration.addObserver(configObserver = new ConfigurationObserver() { private void reloadConstraints() { +log.debug(Reloading constraints for extent: + extent); constraintChecker.set(new ConstraintChecker(tableConfiguration)); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/bd759af0/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java -- diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java index 1e071df..8895e9e 100644 --- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java @@ -130,7 +130,9 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { private static final long ZOOKEEPER_PROPAGATION_TIME = 10 * 1000; private static TServer proxyServer; private static int proxyPort; - private static org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client; + + private TestProxyClient proxyClient; + private org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client; private static MapString,String properties = new HashMap(); private static ByteBuffer creds = null; @@ -168,8 +170,6 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { proxyServer = Proxy.createProxyServer(HostAndPort.fromParts(localhost, proxyPort), factory, props).server; while (!proxyServer.isServing()) UtilWaitThread.sleep(100); -client = new TestProxyClient(localhost, proxyPort, factory).proxy(); -creds = client.login(root, properties); } @AfterClass @@ -185,6 +185,11 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { @Before public void setup() throws Exception { +// Create a new client for each test +proxyClient = new TestProxyClient(localhost, proxyPort, factory); +client = proxyClient.proxy(); +creds = client.login(root, properties); + // Create 'user' client.createLocalUser(creds, user, s2bb(SharedMiniClusterIT.getRootPassword())); // Log in as 'user' @@ -208,6 +213,11 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { log.warn(Failed to delete test table, e); } } + +// Close the transport after the test +if (null != proxyClient) { + proxyClient.close(); +} } /* @@ -1119,6 +1129,7 @@ public abstract class SimpleProxyBase extends
[3/6] accumulo git commit: ACCUMULO-3858 Attempt to stabilize WatchTheWatchCountIT
ACCUMULO-3858 Attempt to stabilize WatchTheWatchCountIT Add some repeated attempts and expand the range to encompass values I have seen running the test many times. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/98fbe4f1 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/98fbe4f1 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/98fbe4f1 Branch: refs/heads/master Commit: 98fbe4f14ce51032504989af439e12bc95884626 Parents: bd759af Author: Josh Elser els...@apache.org Authored: Wed May 27 19:14:51 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 21:18:54 2015 -0400 -- .../test/functional/WatchTheWatchCountIT.java | 47 ++-- 1 file changed, 33 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/98fbe4f1/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java b/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java index 3b1dd2f..fff5b16 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java @@ -24,38 +24,57 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.google.common.collect.Range; import com.google.common.net.HostAndPort; // ACCUMULO-2757 - make sure we don't make too many more watchers public class WatchTheWatchCountIT extends ConfigurableMacIT { + private static final Logger log = LoggerFactory.getLogger(WatchTheWatchCountIT.class); + + public int defaultOverrideSeconds() { +return 60; + } @Override public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { cfg.setNumTservers(3); } - @Test(timeout = 30 * 1000) + @Test public void test() throws Exception { Connector c = getConnector(); -for (String tableName : this.getUniqueNames(3)) { +String[] tableNames = getUniqueNames(3); +for (String tableName : tableNames) { c.tableOperations().create(tableName); } c.tableOperations().list(); String zooKeepers = c.getInstance().getZooKeepers(); -HostAndPort hostAndPort = HostAndPort.fromString(zooKeepers); -Socket socket = new Socket(hostAndPort.getHostText(), hostAndPort.getPort()); -try { - socket.getOutputStream().write(wchs\n.getBytes(), 0, 5); - byte[] buffer = new byte[1024]; - int n = socket.getInputStream().read(buffer); - String response = new String(buffer, 0, n); - long total = Long.parseLong(response.split(:)[1].trim()); - assertTrue(Total watches was not greater than 500, but was + total, total 500); - assertTrue(Total watches was not less than 650, but was + total, total 600); -} finally { - socket.close(); +final RangeLong expectedWatcherRange = Range.open(475l, 700l); +long total = 0; +final HostAndPort hostAndPort = HostAndPort.fromString(zooKeepers); +for (int i = 0; i 5; i++) { + Socket socket = new Socket(hostAndPort.getHostText(), hostAndPort.getPort()); + try { +socket.getOutputStream().write(wchs\n.getBytes(), 0, 5); +byte[] buffer = new byte[1024]; +int n = socket.getInputStream().read(buffer); +String response = new String(buffer, 0, n); +total = Long.parseLong(response.split(:)[1].trim()); +log.info(Total: {}, total); +if (expectedWatcherRange.contains(total)) { + break; +} +log.debug(Expected number of watchers to be contained in {}, but actually was {}. Sleeping and retrying, expectedWatcherRange, total); +Thread.sleep(5000); + } finally { +socket.close(); + } } + +assertTrue(Expected number of watchers to be contained in + expectedWatcherRange + , but actually was + total, expectedWatcherRange.contains(total)); } }
[4/6] accumulo git commit: ACCUMULO-3858 Attempt to stabilize WatchTheWatchCountIT
ACCUMULO-3858 Attempt to stabilize WatchTheWatchCountIT Add some repeated attempts and expand the range to encompass values I have seen running the test many times. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/98fbe4f1 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/98fbe4f1 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/98fbe4f1 Branch: refs/heads/1.7 Commit: 98fbe4f14ce51032504989af439e12bc95884626 Parents: bd759af Author: Josh Elser els...@apache.org Authored: Wed May 27 19:14:51 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 21:18:54 2015 -0400 -- .../test/functional/WatchTheWatchCountIT.java | 47 ++-- 1 file changed, 33 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/98fbe4f1/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java b/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java index 3b1dd2f..fff5b16 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/WatchTheWatchCountIT.java @@ -24,38 +24,57 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.google.common.collect.Range; import com.google.common.net.HostAndPort; // ACCUMULO-2757 - make sure we don't make too many more watchers public class WatchTheWatchCountIT extends ConfigurableMacIT { + private static final Logger log = LoggerFactory.getLogger(WatchTheWatchCountIT.class); + + public int defaultOverrideSeconds() { +return 60; + } @Override public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { cfg.setNumTservers(3); } - @Test(timeout = 30 * 1000) + @Test public void test() throws Exception { Connector c = getConnector(); -for (String tableName : this.getUniqueNames(3)) { +String[] tableNames = getUniqueNames(3); +for (String tableName : tableNames) { c.tableOperations().create(tableName); } c.tableOperations().list(); String zooKeepers = c.getInstance().getZooKeepers(); -HostAndPort hostAndPort = HostAndPort.fromString(zooKeepers); -Socket socket = new Socket(hostAndPort.getHostText(), hostAndPort.getPort()); -try { - socket.getOutputStream().write(wchs\n.getBytes(), 0, 5); - byte[] buffer = new byte[1024]; - int n = socket.getInputStream().read(buffer); - String response = new String(buffer, 0, n); - long total = Long.parseLong(response.split(:)[1].trim()); - assertTrue(Total watches was not greater than 500, but was + total, total 500); - assertTrue(Total watches was not less than 650, but was + total, total 600); -} finally { - socket.close(); +final RangeLong expectedWatcherRange = Range.open(475l, 700l); +long total = 0; +final HostAndPort hostAndPort = HostAndPort.fromString(zooKeepers); +for (int i = 0; i 5; i++) { + Socket socket = new Socket(hostAndPort.getHostText(), hostAndPort.getPort()); + try { +socket.getOutputStream().write(wchs\n.getBytes(), 0, 5); +byte[] buffer = new byte[1024]; +int n = socket.getInputStream().read(buffer); +String response = new String(buffer, 0, n); +total = Long.parseLong(response.split(:)[1].trim()); +log.info(Total: {}, total); +if (expectedWatcherRange.contains(total)) { + break; +} +log.debug(Expected number of watchers to be contained in {}, but actually was {}. Sleeping and retrying, expectedWatcherRange, total); +Thread.sleep(5000); + } finally { +socket.close(); + } } + +assertTrue(Expected number of watchers to be contained in + expectedWatcherRange + , but actually was + total, expectedWatcherRange.contains(total)); } }
[2/3] accumulo git commit: ACCUMULO-3861 durability=none might still see all results.
ACCUMULO-3861 durability=none might still see all results. It's extremely unlikely, but it apparently is possible since it failed for me in that way (best I can tell). Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f9a29c77 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f9a29c77 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f9a29c77 Branch: refs/heads/master Commit: f9a29c77d28e5f2de218741c07fdec4ad49228fb Parents: 98fbe4f Author: Josh Elser els...@apache.org Authored: Wed May 27 22:52:28 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 22:52:28 2015 -0400 -- .../org/apache/accumulo/test/functional/DurabilityIT.java | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/f9a29c77/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java index aa280dc..9a262a1 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java @@ -130,7 +130,8 @@ public class DurabilityIT extends ConfigurableMacIT { // we're probably going to lose something the the log setting writeSome(tableNames[2], N); restartTServer(); -assertTrue(N = readSome(tableNames[2])); +long numResults = readSome(tableNames[2]); +assertTrue(Expected + N + = + numResults, N = numResults); cleanup(tableNames); } @@ -140,7 +141,8 @@ public class DurabilityIT extends ConfigurableMacIT { // probably won't get any data back without logging writeSome(tableNames[3], N); restartTServer(); -assertTrue(N readSome(tableNames[3])); +long numResults = readSome(tableNames[3]); +assertTrue(Expected + N + = + numResults, N = numResults); cleanup(tableNames); } @@ -152,7 +154,8 @@ public class DurabilityIT extends ConfigurableMacIT { c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), none); writeSome(tableName, N); restartTServer(); -assertTrue(N readSome(tableName)); +long numResults = readSome(tableName); +assertTrue(Expected + N + = + numResults, N = numResults); c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), sync); writeSome(tableName, N); restartTServer();
[1/3] accumulo git commit: ACCUMULO-3861 durability=none might still see all results.
Repository: accumulo Updated Branches: refs/heads/1.7 98fbe4f14 - f9a29c77d refs/heads/master ae2255c87 - 8c1d2d0c1 ACCUMULO-3861 durability=none might still see all results. It's extremely unlikely, but it apparently is possible since it failed for me in that way (best I can tell). Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f9a29c77 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f9a29c77 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f9a29c77 Branch: refs/heads/1.7 Commit: f9a29c77d28e5f2de218741c07fdec4ad49228fb Parents: 98fbe4f Author: Josh Elser els...@apache.org Authored: Wed May 27 22:52:28 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 22:52:28 2015 -0400 -- .../org/apache/accumulo/test/functional/DurabilityIT.java | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/f9a29c77/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java index aa280dc..9a262a1 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/DurabilityIT.java @@ -130,7 +130,8 @@ public class DurabilityIT extends ConfigurableMacIT { // we're probably going to lose something the the log setting writeSome(tableNames[2], N); restartTServer(); -assertTrue(N = readSome(tableNames[2])); +long numResults = readSome(tableNames[2]); +assertTrue(Expected + N + = + numResults, N = numResults); cleanup(tableNames); } @@ -140,7 +141,8 @@ public class DurabilityIT extends ConfigurableMacIT { // probably won't get any data back without logging writeSome(tableNames[3], N); restartTServer(); -assertTrue(N readSome(tableNames[3])); +long numResults = readSome(tableNames[3]); +assertTrue(Expected + N + = + numResults, N = numResults); cleanup(tableNames); } @@ -152,7 +154,8 @@ public class DurabilityIT extends ConfigurableMacIT { c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), none); writeSome(tableName, N); restartTServer(); -assertTrue(N readSome(tableName)); +long numResults = readSome(tableName); +assertTrue(Expected + N + = + numResults, N = numResults); c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), sync); writeSome(tableName, N); restartTServer();
[3/3] accumulo git commit: Merge branch '1.7'
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/8c1d2d0c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/8c1d2d0c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/8c1d2d0c Branch: refs/heads/master Commit: 8c1d2d0c147220ca375006a8a7e7e481241651a7 Parents: ae2255c f9a29c7 Author: Josh Elser els...@apache.org Authored: Wed May 27 23:06:51 2015 -0400 Committer: Josh Elser els...@apache.org Committed: Wed May 27 23:06:51 2015 -0400 -- .../org/apache/accumulo/test/functional/DurabilityIT.java | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --