hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r668750 - in /hadoop/hbase/branches/0.1: CHANGES.txt src/java/org/apache/hadoop/hbase/HStore.java src/test/org/apache/hadoop/hbase/TestHMemcache.java
Date Tue, 17 Jun 2008 17:11:32 GMT
Author: jimk
Date: Tue Jun 17 10:11:31 2008
New Revision: 668750

URL: http://svn.apache.org/viewvc?rev=668750&view=rev
Log:
HBASE-686   MemcacheScanner didn't return the first row(if it exists), because HScannerInterface's
output incorrect (LN via Jim Kellerman)

Modified:
    hadoop/hbase/branches/0.1/CHANGES.txt
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java
    hadoop/hbase/branches/0.1/src/test/org/apache/hadoop/hbase/TestHMemcache.java

Modified: hadoop/hbase/branches/0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/CHANGES.txt?rev=668750&r1=668749&r2=668750&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.1/CHANGES.txt Tue Jun 17 10:11:31 2008
@@ -21,6 +21,8 @@
                (LN via Stack)
    HBASE-684   unnecessary iteration in HMemcache.internalGet? got much better
                reading performance after break it (LN via Stack)
+   HBASE-686   MemcacheScanner didn't return the first row(if it exists),
+               because HScannerInterface's output incorrect (LN via Jim Kellerman)
 
 
 Release 0.1.2 - 05/13/2008

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java?rev=668750&r1=668749&r2=668750&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java Tue Jun 17 10:11:31
2008
@@ -631,8 +631,7 @@
        if (results.size() > 0) {
          results.clear();
        }
-       while (results.size() <= 0 &&
-           (this.currentRow = getNextRow(this.currentRow)) != null) {
+       while (results.size() <= 0 && this.currentRow != null) {
          if (deletes.size() > 0) {
            deletes.clear();
          }
@@ -661,6 +660,7 @@
            }
            results.put(column, c);
          }
+         this.currentRow = getNextRow(this.currentRow);
        }
        return results.size() > 0;
      }

Modified: hadoop/hbase/branches/0.1/src/test/org/apache/hadoop/hbase/TestHMemcache.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/test/org/apache/hadoop/hbase/TestHMemcache.java?rev=668750&r1=668749&r2=668750&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/test/org/apache/hadoop/hbase/TestHMemcache.java (original)
+++ hadoop/hbase/branches/0.1/src/test/org/apache/hadoop/hbase/TestHMemcache.java Tue Jun
17 10:11:31 2008
@@ -196,7 +196,7 @@
   }
   
   /** For HBASE-514 **/
-  public void testGetRowKeyAtOrBefore() throws IOException {
+  public void testGetRowKeyAtOrBefore() {
     // set up some test data
     Text t10 = new Text("010");
     Text t20 = new Text("020");
@@ -240,4 +240,40 @@
   private HStoreKey getHSKForRow(Text row) {
     return new HStoreKey(row, new Text("test_col:"), HConstants.LATEST_TIMESTAMP);
   }
+
+  /**
+   * Test memcache scanner scanning cached rows, HBASE-686
+   * @throws IOException
+   */
+  public void testScanner_686() throws IOException {
+    addRows(this.hmemcache);
+    long timestamp = System.currentTimeMillis();
+    Text[] cols = new Text[COLUMNS_COUNT * ROW_COUNT];
+    for (int i = 0; i < ROW_COUNT; i++) {
+      for (int ii = 0; ii < COLUMNS_COUNT; ii++) {
+        cols[(ii + (i * COLUMNS_COUNT))] = getColumnName(i, ii);
+      }
+    }
+    //starting from each row, validate results should contain the starting row
+    for (int startRowId = 0; startRowId < ROW_COUNT; startRowId++) {
+      HInternalScannerInterface scanner = this.hmemcache.getScanner(timestamp,
+          cols, new Text(getRowName(startRowId)));
+      HStoreKey key = new HStoreKey();
+      TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
+      for (int i = 0; scanner.next(key, results); i++) {
+        int rowId = startRowId + i;
+        assertTrue("Row name",
+            key.toString().startsWith(getRowName(rowId).toString()));
+        assertEquals("Count of columns", COLUMNS_COUNT, results.size());
+        TreeMap<Text, byte[]> row = new TreeMap<Text, byte[]>();
+        for (Map.Entry<Text, byte[]> e : results.entrySet()) {
+          row.put(e.getKey(), e.getValue());
+        }
+        isExpectedRow(rowId, row);
+        // Clear out set.  Otherwise row results accumulate.
+        results.clear();
+      }
+    }
+  }
+
 }
\ No newline at end of file



Mime
View raw message