Updated Branches:
  refs/heads/1.5.1-SNAPSHOT 1c8f7f55b -> 3143b9c5e

ACCUMULO-1800 fix deletes, added test


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ffd16c7a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ffd16c7a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ffd16c7a

Branch: refs/heads/1.5.1-SNAPSHOT
Commit: ffd16c7adbfd99f7acbba08ad9934acd5c80a7df
Parents: 19e24ab
Author: Eric Newton <eric.new...@gmail.com>
Authored: Tue Oct 22 10:20:59 2013 -0400
Committer: Eric Newton <eric.new...@gmail.com>
Committed: Tue Oct 22 10:20:59 2013 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/proxy/ProxyServer.java  | 10 ++++----
 .../org/apache/accumulo/proxy/SimpleTest.java   | 25 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ffd16c7a/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
----------------------------------------------------------------------
diff --git a/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java 
b/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
index 6241d19..d749723 100644
--- a/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
+++ b/src/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
@@ -1094,14 +1094,14 @@ public class ProxyServer implements AccumuloProxy.Iface 
{
           if (update.isSetDeleteCell()) {
             m.putDelete(new Text(update.getColFamily()), new 
Text(update.getColQualifier()), viz, update.getTimestamp());
           } else {
-            if (update.isSetDeleteCell()) {
-              m.putDelete(new Text(update.getColFamily()), new 
Text(update.getColQualifier()), viz, update.getTimestamp());
-            } else {
               m.put(new Text(update.getColFamily()), new 
Text(update.getColQualifier()), viz, update.getTimestamp(), new Value(value));
             }
-          }
         } else {
-          m.put(new Text(update.getColFamily()), new 
Text(update.getColQualifier()), viz, new Value(value));
+          if (update.isSetDeleteCell()) {
+            m.putDelete(new Text(update.getColFamily()), new 
Text(update.getColQualifier()), viz);
+          } else {
+            m.put(new Text(update.getColFamily()), new 
Text(update.getColQualifier()), viz, new Value(value));
+          }
         }
       }
       try {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ffd16c7a/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
----------------------------------------------------------------------
diff --git a/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java 
b/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
index dd1bb19..f6533c2 100644
--- a/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
+++ b/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
@@ -385,6 +385,31 @@ public class SimpleTest {
   }
   
   @Test(timeout = 10000)
+  public void testDelete() throws Exception {
+    if (client.tableExists(creds, TABLE_TEST))
+      client.deleteTable(creds, TABLE_TEST);
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    client.updateAndFlush(creds, TABLE_TEST, mutation("row0", "cf", "cq", 
"value"));
+    String scanner = client.createScanner(creds, TABLE_TEST, null);
+    ScanResult entries = client.nextK(scanner, 10);
+    client.closeScanner(scanner);
+    assertFalse(entries.more);
+    assertEquals(1, entries.results.size());
+    
+    ColumnUpdate upd = new ColumnUpdate(s2bb("cf"), s2bb("cq"));
+    upd.setDeleteCell(true);
+    Map<ByteBuffer,List<ColumnUpdate>> delete = 
Collections.singletonMap(s2bb("row0"), Collections.singletonList(upd));
+    
+    client.updateAndFlush(creds, TABLE_TEST, delete);
+    
+    scanner = client.createScanner(creds, TABLE_TEST, null);
+    entries = client.nextK(scanner, 10);
+    client.closeScanner(scanner);
+    assertEquals(0, entries.results.size());
+  }
+
+  @Test(timeout = 10000)
   public void testInstanceOperations() throws Exception {
     int tservers = 0;
     for (String tserver : client.getTabletServers(creds)) {

Reply via email to