hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1351423 - in /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase: coprocessor/ master/ util/
Date Mon, 18 Jun 2012 17:47:46 GMT
Author: jxiang
Date: Mon Jun 18 17:47:46 2012
New Revision: 1351423

URL: http://svn.apache.org/viewvc?rev=1351423&view=rev
Log:
HBASE-6202 Medium tests fail with jdk1.7

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestEnvironmentEdgeManager.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1351423&r1=1351422&r2=1351423&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Mon Jun 18 17:47:46 2012
@@ -235,7 +235,9 @@ public class TestClassLoading {
       "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
     HBaseAdmin admin = new HBaseAdmin(this.conf);
     if (admin.tableExists(tableName)) {
-      admin.disableTable(tableName);
+      if (admin.isTableEnabled(tableName)) {
+        admin.disableTable(tableName);
+      }
       admin.deleteTable(tableName);
     }
     admin.createTable(htd);
@@ -337,7 +339,9 @@ public class TestClassLoading {
 
     HBaseAdmin admin = new HBaseAdmin(this.conf);
     if (admin.tableExists(tableName)) {
-      admin.disableTable(tableName);
+      if (admin.isTableEnabled(tableName)) {
+        admin.disableTable(tableName);
+      }
       admin.deleteTable(tableName);
     }
     admin.createTable(htd);
@@ -439,7 +443,9 @@ public class TestClassLoading {
       "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
     HBaseAdmin admin = new HBaseAdmin(this.conf);
     if (admin.tableExists(tableName)) {
-      admin.disableTable(tableName);
+      if (admin.isTableEnabled(tableName)) {
+        admin.disableTable(tableName);
+      }
       admin.deleteTable(tableName);
     }
     admin.createTable(htd);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1351423&r1=1351422&r2=1351423&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Mon Jun 18 17:47:46 2012
@@ -916,75 +916,87 @@ public class TestMasterObserver {
     cp.resetStates();
 
     HTable table = UTIL.createTable(TEST_TABLE, TEST_FAMILY);
-    int countOfRegions = UTIL.createMultiRegions(table, TEST_FAMILY);
-    UTIL.waitUntilAllRegionsAssigned(countOfRegions);
 
-    NavigableMap<HRegionInfo, ServerName> regions = table.getRegionLocations();
-    Map.Entry<HRegionInfo, ServerName> firstGoodPair = null;
-    for (Map.Entry<HRegionInfo, ServerName> e: regions.entrySet()) {
-      if (e.getValue() != null) {
-        firstGoodPair = e;
-        break;
+    try {
+      int countOfRegions = UTIL.createMultiRegions(table, TEST_FAMILY);
+      UTIL.waitUntilAllRegionsAssigned(countOfRegions);
+  
+      NavigableMap<HRegionInfo, ServerName> regions = table.getRegionLocations();
+      Map.Entry<HRegionInfo, ServerName> firstGoodPair = null;
+      for (Map.Entry<HRegionInfo, ServerName> e: regions.entrySet()) {
+        if (e.getValue() != null) {
+          firstGoodPair = e;
+          break;
+        }
       }
-    }
-    assertNotNull("Found a non-null entry", firstGoodPair);
-    LOG.info("Found " + firstGoodPair.toString());
-    // Try to force a move
-    Collection<ServerName> servers = master.getClusterStatus().getServers();
-    String destName = null;
-    String serverNameForFirstRegion = firstGoodPair.getValue().toString();
-    LOG.info("serverNameForFirstRegion=" + serverNameForFirstRegion);
-    boolean found = false;
-    // Find server that is NOT carrying the first region
-    for (ServerName info : servers) {
-      LOG.info("ServerName=" + info);
-      if (!serverNameForFirstRegion.equals(info.getServerName())) {
-        destName = info.toString();
-        found = true;
-        break;
+      assertNotNull("Found a non-null entry", firstGoodPair);
+      LOG.info("Found " + firstGoodPair.toString());
+      // Try to force a move
+      Collection<ServerName> servers = master.getClusterStatus().getServers();
+      String destName = null;
+      String serverNameForFirstRegion = firstGoodPair.getValue().toString();
+      LOG.info("serverNameForFirstRegion=" + serverNameForFirstRegion);
+      boolean found = false;
+      // Find server that is NOT carrying the first region
+      for (ServerName info : servers) {
+        LOG.info("ServerName=" + info);
+        if (!serverNameForFirstRegion.equals(info.getServerName())) {
+          destName = info.toString();
+          found = true;
+          break;
+        }
       }
-    }
-    assertTrue("Found server", found);
-    LOG.info("Found " + destName);
-    master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
-      firstGoodPair.getKey().getEncodedNameAsBytes(),Bytes.toBytes(destName)));
-    assertTrue("Coprocessor should have been called on region move",
-      cp.wasMoveCalled());
-
-    // make sure balancer is on
-    master.balanceSwitch(true);
-    assertTrue("Coprocessor should have been called on balance switch",
-        cp.wasBalanceSwitchCalled());
-
-    // force region rebalancing
-    master.balanceSwitch(false);
-    // move half the open regions from RS 0 to RS 1
-    HRegionServer rs = cluster.getRegionServer(0);
-    byte[] destRS = Bytes.toBytes(cluster.getRegionServer(1).getServerName().toString());
-    List<HRegionInfo> openRegions = ProtobufUtil.getOnlineRegions(rs);
-    int moveCnt = openRegions.size()/2;
-    for (int i=0; i<moveCnt; i++) {
-      HRegionInfo info = openRegions.get(i);
-      if (!info.isMetaTable()) {
-        master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
-          openRegions.get(i).getEncodedNameAsBytes(), destRS));
+      assertTrue("Found server", found);
+      LOG.info("Found " + destName);
+      master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
+        firstGoodPair.getKey().getEncodedNameAsBytes(),Bytes.toBytes(destName)));
+      assertTrue("Coprocessor should have been called on region move",
+        cp.wasMoveCalled());
+  
+      // make sure balancer is on
+      master.balanceSwitch(true);
+      assertTrue("Coprocessor should have been called on balance switch",
+          cp.wasBalanceSwitchCalled());
+  
+      // turn balancer off
+      master.balanceSwitch(false);
+  
+      // wait for assignments to finish, if any
+      AssignmentManager mgr = master.getAssignmentManager();
+      Collection<AssignmentManager.RegionState> transRegions =
+          mgr.copyRegionsInTransition().values();
+      for (AssignmentManager.RegionState state : transRegions) {
+        mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
       }
+  
+      // move half the open regions from RS 0 to RS 1
+      HRegionServer rs = cluster.getRegionServer(0);
+      byte[] destRS = Bytes.toBytes(cluster.getRegionServer(1).getServerName().toString());
+      List<HRegionInfo> openRegions = ProtobufUtil.getOnlineRegions(rs);
+      int moveCnt = openRegions.size()/2;
+      for (int i=0; i<moveCnt; i++) {
+        HRegionInfo info = openRegions.get(i);
+        if (!info.isMetaTable()) {
+          master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
+            openRegions.get(i).getEncodedNameAsBytes(), destRS));
+        }
+      }
+  
+      // wait for assignments to finish
+      transRegions = mgr.copyRegionsInTransition().values();
+      for (AssignmentManager.RegionState state : transRegions) {
+        mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
+      }
+  
+      // now trigger a balance
+      master.balanceSwitch(true);
+      boolean balanceRun = master.balance();
+      assertTrue("Coprocessor should be called on region rebalancing",
+          cp.wasBalanceCalled());
+      table.close();
+    } finally {
+      UTIL.deleteTable(TEST_TABLE);
     }
-
-    // wait for assignments to finish
-    AssignmentManager mgr = master.getAssignmentManager();
-    Collection<AssignmentManager.RegionState> transRegions =
-        mgr.copyRegionsInTransition().values();
-    for (AssignmentManager.RegionState state : transRegions) {
-      mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
-    }
-
-    // now trigger a balance
-    master.balanceSwitch(true);
-    boolean balanceRun = master.balance();
-    assertTrue("Coprocessor should be called on region rebalancing",
-        cp.wasBalanceCalled());
-    table.close();
   }
 
   @org.junit.Rule

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java?rev=1351423&r1=1351422&r2=1351423&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java
Mon Jun 18 17:47:46 2012
@@ -83,8 +83,7 @@ public class TestSplitLogManager {
   private SplitLogManager slm;
   private Configuration conf;
 
-  private final static HBaseTestingUtility TEST_UTIL =
-    new HBaseTestingUtility();
+  private static HBaseTestingUtility TEST_UTIL;
 
   /**
    * Additional amount of time we wait for events to happen. Added where unit
@@ -115,6 +114,7 @@ public class TestSplitLogManager {
 
   @Before
   public void setup() throws Exception {
+    TEST_UTIL = new HBaseTestingUtility();
     TEST_UTIL.startMiniZKCluster();
     conf = TEST_UTIL.getConfiguration();
     // Use a different ZK wrapper instance for each tests.
@@ -222,7 +222,6 @@ public class TestSplitLogManager {
     conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
     to = to + 2 * 100;
 
-
     slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
     slm.finishInitialization();
     waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
@@ -504,7 +503,12 @@ public class TestSplitLogManager {
   @Test(timeout=45000)
   public void testVanishingTaskZNode() throws Exception {
     LOG.info("testVanishingTaskZNode");
+
+    int to = 1000;
+    conf.setInt("hbase.splitlog.manager.timeout", to);
+    conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
     conf.setInt("hbase.splitlog.manager.unassigned.timeout", 0);
+
     slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
     slm.finishInitialization();
     FileSystem fs = TEST_UTIL.getTestFileSystem();

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestEnvironmentEdgeManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestEnvironmentEdgeManager.java?rev=1351423&r1=1351422&r2=1351423&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestEnvironmentEdgeManager.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestEnvironmentEdgeManager.java
Mon Jun 18 17:47:46 2012
@@ -37,6 +37,7 @@ public class TestEnvironmentEdgeManager 
 
   @Test
   public void testManageSingleton() {
+    EnvironmentEdgeManager.reset();
     EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate();
     assertNotNull(edge);
     assertTrue(edge instanceof DefaultEnvironmentEdge);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java?rev=1351423&r1=1351422&r2=1351423&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
Mon Jun 18 17:47:46 2012
@@ -54,7 +54,7 @@ public class TestFSTableDescriptors {
 
   @Test
   public void testCreateAndUpdate() throws IOException {
-    Path testdir = UTIL.getDataTestDir();
+    Path testdir = UTIL.getDataTestDir("testCreateAndUpdate");
     HTableDescriptor htd = new HTableDescriptor("testCreate");
     FileSystem fs = FileSystem.get(UTIL.getConfiguration());
     assertTrue(FSTableDescriptors.createTableDescriptor(fs, testdir, htd));



Mime
View raw message