hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r944367 - in /hadoop/hbase/branches/0.20: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java src/test/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
Date Fri, 14 May 2010 18:13:42 GMT
Author: stack
Date: Fri May 14 18:13:41 2010
New Revision: 944367

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

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
    hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=944367&r1=944366&r2=944367&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Fri May 14 18:13:41 2010
@@ -1,6 +1,8 @@
 HBase Change Log
-Release X.X.X - UNRELEASED
+Release 0.20.5
   BUG FIXES
+   HBASE-2545  Unresponsive region server, potential deadlock
+               (Todd Lipcon via Stack)
    HBASE-2521  no license headers in 5 files
 
 Release 0.20.4 - Mon May  3 16:16:02 PDT 2010

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java?rev=944367&r1=944366&r2=944367&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
Fri May 14 18:13:41 2010
@@ -83,8 +83,10 @@ public class ExplicitColumnTracker imple
    * @return MatchCode telling QueryMatcher what action to take
    */
   public MatchCode checkColumn(byte [] bytes, int offset, int length) {
-    boolean recursive = false;
+    boolean recursive;
     do {
+      recursive = false;
+
       // No more columns left, we are done with this query
       if(this.columns.size() == 0) {
         return MatchCode.DONE; // done_row

Modified: hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java?rev=944367&r1=944366&r2=944367&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
(original)
+++ hadoop/hbase/branches/0.20/src/test/org/apache/hadoop/hbase/regionserver/TestExplicitColumnTracker.java
Fri May 14 18:13:41 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;
@@ -39,7 +40,33 @@ implements HConstants {
   private final byte [] col3 = Bytes.toBytes("col3");
   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){
       System.out.println("SingleVersion");
@@ -57,8 +84,6 @@ implements HConstants {
     expected.add(MatchCode.INCLUDE);
     expected.add(MatchCode.DONE);
     int maxVersions = 1;
-    
-    ColumnTracker exp = new ExplicitColumnTracker(columns, maxVersions);
         
     //Create "Scanner"
     List<byte[]> scanner = new ArrayList<byte[]>();
@@ -67,23 +92,8 @@ implements HConstants {
     scanner.add(col3);
     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(){
@@ -119,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);
@@ -140,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);
   }
 
   /**
@@ -179,5 +173,21 @@ implements HConstants {
       explicit.checkColumn(col, 0, col.length);
     }
   }
+
+  /**
+   * 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