You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2012/09/16 14:50:15 UTC

svn commit: r1385255 - in /hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase: TestDuplicateNotifications.java TestRegionRebalancing.java

Author: mbautin
Date: Sun Sep 16 12:50:14 2012
New Revision: 1385255

URL: http://svn.apache.org/viewvc?rev=1385255&view=rev
Log:
[HBASE-6741] Move testRebalancingWithDuplicateNotification to a different test class

Author: aaiyer

Summary:
TestRegionRebalancing is behaving flakiely.  The test passes on macbook. But
sometimes fails on linux box.

Each test individually passes, but when run in the same unit test, there is a
out of memory error.

We could try increasing the memory allocated to the tests. Or move
the new test to a different file. Doing the latter.

Test Plan:
run MR tests

Failed on MR:

TestChangingEncoding TestClusterStartupDetection TestDistributedLock TestHsHaServerCmdLine TestMasterWithDisabling TestMultiClusters TestNativeThriftClient TestRegionStateOnMasterFailure TestSchemaModificationLocks TestZKBasedReopenRegion TestZooKeeper

Failed on Local: None

Reviewers: mbautin

Reviewed By: mbautin

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D574832

Added:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestDuplicateNotifications.java
Modified:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java

Added: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestDuplicateNotifications.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestDuplicateNotifications.java?rev=1385255&view=auto
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestDuplicateNotifications.java (added)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestDuplicateNotifications.java Sun Sep 16 12:50:14 2012
@@ -0,0 +1,70 @@
+/**
+ * Copyright The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional infomation
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Put;
+
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.DuplicateZKNotificationInjectionHandler;
+import org.apache.hadoop.hbase.util.InjectionEvent;
+import org.apache.hadoop.hbase.util.InjectionHandler;
+import org.apache.hadoop.hbase.util.JVMClusterUtil;
+
+/**
+ * Test whether region opening works inspite of duplicate opened notifications.
+ */
+public class TestDuplicateNotifications extends TestRegionRebalancing {
+  DuplicateZKNotificationInjectionHandler duplicator =
+      new DuplicateZKNotificationInjectionHandler();
+
+
+  /**
+   * Make sure we can handle duplicate notifications for region
+   * being opened. Same as testRebalancing -- but we will duplicate
+   * some of the notifications.
+   * @throws Exception
+   *
+   * @throws IOException
+   */
+  @Override
+  protected void setUp() throws Exception {
+    super.setUp();
+    duplicator.setProbability(0.05);
+    duplicator.duplicateEvent(InjectionEvent.ZKUNASSIGNEDWATCHER_REGION_OPENED);
+    InjectionHandler.set(duplicator);
+  }
+
+  @Override
+  protected void tearDown() {
+    // make sure that some events did get duplicated.
+    assertTrue(duplicator.getDuplicatedEventCnt() > 0);
+  }
+}
+

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java?rev=1385255&r1=1385254&r2=1385255&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java Sun Sep 16 12:50:14 2012
@@ -119,26 +119,6 @@ public class TestRegionRebalancing exten
     assertRegionsAreBalanced();
   }
 
-  /**
-   * Make sure we can handle duplicate notifications for region
-   * being opened. Same as testRebalancing -- but we will duplicate
-   * some of the notifications.
-   *
-   * @throws IOException
-   */
-  public void testRebalancingWithDuplicateNotification() throws IOException {
-    DuplicateZKNotificationInjectionHandler duplicator =
-      new DuplicateZKNotificationInjectionHandler();
-    duplicator.setProbability(0.05);
-    duplicator.duplicateEvent(InjectionEvent.ZKUNASSIGNEDWATCHER_REGION_OPENED);
-    InjectionHandler.set(duplicator);
-
-    testRebalancing();
-
-    // make sure that some events did get duplicated.
-    assertTrue(duplicator.getDuplicatedEventCnt() > 0);
-  }
-
   private void checkingServerStatus() {
     List<HRegionServer> servers = getOnlineRegionServers();
     double avg = cluster.getMaster().getAverageLoad();