Skip to content

Commit

Permalink
Revert "HBASE-26941 LocalHBaseCluster.waitOnRegionServer should quit …
Browse files Browse the repository at this point in the history
…while thread is interrupted (apache#4333)"

This reverts commit c10e4bd.

(cherry picked from commit 1fc1866)
Change-Id: I5b90b9ebe1ff9ded85b68513f3c931b061e46642
  • Loading branch information
Apache9 committed Apr 14, 2022
1 parent 706d305 commit a3e86d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public Configuration getConfiguration() {
* Wait for the specified region server to stop. Removes this thread from list of running threads.
* @return Name of region server that just went down.
*/
public String waitOnRegionServer(int serverNumber) throws InterruptedException {
public String waitOnRegionServer(int serverNumber) {
JVMClusterUtil.RegionServerThread regionServerThread = this.regionThreads.get(serverNumber);
return waitOnRegionServer(regionServerThread);
}
Expand All @@ -309,11 +309,14 @@ public String waitOnRegionServer(int serverNumber) throws InterruptedException {
* Wait for the specified region server to stop. Removes this thread from list of running threads.
* @return Name of region server that just went down.
*/
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst)
throws InterruptedException {
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst) {
while (rst.isAlive()) {
LOG.info("Waiting on " + rst.getRegionServer().toString());
rst.join();
try {
LOG.info("Waiting on " + rst.getRegionServer().toString());
rst.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
regionThreads.remove(rst);
return rst.getName();
Expand Down Expand Up @@ -369,7 +372,7 @@ public List<JVMClusterUtil.MasterThread> getLiveMasters() {
* Wait for the specified master to stop. Removes this thread from list of running threads.
* @return Name of master that just went down.
*/
public String waitOnMaster(int serverNumber) throws InterruptedException {
public String waitOnMaster(int serverNumber) {
JVMClusterUtil.MasterThread masterThread = this.masterThreads.get(serverNumber);
return waitOnMaster(masterThread);
}
Expand All @@ -378,10 +381,14 @@ public String waitOnMaster(int serverNumber) throws InterruptedException {
* Wait for the specified master to stop. Removes this thread from list of running threads.
* @return Name of master that just went down.
*/
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) throws InterruptedException {
public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
while (masterThread.isAlive()) {
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
masterThread.join();
try {
LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
masterThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
masterThreads.remove(masterThread);
return masterThread.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.hadoop.hbase;

import java.io.IOException;
import java.io.InterruptedIOException;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -309,11 +308,7 @@ public void resumeRegionServer(ServerName serverName) throws IOException {
@Override
public void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException {
//ignore timeout for now
try {
waitOnRegionServer(getRegionServerIndex(serverName));
} catch (InterruptedException e) {
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
}
waitOnRegionServer(getRegionServerIndex(serverName));
}

@Override
Expand Down Expand Up @@ -409,11 +404,7 @@ public void stopMaster(ServerName serverName) throws IOException {
@Override
public void waitForMasterToStop(ServerName serverName, long timeout) throws IOException {
//ignore timeout for now
try {
waitOnMaster(getMasterIndex(serverName));
} catch (InterruptedException e) {
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
}
waitOnMaster(getMasterIndex(serverName));
}

/**
Expand Down Expand Up @@ -544,7 +535,7 @@ public JVMClusterUtil.RegionServerThread resumeRegionServer(int serverNumber) {
* @param serverNumber
* @return Name of region server that just went down.
*/
public String waitOnRegionServer(final int serverNumber) throws InterruptedException {
public String waitOnRegionServer(final int serverNumber) {
return this.hbaseCluster.waitOnRegionServer(serverNumber);
}

Expand Down Expand Up @@ -655,7 +646,7 @@ public JVMClusterUtil.MasterThread stopMaster(int serverNumber,
* @param serverNumber
* @return Name of master that just went down.
*/
public String waitOnMaster(final int serverNumber) throws InterruptedException {
public String waitOnMaster(final int serverNumber) {
return this.hbaseCluster.waitOnMaster(serverNumber);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void teardown() throws Exception {
}

@Test
public void testInfo() throws InterruptedException {
public void testInfo() {
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
MetricsMasterWrapperImpl info = new MetricsMasterWrapperImpl(master);
assertEquals(
Expand Down

0 comments on commit a3e86d7

Please sign in to comment.