Skip to content

Commit b7ffb56

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

File tree

4 files changed

+28
-36
lines changed

4 files changed

+28
-36
lines changed

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

Lines changed: 19 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,15 @@ 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+
LOG.error("Interrupted while waiting for {} to finish. Retrying join", rst.getName(), e);
319+
Thread.currentThread().interrupt();
320+
}
317321
}
318322
regionThreads.remove(rst);
319323
return rst.getName();
@@ -369,7 +373,7 @@ public List<JVMClusterUtil.MasterThread> getLiveMasters() {
369373
* Wait for the specified master to stop. Removes this thread from list of running threads.
370374
* @return Name of master that just went down.
371375
*/
372-
public String waitOnMaster(int serverNumber) throws InterruptedException {
376+
public String waitOnMaster(int serverNumber) {
373377
JVMClusterUtil.MasterThread masterThread = this.masterThreads.get(serverNumber);
374378
return waitOnMaster(masterThread);
375379
}
@@ -378,10 +382,16 @@ public String waitOnMaster(int serverNumber) throws InterruptedException {
378382
* Wait for the specified master to stop. Removes this thread from list of running threads.
379383
* @return Name of master that just went down.
380384
*/
381-
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) throws InterruptedException {
385+
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
382386
while (masterThread.isAlive()) {
383-
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
384-
masterThread.join();
387+
try {
388+
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
389+
masterThread.join();
390+
} catch (InterruptedException e) {
391+
LOG.error("Interrupted while waiting for {} to finish. Retrying join",
392+
masterThread.getName(), e);
393+
Thread.currentThread().interrupt();
394+
}
385395
}
386396
masterThreads.remove(masterThread);
387397
return masterThread.getName();

hbase-server/src/test/java/org/apache/hadoop/hbase/SingleProcessHBaseCluster.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;
@@ -298,11 +297,7 @@ public void resumeRegionServer(ServerName serverName) throws IOException {
298297
@Override
299298
public void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException {
300299
// ignore timeout for now
301-
try {
302-
waitOnRegionServer(getRegionServerIndex(serverName));
303-
} catch (InterruptedException e) {
304-
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
305-
}
300+
waitOnRegionServer(getRegionServerIndex(serverName));
306301
}
307302

308303
@Override
@@ -398,11 +393,7 @@ public void stopMaster(ServerName serverName) throws IOException {
398393
@Override
399394
public void waitForMasterToStop(ServerName serverName, long timeout) throws IOException {
400395
// ignore timeout for now
401-
try {
402-
waitOnMaster(getMasterIndex(serverName));
403-
} catch (InterruptedException e) {
404-
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
405-
}
396+
waitOnMaster(getMasterIndex(serverName));
406397
}
407398

408399
/**
@@ -518,7 +509,7 @@ public JVMClusterUtil.RegionServerThread resumeRegionServer(int serverNumber) {
518509
* Wait for the specified region server to stop. Removes this thread from list of running threads.
519510
* @return Name of region server that just went down.
520511
*/
521-
public String waitOnRegionServer(final int serverNumber) throws InterruptedException {
512+
public String waitOnRegionServer(final int serverNumber) {
522513
return this.hbaseCluster.waitOnRegionServer(serverNumber);
523514
}
524515

@@ -610,7 +601,7 @@ public JVMClusterUtil.MasterThread stopMaster(int serverNumber, final boolean sh
610601
* Wait for the specified master to stop. Removes this thread from list of running threads.
611602
* @return Name of master that just went down.
612603
*/
613-
public String waitOnMaster(final int serverNumber) throws InterruptedException {
604+
public String waitOnMaster(final int serverNumber) {
614605
return this.hbaseCluster.waitOnMaster(serverNumber);
615606
}
616607

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
@@ -70,7 +70,7 @@ public static void teardown() throws Exception {
7070
}
7171

7272
@Test
73-
public void testInfo() throws InterruptedException {
73+
public void testInfo() {
7474
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
7575
MetricsMasterWrapperImpl info = new MetricsMasterWrapperImpl(master);
7676
assertEquals(

hbase-testing-util/src/main/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;
@@ -311,11 +310,7 @@ public void resumeRegionServer(ServerName serverName) throws IOException {
311310
@Override
312311
public void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException {
313312
//ignore timeout for now
314-
try {
315-
waitOnRegionServer(getRegionServerIndex(serverName));
316-
} catch (InterruptedException e) {
317-
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
318-
}
313+
waitOnRegionServer(getRegionServerIndex(serverName));
319314
}
320315

321316
@Override
@@ -411,11 +406,7 @@ public void stopMaster(ServerName serverName) throws IOException {
411406
@Override
412407
public void waitForMasterToStop(ServerName serverName, long timeout) throws IOException {
413408
//ignore timeout for now
414-
try {
415-
waitOnMaster(getMasterIndex(serverName));
416-
} catch (InterruptedException e) {
417-
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
418-
}
409+
waitOnMaster(getMasterIndex(serverName));
419410
}
420411

421412
/**
@@ -544,7 +535,7 @@ public JVMClusterUtil.RegionServerThread resumeRegionServer(int serverNumber) {
544535
* @param serverNumber
545536
* @return Name of region server that just went down.
546537
*/
547-
public String waitOnRegionServer(final int serverNumber) throws InterruptedException {
538+
public String waitOnRegionServer(final int serverNumber) {
548539
return this.hbaseCluster.waitOnRegionServer(serverNumber);
549540
}
550541

@@ -649,7 +640,7 @@ public JVMClusterUtil.MasterThread stopMaster(int serverNumber,
649640
* @param serverNumber
650641
* @return Name of master that just went down.
651642
*/
652-
public String waitOnMaster(final int serverNumber) throws InterruptedException {
643+
public String waitOnMaster(final int serverNumber) {
653644
return this.hbaseCluster.waitOnMaster(serverNumber);
654645
}
655646

0 commit comments

Comments
 (0)