hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r612500 - in /lucene/hadoop/trunk/src/contrib/hbase: CHANGES.txt src/java/org/apache/hadoop/hbase/HRegion.java src/java/org/apache/hadoop/hbase/HStore.java src/java/org/apache/hadoop/hbase/HStoreFile.java
Date Wed, 16 Jan 2008 16:26:26 GMT
Author: stack
Date: Wed Jan 16 08:26:24 2008
New Revision: 612500

URL: http://svn.apache.org/viewvc?rev=612500&view=rev
Log:
HADOOP-2493 hbase will split on row when the start and end row
is the same cause data loss

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStoreFile.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?rev=612500&r1=612499&r2=612500&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Wed Jan 16 08:26:24 2008
@@ -131,6 +131,8 @@
                duration of compaction. 
    HADOOP-2592 Scanning, a region can let out a row that its not supposed
                to have
+   HADOOP-2493 hbase will split on row when the start and end row is the
+               same cause data loss (Bryan Duxbury via Stack)
    
   IMPROVEMENTS
    HADOOP-2401 Add convenience put method that takes writable

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java?rev=612500&r1=612499&r2=612500&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java Wed
Jan 16 08:26:24 2008
@@ -654,7 +654,8 @@
    */
   boolean needsSplit(Text midKey) {
     HStore.HStoreSize biggest = largestHStore(midKey);
-    if (biggest == null) {
+    if (biggest == null || midKey.getLength() == 0 || 
+      (midKey.equals(getStartKey()) && midKey.equals(getEndKey())) ) {
       return false;
     }
     long triggerSize = this.desiredMaxFileSize + (this.desiredMaxFileSize / 2);

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java?rev=612500&r1=612499&r2=612500&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java Wed
Jan 16 08:26:24 2008
@@ -2020,9 +2020,28 @@
         }
       }
       MapFile.Reader r = this.readers.get(mapIndex);
-      WritableComparable midkey = r.midKey();
+      
+      // seek back to the beginning of mapfile
+      r.reset();
+      
+      // get the first and last keys
+      HStoreKey firstKey = new HStoreKey();
+      HStoreKey lastKey = new HStoreKey();
+      Writable value = new ImmutableBytesWritable();
+      r.next((WritableComparable)firstKey, value);
+      r.finalKey((WritableComparable)lastKey);
+      
+      // get the midkey
+      HStoreKey midkey = (HStoreKey)r.midKey();
+
       if (midkey != null) {
         midKey.set(((HStoreKey)midkey).getRow());
+        // if the midkey is the same as the first and last keys, then we cannot
+        // (ever) split this region. 
+        if (midkey.getRow().equals(firstKey.getRow()) && 
+          midkey.getRow().equals(lastKey.getRow())) {
+          return new HStoreSize(aggregateSize, maxSize, false);
+        } 
       }
     } catch(IOException e) {
       LOG.warn("Failed getting store size for " + this.storeName, e);

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStoreFile.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStoreFile.java?rev=612500&r1=612499&r2=612500&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStoreFile.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStoreFile.java
Wed Jan 16 08:26:24 2008
@@ -770,11 +770,18 @@
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings({ "unused"})
     @Override
     public synchronized void finalKey(WritableComparable key)
     throws IOException {
-      throw new UnsupportedOperationException("Unsupported");
+      if (top) {
+        checkKey(key);
+        super.finalKey(key); 
+      } else {
+        reset();
+        Writable value = new ImmutableBytesWritable();
+        
+        key = super.getClosest(midkey, value, true);
+      }
     }
 
     /** {@inheritDoc} */



Mime
View raw message