hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1329510 - in /hbase/branches/0.92: CHANGES.txt src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
Date Tue, 24 Apr 2012 00:03:25 GMT
Author: tedyu
Date: Tue Apr 24 00:03:24 2012
New Revision: 1329510

URL: http://svn.apache.org/viewvc?rev=1329510&view=rev
Log:
HBASE-5857  RIT map in RS not getting cleared while region opening (Chinna Rao)

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1329510&r1=1329509&r2=1329510&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Tue Apr 24 00:03:24 2012
@@ -45,6 +45,7 @@ Release 0.92.2 - Unreleased
    HBASE-5787  Table owner can't disable/delete its own table (Matteo)
    HBASE-5821  Incorrect handling of null value in Coprocessor aggregation function min()
(Maryann Xue)
    HBASE-5833  0.92 build has been failing pretty consistently on TestMasterFailover
+   HBASE-5857  RIT map in RS not getting cleared while region opening (Chinna Rao)
 
   IMPROVEMENTS
    HBASE-5592  Make it easier to get a table from shell (Ben West)

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1329510&r1=1329509&r2=1329510&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Tue Apr 24 00:03:24 2012
@@ -2483,9 +2483,9 @@ public class HRegionServer implements HR
     }
     LOG.info("Received request to open region: " +
       region.getRegionNameAsString());
+    HTableDescriptor htd = this.tableDescriptors.get(region.getTableName());
     this.regionsInTransitionInRS.putIfAbsent(region.getEncodedNameAsBytes(),
         true);
-    HTableDescriptor htd = this.tableDescriptors.get(region.getTableName());
     // Need to pass the expected version in the constructor.
     if (region.isRootRegion()) {
       this.service.submit(new OpenRootHandler(this, this, region, htd,

Modified: hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java?rev=1329510&r1=1329509&r2=1329510&view=diff
==============================================================================
--- hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
(original)
+++ hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
Tue Apr 24 00:03:24 2012
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HBaseTest
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.TableDescriptors;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -49,9 +50,13 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.internal.util.reflection.Whitebox;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Test open and close of regions using zk.
@@ -307,6 +312,30 @@ public class TestZKBasedOpenCloseRegion 
     }
     LOG.info("Done with testCloseRegion");
   }
+  
+  /**
+   * If region open fails with IOException in openRegion() while doing tableDescriptors.get()
+   * the region should not add into regionsInTransitionInRS map
+   * @throws Exception
+   */
+  @Test
+  public void testRegionOpenFailsDueToIOException() throws Exception {
+    HRegionInfo REGIONINFO = new HRegionInfo(Bytes.toBytes("t"),
+        HConstants.EMPTY_START_ROW, HConstants.EMPTY_START_ROW);
+    HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0);
+    TableDescriptors htd = Mockito.mock(TableDescriptors.class);
+    Object orizinalState = Whitebox.getInternalState(regionServer, "tableDescriptors");
+    Whitebox.setInternalState(regionServer, "tableDescriptors", htd);
+    Mockito.doThrow(new IOException()).when(htd).get((byte[]) Mockito.any());
+    try {
+      regionServer.openRegion(REGIONINFO);
+      fail("It should throw IOException ");
+    } catch (IOException e) {
+    }
+    Whitebox.setInternalState(regionServer, "tableDescriptors", orizinalState);
+    assertFalse("Region should not be in RIT",
+        regionServer.getRegionsInTransitionInRS().containsKey(REGIONINFO.getEncodedNameAsBytes()));
+  }
 
   private static void waitUntilAllRegionsAssigned()
   throws IOException {



Mime
View raw message