hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raw...@apache.org
Subject svn commit: r1066144 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
Date Tue, 01 Feb 2011 19:13:41 GMT
Author: rawson
Date: Tue Feb  1 19:13:41 2011
New Revision: 1066144

URL: http://svn.apache.org/viewvc?rev=1066144&view=rev
Log:
HBASE-3494  checkAndPut implementation doesnt verify row param and writable row are the same

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1066144&r1=1066143&r2=1066144&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Tue Feb  1 19:13:41 2011
@@ -12,6 +12,8 @@ Release 0.90.1 - Unreleased
    HBASE-3493  HMaster sometimes hangs during initialization due to missing
                notify call (Bruno Dumon via Stack)
    HBASE-3483  Memstore lower limit should trigger asynchronous flushes
+   HBASE-3494  checkAndPut implementation doesnt verify row param and writable 
+   	       row are the same
 
   IMPROVEMENTS
    HBASE-3305  Allow round-robin distribution for table created with

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1066144&r1=1066143&r2=1066144&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Tue
Feb  1 19:13:41 2011
@@ -67,6 +67,7 @@ import org.apache.hadoop.hbase.client.Ge
 import org.apache.hadoop.hbase.client.Increment;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Row;
 import org.apache.hadoop.hbase.client.RowLock;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.filter.Filter;
@@ -1520,7 +1521,11 @@ public class HRegion implements HeapSize
     checkResources();
     boolean isPut = w instanceof Put;
     if (!isPut && !(w instanceof Delete))
-      throw new IOException("Action must be Put or Delete");
+      throw new DoNotRetryIOException("Action must be Put or Delete");
+    Row r = (Row)w;
+    if (Bytes.compareTo(row, r.getRow()) != 0) {
+      throw new DoNotRetryIOException("Action's getRow must match the passed row");
+    }
 
     startRegionOperation();
     try {

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=1066144&r1=1066143&r2=1066144&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
Tue Feb  1 19:13:41 2011
@@ -34,6 +34,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -96,6 +97,8 @@ public class TestHRegion extends HBaseTe
   protected final byte[] value1 = Bytes.toBytes("value1");
   protected final byte[] value2 = Bytes.toBytes("value2");
   protected final byte [] row = Bytes.toBytes("rowA");
+  protected final byte [] row2 = Bytes.toBytes("rowB");
+
 
   /**
    * @see org.apache.hadoop.hbase.HBaseTestCase#setUp()
@@ -605,6 +608,20 @@ public class TestHRegion extends HBaseTe
 
   }
 
+  public void testCheckAndPut_wrongRowInPut() throws IOException {
+    initHRegion(tableName, this.getName(), COLUMNS);
+
+    Put put = new Put(row2);
+    put.add(fam1, qual1, value1);
+    try {
+    boolean res = region.checkAndMutate(row,
+        fam1, qual1, value2, put, null, false);
+      fail();
+    } catch (DoNotRetryIOException expected) {
+      // expected exception.
+    }
+  }
+
   public void testCheckAndDelete_ThatDeleteWasWritten() throws IOException{
     byte [] tableName = Bytes.toBytes("testtable");
     byte [] row1 = Bytes.toBytes("row1");



Mime
View raw message