HBASE-19927 Addendum join on RegionServerThread instead of HRegionServer

This commit is contained in:
zhangduo 2018-02-06 10:01:23 +08:00
parent 5905415f9c
commit 8b6b3326a6
2 changed files with 6 additions and 6 deletions

View File

@ -2635,11 +2635,10 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
* Expire a region server's session * Expire a region server's session
* @param index which RS * @param index which RS
*/ */
public HRegionServer expireRegionServerSession(int index) throws Exception { public void expireRegionServerSession(int index) throws Exception {
HRegionServer rs = getMiniHBaseCluster().getRegionServer(index); HRegionServer rs = getMiniHBaseCluster().getRegionServer(index);
expireSession(rs.getZooKeeper(), false); expireSession(rs.getZooKeeper(), false);
decrementMinRegionServerCount(); decrementMinRegionServerCount();
return rs;
} }
private void decrementMinRegionServerCount() { private void decrementMinRegionServerCount() {

View File

@ -22,10 +22,10 @@ import static org.junit.Assert.assertEquals;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Waiter.ExplainingPredicate; import org.apache.hadoop.hbase.Waiter.ExplainingPredicate;
import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MiscTests; import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -81,19 +81,20 @@ public class TestFullLogReconstruction {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
TEST_UTIL.loadTable(table, FAMILY); TEST_UTIL.loadTable(table, FAMILY);
} }
HRegionServer rs = TEST_UTIL.expireRegionServerSession(0); RegionServerThread rsThread = TEST_UTIL.getHBaseCluster().getRegionServerThreads().get(0);
TEST_UTIL.expireRegionServerSession(0);
// make sure that the RS is fully down before reading, so that we will read the data from other // make sure that the RS is fully down before reading, so that we will read the data from other
// RSes. // RSes.
TEST_UTIL.waitFor(30000, new ExplainingPredicate<Exception>() { TEST_UTIL.waitFor(30000, new ExplainingPredicate<Exception>() {
@Override @Override
public boolean evaluate() throws Exception { public boolean evaluate() throws Exception {
return !rs.isAlive(); return !rsThread.isAlive();
} }
@Override @Override
public String explainFailure() throws Exception { public String explainFailure() throws Exception {
return rs + " is still alive"; return rsThread.getRegionServer() + " is still alive";
} }
}); });