hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1588609 - /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
Date Sat, 19 Apr 2014 05:16:18 GMT
Author: larsh
Date: Sat Apr 19 05:16:17 2014
New Revision: 1588609

URL: http://svn.apache.org/r1588609
Log:
HBASE-11037 Race condition in TestZKBasedOpenCloseRegion.

Modified:
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java?rev=1588609&r1=1588608&r2=1588609&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
(original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
Sat Apr 19 05:16:17 2014
@@ -28,6 +28,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -213,40 +214,6 @@ public class TestZKBasedOpenCloseRegion 
     }
   }
 
-  public static class CloseRegionEventListener implements EventHandlerListener {
-    private static final Log LOG = LogFactory.getLog(CloseRegionEventListener.class);
-    String regionToClose;
-    AtomicBoolean closeEventProcessed;
-
-    public CloseRegionEventListener(String regionToClose,
-        AtomicBoolean closeEventProcessed) {
-      this.regionToClose = regionToClose;
-      this.closeEventProcessed = closeEventProcessed;
-    }
-
-    @Override
-    public void afterProcess(EventHandler event) {
-      LOG.info("afterProcess(" + event + ")");
-      if(event.getEventType() == EventType.RS_ZK_REGION_CLOSED) {
-        LOG.info("Finished processing CLOSE REGION");
-        TotesHRegionInfo hriCarrier = (TotesHRegionInfo)event;
-        if (regionToClose.equals(hriCarrier.getHRegionInfo().getRegionNameAsString())) {
-          LOG.info("Setting closeEventProcessed flag");
-          closeEventProcessed.set(true);
-        } else {
-          LOG.info("Region to close didn't match");
-        }
-      }
-    }
-
-    @Override
-    public void beforeProcess(EventHandler event) {
-      if(event.getEventType() == EventType.M_RS_CLOSE_REGION) {
-        LOG.info("Received CLOSE RPC and beginning to process it");
-      }
-    }
-  }
-
   /**
    * This test shows how a region won't be able to be assigned to a RS
    * if it's already "processing" it.
@@ -308,31 +275,6 @@ public class TestZKBasedOpenCloseRegion 
 
   }
 
-  @Test (timeout=300000) public void testCloseRegion()
-  throws Exception {
-    LOG.info("Running testCloseRegion");
-    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
-    LOG.info("Number of region servers = " + cluster.getLiveRegionServerThreads().size());
-
-    int rsIdx = 0;
-    HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(rsIdx);
-    HRegionInfo hri = getNonMetaRegion(regionServer.getOnlineRegions());
-    LOG.debug("Asking RS to close region " + hri.getRegionNameAsString());
-
-    AtomicBoolean closeEventProcessed = new AtomicBoolean(false);
-    EventHandlerListener listener =
-      new CloseRegionEventListener(hri.getRegionNameAsString(),
-          closeEventProcessed);
-    cluster.getMaster().executorService.registerListener(EventType.RS_ZK_REGION_CLOSED, listener);
-
-    cluster.getMaster().assignmentManager.unassign(hri);
-
-    while (!closeEventProcessed.get()) {
-      Threads.sleep(100);
-    }
-    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
@@ -410,7 +352,7 @@ public class TestZKBasedOpenCloseRegion 
       // If start key, add 'aaa'.
       byte [] row = getStartKey(hri);
       Put p = new Put(row);
-      p.setWriteToWAL(false);
+      p.setDurability(Durability.SKIP_WAL);
       p.add(getTestFamily(), getTestQualifier(), row);
       t.put(p);
       rows++;
@@ -435,16 +377,6 @@ public class TestZKBasedOpenCloseRegion 
     return getTestFamily();
   }
 
-  public static void main(String args[]) throws Exception {
-    TestZKBasedOpenCloseRegion.beforeAllTests();
-
-    TestZKBasedOpenCloseRegion test = new TestZKBasedOpenCloseRegion();
-    test.setup();
-    test.testCloseRegion();
-
-    TestZKBasedOpenCloseRegion.afterAllTests();
-  }
-
   @org.junit.Rule
   public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
     new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();



Mime
View raw message