You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2012/11/29 01:15:40 UTC
svn commit: r1415006 -
/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Author: enis
Date: Thu Nov 29 00:15:39 2012
New Revision: 1415006
URL: http://svn.apache.org/viewvc?rev=1415006&view=rev
Log:
HBASE-7235 TestMasterObserver is flaky
Modified:
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1415006&r1=1415005&r2=1415006&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java Thu Nov 29 00:15:39 2012
@@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.master.HM
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Threads;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -541,7 +542,7 @@ public class TestMasterObserver {
// modify table
htd.setMaxFileSize(512 * 1024 * 1024);
- admin.modifyTable(TEST_TABLE, htd);
+ modifyTableSync(admin, TEST_TABLE, htd);
// preModifyTable can't bypass default action.
assertTrue("Test table should have been modified",
cp.wasModifyTableCalled());
@@ -584,7 +585,7 @@ public class TestMasterObserver {
// modify table
htd.setMaxFileSize(512 * 1024 * 1024);
- admin.modifyTable(TEST_TABLE, htd);
+ modifyTableSync(admin, TEST_TABLE, htd);
assertTrue("Test table should have been modified",
cp.wasModifyTableCalled());
@@ -629,6 +630,19 @@ public class TestMasterObserver {
cp.wasDeleteTableCalled());
}
+ private void modifyTableSync(HBaseAdmin admin, byte[] tableName, HTableDescriptor htd)
+ throws IOException {
+ admin.modifyTable(tableName, htd);
+ //wait until modify table finishes
+ for (int t = 0; t < 100; t++) { //10 sec timeout
+ HTableDescriptor td = admin.getTableDescriptor(htd.getName());
+ if (td.equals(htd)) {
+ break;
+ }
+ Threads.sleep(100);
+ }
+ }
+
@Test
public void testRegionTransitionOperations() throws Exception {
MiniHBaseCluster cluster = UTIL.getHBaseCluster();