Skip to content

Commit b405a6f

Browse files
committed
Revert "HBASE-26941 LocalHBaseCluster.waitOnRegionServer should quit while thread is interrupted (#4333)"
This reverts commit f8b2ac0.
1 parent f8b2ac0 commit b405a6f

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public Configuration getConfiguration() {
300300
* Wait for the specified region server to stop. Removes this thread from list of running threads.
301301
* @return Name of region server that just went down.
302302
*/
303-
public String waitOnRegionServer(int serverNumber) throws InterruptedException {
303+
public String waitOnRegionServer(int serverNumber) {
304304
JVMClusterUtil.RegionServerThread regionServerThread = this.regionThreads.get(serverNumber);
305305
return waitOnRegionServer(regionServerThread);
306306
}
@@ -309,11 +309,14 @@ public String waitOnRegionServer(int serverNumber) throws InterruptedException {
309309
* Wait for the specified region server to stop. Removes this thread from list of running threads.
310310
* @return Name of region server that just went down.
311311
*/
312-
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst)
313-
throws InterruptedException {
312+
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
314313
while (rst.isAlive()) {
315-
LOG.info("Waiting on " + rst.getRegionServer().toString());
316-
rst.join();
314+
try {
315+
LOG.info("Waiting on " + rst.getRegionServer().toString());
316+
rst.join();
317+
} catch (InterruptedException e) {
318+
e.printStackTrace();
319+
}
317320
}
318321
regionThreads.remove(rst);
319322
return rst.getName();
@@ -369,7 +372,7 @@ public List<JVMClusterUtil.MasterThread> getLiveMasters() {
369372
* Wait for the specified master to stop. Removes this thread from list of running threads.
370373
* @return Name of master that just went down.
371374
*/
372-
public String waitOnMaster(int serverNumber) throws InterruptedException {
375+
public String waitOnMaster(int serverNumber) {
373376
JVMClusterUtil.MasterThread masterThread = this.masterThreads.get(serverNumber);
374377
return waitOnMaster(masterThread);
375378
}
@@ -378,10 +381,14 @@ public String waitOnMaster(int serverNumber) throws InterruptedException {
378381
* Wait for the specified master to stop. Removes this thread from list of running threads.
379382
* @return Name of master that just went down.
380383
*/
381-
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) throws InterruptedException {
384+
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
382385
while (masterThread.isAlive()) {
383-
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
384-
masterThread.join();
386+
try {
387+
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
388+
masterThread.join();
389+
} catch (InterruptedException e) {
390+
e.printStackTrace();
391+
}
385392
}
386393
masterThreads.remove(masterThread);
387394
return masterThread.getName();

hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.hadoop.hbase;
2020

2121
import java.io.IOException;
22-
import java.io.InterruptedIOException;
2322
import java.security.PrivilegedAction;
2423
import java.util.ArrayList;
2524
import java.util.HashSet;
@@ -310,11 +309,7 @@ public void resumeRegionServer(ServerName serverName) throws IOException {
310309
@Override
311310
public void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException {
312311
//ignore timeout for now
313-
try {
314-
waitOnRegionServer(getRegionServerIndex(serverName));
315-
} catch (InterruptedException e) {
316-
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
317-
}
312+
waitOnRegionServer(getRegionServerIndex(serverName));
318313
}
319314

320315
@Override
@@ -410,11 +405,7 @@ public void stopMaster(ServerName serverName) throws IOException {
410405
@Override
411406
public void waitForMasterToStop(ServerName serverName, long timeout) throws IOException {
412407
//ignore timeout for now
413-
try {
414-
waitOnMaster(getMasterIndex(serverName));
415-
} catch (InterruptedException e) {
416-
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
417-
}
408+
waitOnMaster(getMasterIndex(serverName));
418409
}
419410

420411
/**
@@ -545,7 +536,7 @@ public JVMClusterUtil.RegionServerThread resumeRegionServer(int serverNumber) {
545536
* @param serverNumber
546537
* @return Name of region server that just went down.
547538
*/
548-
public String waitOnRegionServer(final int serverNumber) throws InterruptedException {
539+
public String waitOnRegionServer(final int serverNumber) {
549540
return this.hbaseCluster.waitOnRegionServer(serverNumber);
550541
}
551542

@@ -656,7 +647,7 @@ public JVMClusterUtil.MasterThread stopMaster(int serverNumber,
656647
* @param serverNumber
657648
* @return Name of master that just went down.
658649
*/
659-
public String waitOnMaster(final int serverNumber) throws InterruptedException {
650+
public String waitOnMaster(final int serverNumber) {
660651
return this.hbaseCluster.waitOnMaster(serverNumber);
661652
}
662653

hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void teardown() throws Exception {
5959
}
6060

6161
@Test
62-
public void testInfo() throws InterruptedException {
62+
public void testInfo() {
6363
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
6464
MetricsMasterWrapperImpl info = new MetricsMasterWrapperImpl(master);
6565
assertEquals(

0 commit comments

Comments
 (0)