hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r944385 - in /hadoop/hbase/trunk: CHANGES.txt core/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
Date Fri, 14 May 2010 18:51:37 GMT
Author: stack
Date: Fri May 14 18:51:36 2010
New Revision: 944385

URL: http://svn.apache.org/viewvc?rev=944385&view=rev
Log:
HBASE-2524 Unresponsive region server, potential deadlock

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=944385&r1=944384&r2=944385&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Fri May 14 18:51:36 2010
@@ -563,6 +563,8 @@ Release 0.21.0 - Unreleased
    HBASE-2537  Change ordering of maven repos listed in pom.xml to have
                ibiblio first
    HBASE-2540  Make QueryMatcher.MatchCode public (Clint Morgan via Stack)
+   HBASE-2524  Unresponsive region server, potential deadlock
+               (Todd Lipcon via Stack)
 
   NEW FEATURES
    HBASE-1961  HBase EC2 scripts

Modified: hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java?rev=944385&r1=944384&r2=944385&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
(original)
+++ hadoop/hbase/trunk/core/src/test/java/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
Fri May 14 18:51:36 2010
@@ -23,6 +23,7 @@ package org.apache.hadoop.hbase.regionse
 import java.util.ArrayList;
 import java.util.List;
 import java.util.TreeSet;
+import java.util.Arrays;
 
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HConstants;
@@ -40,6 +41,31 @@ implements HConstants {
   private final byte [] col4 = Bytes.toBytes("col4");
   private final byte [] col5 = Bytes.toBytes("col5");
 
+  private void runTest(int maxVersions,
+                       TreeSet<byte[]> trackColumns,
+                       List<byte[]> scannerColumns,
+                       List<MatchCode> expected) {
+    ColumnTracker exp = new ExplicitColumnTracker(
+      trackColumns, maxVersions);
+
+
+    //Initialize result
+    List<MatchCode> result = new ArrayList<MatchCode>(); 
+    
+    //"Match"
+    for(byte [] col : scannerColumns){
+      result.add(exp.checkColumn(col, 0, col.length));
+    }
+    
+    assertEquals(expected.size(), result.size());
+    for(int i=0; i< expected.size(); i++){
+      assertEquals(expected.get(i), result.get(i));
+      if(PRINT){
+        System.out.println("Expected " +expected.get(i) + ", actual " +
+            result.get(i));
+      }
+    }
+  }
 
   public void testGet_SingleVersion(){
     if(PRINT){
@@ -59,8 +85,6 @@ implements HConstants {
     expected.add(MatchCode.DONE);
     int maxVersions = 1;
 
-    ColumnTracker exp = new ExplicitColumnTracker(columns, maxVersions);
-
     //Create "Scanner"
     List<byte[]> scanner = new ArrayList<byte[]>();
     scanner.add(col1);
@@ -69,22 +93,7 @@ implements HConstants {
     scanner.add(col4);
     scanner.add(col5);
 
-    //Initialize result
-    List<MatchCode> result = new ArrayList<MatchCode>();
-
-    //"Match"
-    for(byte [] col : scanner){
-      result.add(exp.checkColumn(col, 0, col.length));
-    }
-
-    assertEquals(expected.size(), result.size());
-    for(int i=0; i< expected.size(); i++){
-      assertEquals(expected.get(i), result.get(i));
-      if(PRINT){
-        System.out.println("Expected " +expected.get(i) + ", actual " +
-            result.get(i));
-      }
-    }
+    runTest(maxVersions, columns, scanner, expected);
   }
 
   public void testGet_MultiVersion(){
@@ -120,8 +129,6 @@ implements HConstants {
     expected.add(MatchCode.DONE);
     int maxVersions = 2;
 
-    ColumnTracker exp = new ExplicitColumnTracker(columns, maxVersions);
-
     //Create "Scanner"
     List<byte[]> scanner = new ArrayList<byte[]>();
     scanner.add(col1);
@@ -141,21 +148,7 @@ implements HConstants {
     scanner.add(col5);
 
     //Initialize result
-    List<MatchCode> result = new ArrayList<MatchCode>();
-
-    //"Match"
-    for(byte [] col : scanner){
-      result.add(exp.checkColumn(col, 0, col.length));
-    }
-
-    assertEquals(expected.size(), result.size());
-    for(int i=0; i< expected.size(); i++){
-      assertEquals(expected.get(i), result.get(i));
-      if(PRINT){
-        System.out.println("Expected " +expected.get(i) + ", actual " +
-            result.get(i));
-      }
-    }
+    runTest(maxVersions, columns, scanner, expected);
   }
 
 
@@ -182,5 +175,19 @@ implements HConstants {
     }
   }
 
-
+  /**
+   * Regression test for HBASE-2545
+   */
+  public void testInfiniteLoop() {
+    TreeSet<byte[]> columns = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
+    columns.addAll(Arrays.asList(new byte[][] {
+      col2, col3, col5 }));
+    List<byte[]> scanner = Arrays.<byte[]>asList(
+      new byte[][] { col1, col4 });
+    List<MatchCode> expected = Arrays.<MatchCode>asList(
+      new MatchCode[] {
+        MatchCode.SKIP,
+        MatchCode.SKIP });
+    runTest(1, columns, scanner, expected);
+  }
 }



Mime
View raw message