hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r798227 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
Date Mon, 27 Jul 2009 17:26:10 GMT
Author: stack
Date: Mon Jul 27 17:26:10 2009
New Revision: 798227

URL: http://svn.apache.org/viewvc?rev=798227&view=rev
Log:
HBASE-1705 Thrift server: deletes in mutateRow/s don't delete

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=798227&r1=798226&r2=798227&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Jul 27 17:26:10 2009
@@ -291,6 +291,8 @@
    HBASE-1692  Web UI is extremely slow / freezes up if you have many tables
    HBASE-1686  major compaction can create empty store files, causing AIOOB
                when trying to read
+   HBASE-1705  Thrift server: deletes in mutateRow/s don't delete
+               (Tim Sell and Ryan Rawson via Stack)
 
   IMPROVEMENTS
    HBASE-1089  Add count of regions on filesystem to master UI; add percentage

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=798227&r1=798226&r2=798227&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Mon Jul 27
17:26:10 2009
@@ -437,18 +437,31 @@
       mutateRowTs(tableName, row, mutations, HConstants.LATEST_TIMESTAMP);
     }
     
-    public void mutateRowTs(byte[] tableName, byte[] row,
+    public void mutateRowTs(byte[] tableName, byte[] row, 
         List<Mutation> mutations, long timestamp) throws IOError, IllegalArgument {
       HTable table = null;
       try {
         table = getTable(tableName);
         Put put = new Put(row);
         put.setTimeStamp(timestamp);
+
+        Delete delete = new Delete(row);
+
         for (Mutation m : mutations) {
-          byte [][] famAndQf = KeyValue.parseColumn(m.column);
-          put.add(famAndQf[0], famAndQf[1], m.value);
+          byte[][] famAndQf = KeyValue.parseColumn(m.column);
+          if (m.isDelete) {
+            if (famAndQf[1].length == 0)
+              delete.deleteFamily(famAndQf[0], timestamp);
+            else
+              delete.deleteColumns(famAndQf[0], famAndQf[1], timestamp);
+          } else {
+            put.add(famAndQf[0], famAndQf[1], m.value);
+          }
         }
-        table.put(put);
+        if (!delete.isEmpty())
+          table.delete(delete);
+        if (!put.isEmpty())
+          table.put(put);
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       } catch (IllegalArgumentException e) {
@@ -460,7 +473,7 @@
         throws IOError, IllegalArgument, TException {
       mutateRowsTs(tableName, rowBatches, HConstants.LATEST_TIMESTAMP);
     }
- 
+
     public void mutateRowsTs(byte[] tableName, List<BatchMutation> rowBatches, long
timestamp)
         throws IOError, IllegalArgument, TException {
       List<Put> puts = new ArrayList<Put>();
@@ -473,9 +486,13 @@
         Put put = new Put(row);
         put.setTimeStamp(timestamp);
         for (Mutation m : mutations) {
-          byte [][] famAndQf = KeyValue.parseColumn(m.column);
+          byte[][] famAndQf = KeyValue.parseColumn(m.column);
           if (m.isDelete) {
-            delete.deleteColumns(famAndQf[0], famAndQf[1]);
+            // no qualifier, family only.
+            if (famAndQf[1].length == 0)
+              delete.deleteFamily(famAndQf[0], timestamp);
+            else
+              delete.deleteColumns(famAndQf[0], famAndQf[1], timestamp);
           } else {
             put.add(famAndQf[0], famAndQf[1], m.value);
           }



Mime
View raw message