accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1471676 - in /accumulo/trunk: ./ assemble/ core/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/java/org/apache/accumulo/fate/zookeeper/ proxy/src/main/java/org/apache/accumulo/proxy/ proxy/src/test/java/org/apache/ac...
Date Wed, 24 Apr 2013 21:03:07 GMT
Author: kturner
Date: Wed Apr 24 21:03:07 2013
New Revision: 1471676

URL: http://svn.apache.org/r1471676
Log:
ACCUMULO-1338 fixed issue w/ closeScanner() in proxy
ACCUMULO-1340 made proxy update call tolerate unknown session ids

Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/assemble/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/examples/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java 
 (props changed)
    accumulo/trunk/pom.xml   (props changed)
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1471569-1471672

Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/assemble:r1471569-1471672

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1471569-1471672

Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/examples:r1471569-1471672

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1471569-1471672

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1471569-1471672

Propchange: accumulo/trunk/pom.xml
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/pom.xml:r1471569-1471672

Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1471676&r1=1471675&r2=1471676&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Wed Apr
24 21:03:07 2013
@@ -1065,8 +1065,19 @@ public class ProxyServer implements Accu
 
   @Override
   public void closeScanner(String scanner) throws UnknownScanner, TException {
+    UUID uuid = null;
+    try {
+      uuid = UUID.fromString(scanner);
+    } catch (IllegalArgumentException e) {
+      throw new UnknownScanner(e.getMessage());
+    }
+
     try {
-      scannerCache.invalidate(scanner);
+      if (scannerCache.asMap().remove(uuid) == null) {
+        throw new UnknownScanner("Scanner never existed or no longer exists");
+      }
+    } catch (UnknownScanner e) {
+      throw e;
     } catch (Exception e) {
       throw new TException(e.toString());
     }
@@ -1090,7 +1101,7 @@ public class ProxyServer implements Accu
   
   private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility();
   
-  private void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException
bwpe) throws MutationsRejectedException {
+  private void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException
bwpe) {
     if (bwpe.exception != null)
       return;
     
@@ -1152,8 +1163,8 @@ public class ProxyServer implements Accu
     try {
       BatchWriterPlusException bwpe = getWriter(writer);
       addCellsToWriter(cells, bwpe);
-    } catch (Exception e) {
-      throw new TException(e);
+    } catch (UnknownWriter e) {
+      // just drop it, this is a oneway thrift call and throwing a TException seems to make
all subsequent thrift calls fail
     }
   }
   

Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1471676&r1=1471675&r2=1471676&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Wed Apr 24
21:03:07 2013
@@ -329,6 +329,25 @@ public class SimpleTest {
   
   @Test(timeout = 10000)
   public void testUnknownScanner() throws Exception {
+    if (client.tableExists(creds, TABLE_TEST))
+      client.deleteTable(creds, TABLE_TEST);
+    
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    
+    String scanner = client.createScanner(creds, TABLE_TEST, null);
+    assertFalse(client.hasNext(scanner));
+    client.closeScanner(scanner);
+    
+    try {
+      client.hasNext(scanner);
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+
+    try {
+      client.closeScanner(scanner);
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+    
     try {
       client.nextEntry("99999999");
       fail("exception not thrown");
@@ -349,6 +368,25 @@ public class SimpleTest {
   
   @Test(timeout = 10000)
   public void testUnknownWriter() throws Exception {
+    
+    if (client.tableExists(creds, TABLE_TEST))
+      client.deleteTable(creds, TABLE_TEST);
+    
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    
+    String writer = client.createWriter(creds, TABLE_TEST, null);
+    client.update(writer, mutation("row0", "cf", "cq", "value"));
+    client.flush(writer);
+    client.update(writer, mutation("row2", "cf", "cq", "value2"));
+    client.closeWriter(writer);
+    
+    // this is a oneway call, so it does not throw exceptions
+    client.update(writer, mutation("row2", "cf", "cq", "value2"));
+
+    try {
+      client.flush(writer);
+      fail("exception not thrown");
+    } catch (UnknownWriter uw) {}
     try {
       client.flush("99999");
       fail("exception not thrown");

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1471569-1471672

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/src:r1471569-1471672



Mime
View raw message