hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r831474 - in /hadoop/hbase/branches/0.20: CHANGES.txt src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegion.java
Date Fri, 30 Oct 2009 22:24:13 GMT
Author: stack
Date: Fri Oct 30 22:24:12 2009
New Revision: 831474

URL: http://svn.apache.org/viewvc?rev=831474&view=rev
Log:
HBASE-1682 IndexedRegion does not properly handle deletes

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegion.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=831474&r1=831473&r2=831474&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Fri Oct 30 22:24:12 2009
@@ -23,6 +23,8 @@
    HBASE-1934  NullPointerException in ClientScanner (Andrew Purtell via Stack)
    HBASE-1946  Unhandled exception at regionserver (Dmitriy Lyfar via Stack)
    HBASE-1941  Put's copy feature has a bug (Dave Latham via Stack) 
+   HBASE-1682  IndexedRegion does not properly handle deletes
+               (Andrew McCall via Clint Morgan and Stack)
 
   IMPROVEMENTS
    HBASE-1899  Use scanner caching in shell count

Modified: hadoop/hbase/branches/0.20/src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegion.java?rev=831474&r1=831473&r2=831474&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegion.java
(original)
+++ hadoop/hbase/branches/0.20/src/contrib/transactional/src/java/org/apache/hadoop/hbase/regionserver/tableindexed/IndexedRegion.java
Fri Oct 30 22:24:12 2009
@@ -220,7 +220,7 @@
   @Override
   public void delete(Delete delete, final Integer lockid, boolean writeToWAL)
       throws IOException {
-
+    // First remove the existing indexes.
     if (!getIndexes().isEmpty()) {
       // Need all columns
       NavigableSet<byte[]> neededColumns = getColumnsForIndexes(getIndexes());
@@ -237,13 +237,17 @@
       for (IndexSpecification indexSpec : getIndexes()) {
         removeOldIndexEntry(indexSpec, delete.getRow(), oldColumnValues);
       }
+    }
+    
+    super.delete(delete, lockid, writeToWAL);
 
-      // Handle if there is still a version visible.
-      if (delete.getTimeStamp() != HConstants.LATEST_TIMESTAMP) {
-        get.setTimeRange(1, delete.getTimeStamp());
-        oldRow = super.get(get, lockid);
-        SortedMap<byte[], byte[]> currentColumnValues = convertToValueMap(oldRow);
-        
+    if (!getIndexes().isEmpty()) {
+      Get get = new Get(delete.getRow());
+      
+      // Rebuild index if there is still a version visible.
+      Result currentRow = super.get(get, lockid);
+      if (!currentRow.isEmpty()) {
+        SortedMap<byte[], byte[]> currentColumnValues = convertToValueMap(currentRow);
         for (IndexSpecification indexSpec : getIndexes()) {
           if (IndexMaintenanceUtils.doesApplyToIndex(indexSpec, currentColumnValues)) {
             updateIndex(indexSpec, delete.getRow(), currentColumnValues);
@@ -251,7 +255,7 @@
         }
       }
     }
-    super.delete(delete, lockid, writeToWAL);
+   
   }
 
   private SortedMap<byte[], byte[]> convertToValueMap(Result result) {



Mime
View raw message