You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/05/27 22:47:29 UTC
[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 <el...@apache.org>
Authored: Wed May 27 16:19:32 2015 -0400
Committer: Josh Elser <el...@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 @@
<artifactId>zookeeper</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</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, Map<ByteBuffer,List<ColumnUpdate>> 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(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) {
+ void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> 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 0000000..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 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.proxy;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusException;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ProxyServerTest {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromAddCells() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // Set the exception
+ bwpe.exception = mre;
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromFlush() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // No exception throw adding the cells
+ bwpe.exception = null;
+
+ writer.flush();
+ EasyMock.expectLastCall().andThrow(mre);
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+}
[17/17] accumulo git commit: Merge branch '1.7'
Posted by el...@apache.org.
Merge branch '1.7'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b37ee94b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b37ee94b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b37ee94b
Branch: refs/heads/master
Commit: b37ee94bacb87c22d942932b17954e52541d92a9
Parents: 535e2f3 7e5145a
Author: Josh Elser <el...@apache.org>
Authored: Wed May 27 16:46:23 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 27 16:46:23 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/b37ee94b/proxy/pom.xml
----------------------------------------------------------------------
[06/17] accumulo git commit: Merge branch '1.5' into 1.6
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:20:08 2015 -0400
Committer: Josh Elser <el...@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 @@@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <excludeFilterFile>src/main/findbugs/exclude-filter.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
<profiles>
<profile>
<id>thrift</id>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
----------------------------------------------------------------------
[07/17] accumulo git commit: Merge branch '1.5' into 1.6
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:20:08 2015 -0400
Committer: Josh Elser <el...@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 @@@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <excludeFilterFile>src/main/findbugs/exclude-filter.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
<profiles>
<profile>
<id>thrift</id>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
----------------------------------------------------------------------
[08/17] accumulo git commit: Merge branch '1.6' into 1.7
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:45:46 2015 -0400
Committer: Josh Elser <el...@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 @@@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-test</artifactId>
++ <groupId>org.easymock</groupId>
++ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</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, Map<ByteBuffer,List<ColumnUpdate>> 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(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusProblem bwpe) {
- void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) {
++ void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> 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 0000000,ed4f313..24201e7
mode 000000,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 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.proxy;
+
+ import java.nio.ByteBuffer;
+ import java.nio.charset.Charset;
+ import java.util.HashMap;
+ import java.util.List;
+ import java.util.Map;
+
+ import org.apache.accumulo.core.client.BatchWriter;
+ import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusException;
++import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusProblem;
+ import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+ import org.apache.accumulo.proxy.thrift.WriterOptions;
+ import org.easymock.EasyMock;
+ import org.junit.Assert;
+ import org.junit.Test;
+
+ /**
+ *
+ */
+ public class ProxyServerTest {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromAddCells() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
- .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
++ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusProblem.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
- BatchWriterPlusException bwpe = new BatchWriterPlusException();
++ BatchWriterPlusProblem bwpe = new BatchWriterPlusProblem();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
- final String tableName = "table1";
++ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // Set the exception
+ bwpe.exception = mre;
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromFlush() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
- .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
++ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusProblem.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
- BatchWriterPlusException bwpe = new BatchWriterPlusException();
++ BatchWriterPlusProblem bwpe = new BatchWriterPlusProblem();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
- final String tableName = "table1";
++ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // No exception throw adding the cells
+ bwpe.exception = null;
+
+ writer.flush();
+ EasyMock.expectLastCall().andThrow(mre);
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
-
++
+ }
[10/17] accumulo git commit: Merge branch '1.6' of
https://git-wip-us.apache.org/repos/asf/accumulo into 1.6
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:45:56 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 27 16:45:56 2015 -0400
----------------------------------------------------------------------
.../apache/accumulo/tserver/TabletServer.java | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[16/17] accumulo git commit: Merge branch '1.6' into 1.7
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:46:19 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 27 16:46:19 2015 -0400
----------------------------------------------------------------------
----------------------------------------------------------------------
[03/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets
closed in updateAndFlush
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:19:32 2015 -0400
Committer: Josh Elser <el...@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 @@
<artifactId>zookeeper</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</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, Map<ByteBuffer,List<ColumnUpdate>> 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(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) {
+ void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> 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 0000000..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 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.proxy;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusException;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ProxyServerTest {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromAddCells() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // Set the exception
+ bwpe.exception = mre;
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromFlush() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // No exception throw adding the cells
+ bwpe.exception = null;
+
+ writer.flush();
+ EasyMock.expectLastCall().andThrow(mre);
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+}
[09/17] accumulo git commit: Merge branch '1.6' into 1.7
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:45:46 2015 -0400
Committer: Josh Elser <el...@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 @@@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-test</artifactId>
++ <groupId>org.easymock</groupId>
++ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</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, Map<ByteBuffer,List<ColumnUpdate>> 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(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusProblem bwpe) {
- void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) {
++ void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> 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 0000000,ed4f313..24201e7
mode 000000,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 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.proxy;
+
+ import java.nio.ByteBuffer;
+ import java.nio.charset.Charset;
+ import java.util.HashMap;
+ import java.util.List;
+ import java.util.Map;
+
+ import org.apache.accumulo.core.client.BatchWriter;
+ import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusException;
++import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusProblem;
+ import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+ import org.apache.accumulo.proxy.thrift.WriterOptions;
+ import org.easymock.EasyMock;
+ import org.junit.Assert;
+ import org.junit.Test;
+
+ /**
+ *
+ */
+ public class ProxyServerTest {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromAddCells() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
- .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
++ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusProblem.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
- BatchWriterPlusException bwpe = new BatchWriterPlusException();
++ BatchWriterPlusProblem bwpe = new BatchWriterPlusProblem();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
- final String tableName = "table1";
++ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // Set the exception
+ bwpe.exception = mre;
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromFlush() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
- .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
++ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusProblem.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
- BatchWriterPlusException bwpe = new BatchWriterPlusException();
++ BatchWriterPlusProblem bwpe = new BatchWriterPlusProblem();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
- final String tableName = "table1";
++ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // No exception throw adding the cells
+ bwpe.exception = null;
+
+ writer.flush();
+ EasyMock.expectLastCall().andThrow(mre);
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
-
++
+ }
[05/17] accumulo git commit: Merge branch '1.5' into 1.6
Posted by el...@apache.org.
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.6
Commit: c9f33d090ab887423714d673fb5e3e336274f33c
Parents: de2763e 11f108e
Author: Josh Elser <el...@apache.org>
Authored: Wed May 27 16:20:08 2015 -0400
Committer: Josh Elser <el...@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 @@@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <excludeFilterFile>src/main/findbugs/exclude-filter.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
<profiles>
<profile>
<id>thrift</id>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c9f33d09/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
----------------------------------------------------------------------
[15/17] accumulo git commit: Merge branch '1.6' into 1.7
Posted by el...@apache.org.
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/1.7
Commit: 7e5145a28b71b3dadb726da3b2e0ab83cac12277
Parents: faee4f8 0cf5b9c
Author: Josh Elser <el...@apache.org>
Authored: Wed May 27 16:46:19 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 27 16:46:19 2015 -0400
----------------------------------------------------------------------
----------------------------------------------------------------------
[12/17] accumulo git commit: Merge branch '1.6' of
https://git-wip-us.apache.org/repos/asf/accumulo into 1.6
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:45:56 2015 -0400
Committer: Josh Elser <el...@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
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:46:15 2015 -0400
Committer: Josh Elser <el...@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(-)
----------------------------------------------------------------------
[02/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets
closed in updateAndFlush
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:19:32 2015 -0400
Committer: Josh Elser <el...@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 @@
<artifactId>zookeeper</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</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, Map<ByteBuffer,List<ColumnUpdate>> 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(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) {
+ void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> 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 0000000..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 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.proxy;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusException;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ProxyServerTest {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromAddCells() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // Set the exception
+ bwpe.exception = mre;
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromFlush() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // No exception throw adding the cells
+ bwpe.exception = null;
+
+ writer.flush();
+ EasyMock.expectLastCall().andThrow(mre);
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+}
[04/17] accumulo git commit: ACCUMULO-3856 Ensure batchwriter gets
closed in updateAndFlush
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:19:32 2015 -0400
Committer: Josh Elser <el...@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 @@
<artifactId>zookeeper</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</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, Map<ByteBuffer,List<ColumnUpdate>> 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(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) {
+ void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> 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 0000000..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 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.proxy;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.proxy.ProxyServer.BatchWriterPlusException;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ProxyServerTest {
+
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromAddCells() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // Set the exception
+ bwpe.exception = mre;
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+ @Test
+ public void updateAndFlushClosesWriterOnExceptionFromFlush() throws Exception {
+ ProxyServer server = EasyMock.createMockBuilder(ProxyServer.class).addMockedMethod("getWriter", ByteBuffer.class, String.class, WriterOptions.class)
+ .addMockedMethod("addCellsToWriter", Map.class, BatchWriterPlusException.class).createMock();
+ BatchWriter writer = EasyMock.createMock(BatchWriter.class);
+ BatchWriterPlusException bwpe = new BatchWriterPlusException();
+ bwpe.writer = writer;
+ MutationsRejectedException mre = EasyMock.createMock(MutationsRejectedException.class);
+
+ final ByteBuffer login = ByteBuffer.wrap("my_login".getBytes(UTF_8));
+ final String tableName = "table1";
+ final Map<ByteBuffer,List<ColumnUpdate>> cells = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+
+ EasyMock.expect(server.getWriter(login, tableName, null)).andReturn(bwpe);
+ server.addCellsToWriter(cells, bwpe);
+ EasyMock.expectLastCall();
+
+ // No exception throw adding the cells
+ bwpe.exception = null;
+
+ writer.flush();
+ EasyMock.expectLastCall().andThrow(mre);
+
+ writer.close();
+ EasyMock.expectLastCall();
+
+ EasyMock.replay(server, writer, mre);
+
+ try {
+ server.updateAndFlush(login, tableName, cells);
+ Assert.fail("Expected updateAndFlush to throw an exception");
+ } catch (org.apache.accumulo.proxy.thrift.MutationsRejectedException e) {
+ // pass
+ }
+
+ EasyMock.verify(server, writer, mre);
+ }
+
+}
[14/17] accumulo git commit: Merge branch '1.7' of
https://git-wip-us.apache.org/repos/asf/accumulo into 1.7
Posted by el...@apache.org.
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/master
Commit: faee4f8ac0fceb0baf2c98bcc76ff3ea9458df95
Parents: 6dab32e f6ba154
Author: Josh Elser <el...@apache.org>
Authored: Wed May 27 16:46:15 2015 -0400
Committer: Josh Elser <el...@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(-)
----------------------------------------------------------------------
[11/17] accumulo git commit: Merge branch '1.6' of
https://git-wip-us.apache.org/repos/asf/accumulo into 1.6
Posted by el...@apache.org.
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 <el...@apache.org>
Authored: Wed May 27 16:45:56 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 27 16:45:56 2015 -0400
----------------------------------------------------------------------
.../apache/accumulo/tserver/TabletServer.java | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------