hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jg...@apache.org
Subject svn commit: r816024 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HRegion.java src/test/org/apache/hadoop/hbase/client/TestClient.java
Date Thu, 17 Sep 2009 01:25:05 GMT
Author: jgray
Date: Thu Sep 17 01:25:04 2009
New Revision: 816024

URL: http://svn.apache.org/viewvc?rev=816024&view=rev
Log:
HBASE-1847 Delete latest of a null qualifier when non-null qualifiers exist throws a RuntimeException

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestClient.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=816024&r1=816023&r2=816024&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Thu Sep 17 01:25:04 2009
@@ -30,6 +30,8 @@
    HBASE-818   HFile code review and refinement (Schubert Zhang via Stack)
    HBASE-1830  HbaseObjectWritable methods should allow null HBCs
                for when Writable is not Configurable (Stack via jgray)
+   HBASE-1847  Delete latest of a null qualifier when non-null qualifiers
+               exist throws a RuntimeException 
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=816024&r1=816023&r2=816024&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Thu Sep
17 01:25:04 2009
@@ -1160,7 +1160,8 @@
           NavigableSet<byte []> qualifiers =
             new TreeSet<byte []>(Bytes.BYTES_COMPARATOR);
           byte [] q = kv.getQualifier();
-          if (q != null && q.length > 0) qualifiers.add(kv.getQualifier());
+          if(q == null) q = HConstants.EMPTY_BYTE_ARRAY;
+          qualifiers.add(q);
           get(store, g, qualifiers, result);
           if (result.isEmpty()) {
             // Nothing to delete

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestClient.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestClient.java?rev=816024&r1=816023&r2=816024&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestClient.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/client/TestClient.java Thu Sep 17
01:25:04 2009
@@ -1070,7 +1070,7 @@
         result.size() == 9);
     
   }
-  
+
   public void testDeletes() throws Exception {
     byte [] TABLE = Bytes.toBytes("testDeletes");
     
@@ -1113,6 +1113,9 @@
     put.add(FAMILIES[0], QUALIFIER, ts[4], VALUES[4]);
     put.add(FAMILIES[0], QUALIFIER, ts[2], VALUES[2]);
     put.add(FAMILIES[0], QUALIFIER, ts[3], VALUES[3]);
+    put.add(FAMILIES[0], null, ts[4], VALUES[4]);
+    put.add(FAMILIES[0], null, ts[2], VALUES[2]);
+    put.add(FAMILIES[0], null, ts[3], VALUES[3]);
     ht.put(put);
     
     delete = new Delete(ROW);
@@ -1120,7 +1123,7 @@
     ht.delete(delete);
     
     get = new Get(ROW);
-    get.addFamily(FAMILIES[0]);
+    get.addColumn(FAMILIES[0], QUALIFIER);
     get.setMaxVersions(Integer.MAX_VALUE);
     result = ht.get(get);
     assertNResult(result, ROW, FAMILIES[0], QUALIFIER, 
@@ -1129,7 +1132,7 @@
         0, 2);
     
     scan = new Scan(ROW);
-    scan.addFamily(FAMILIES[0]);
+    scan.addColumn(FAMILIES[0], QUALIFIER);
     scan.setMaxVersions(Integer.MAX_VALUE);
     result = getSingleScanResult(ht, scan);
     assertNResult(result, ROW, FAMILIES[0], QUALIFIER, 
@@ -1137,6 +1140,16 @@
         new byte[][] {VALUES[1], VALUES[2], VALUES[3]},
         0, 2);
     
+    // Test for HBASE-1847
+    delete = new Delete(ROW);
+    delete.deleteColumn(FAMILIES[0], null);
+    ht.delete(delete);
+    
+    // Cleanup null qualifier
+    delete = new Delete(ROW);
+    delete.deleteColumns(FAMILIES[0], null);
+    ht.delete(delete);
+    
     // Expected client behavior might be that you can re-put deleted values
     // But alas, this is not to be.  We can't put them back in either case.
     



Mime
View raw message