accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1471668 - in /accumulo/branches/1.4/src: ./ core/ proxy/src/main/java/org/apache/accumulo/proxy/ proxy/src/test/java/org/apache/accumulo/proxy/ server/ server/src/ server/src/main/java/org/apache/accumulo/server/zookeeper/
Date Wed, 24 Apr 2013 20:51:39 GMT
Author: kturner
Date: Wed Apr 24 20:51:38 2013
New Revision: 1471668

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

Modified:
    accumulo/branches/1.4/src/   (props changed)
    accumulo/branches/1.4/src/core/   (props changed)
    accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
    accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/branches/1.4/src/server/   (props changed)
    accumulo/branches/1.4/src/server/src/   (props changed)
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java
  (props changed)

Propchange: accumulo/branches/1.4/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1471607,1471643

Propchange: accumulo/branches/1.4/src/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1471607,1471643

Modified: accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1471668&r1=1471667&r2=1471668&view=diff
==============================================================================
--- accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
(original)
+++ accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
Wed Apr 24 20:51:38 2013
@@ -1033,8 +1033,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());
     }
@@ -1058,7 +1069,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;
     
@@ -1120,8 +1131,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/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1471668&r1=1471667&r2=1471668&view=diff
==============================================================================
--- accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
(original)
+++ accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
Wed Apr 24 20:51:38 2013
@@ -312,6 +312,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");
@@ -332,6 +351,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/branches/1.4/src/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1471607,1471643

Propchange: accumulo/branches/1.4/src/server/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server/src:r1471607,1471643

Propchange: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooLock.java:r1471607,1471643



Mime
View raw message