HBASE-4153 Ramkrishna's fix for TestZKBasedOpenCloseRegion#testRSAlreadyProcessingRegion
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1174105 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2fd0a26de9
commit
083d104243
|
@ -20,13 +20,12 @@
|
|||
package org.apache.hadoop.hbase.regionserver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.hadoop.hbase.catalog.CatalogTracker;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServer;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.HLog;
|
||||
import org.apache.zookeeper.KeeperException;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
/**
|
||||
* Services provided by {@link HRegionServer}
|
||||
|
@ -77,6 +76,6 @@ public interface RegionServerServices extends OnlineRegions {
|
|||
* Get the regions that are currently being opened or closed in the RS
|
||||
* @return map of regions in transition in this RS
|
||||
*/
|
||||
public ConcurrentSkipListMap<byte[], Boolean> getRegionsInTransitionInRS();
|
||||
public Map<byte[], Boolean> getRegionsInTransitionInRS();
|
||||
|
||||
}
|
||||
|
|
|
@ -257,21 +257,29 @@ public class TestZKBasedOpenCloseRegion {
|
|||
// make sure the region came back
|
||||
assertEquals(hr1.getOnlineRegion(hri.getEncodedNameAsBytes()), null);
|
||||
|
||||
|
||||
// remove the block and reset the boolean
|
||||
hr1.getRegionsInTransitionInRS().remove(hri.getEncodedNameAsBytes());
|
||||
reopenEventProcessed.set(false);
|
||||
|
||||
// now try moving a region when there is no region in transition.
|
||||
hri = getNonMetaRegion(hr1.getOnlineRegions());
|
||||
|
||||
// move the region again, but this time it will work
|
||||
openListener =
|
||||
new ReopenEventListener(hri.getRegionNameAsString(),
|
||||
reopenEventProcessed, EventType.RS_ZK_REGION_OPENED);
|
||||
|
||||
cluster.getMaster().executorService.
|
||||
registerListener(EventType.RS_ZK_REGION_OPENED, openListener);
|
||||
|
||||
TEST_UTIL.getHBaseAdmin().move(hri.getEncodedNameAsBytes(),
|
||||
Bytes.toBytes(hr1.getServerName().toString()));
|
||||
Bytes.toBytes(hr0.getServerName().toString()));
|
||||
|
||||
while (!reopenEventProcessed.get()) {
|
||||
Threads.sleep(100);
|
||||
}
|
||||
|
||||
// make sure the region has moved from the original RS
|
||||
assertTrue(hr0.getOnlineRegion(hri.getEncodedNameAsBytes()) == null);
|
||||
assertTrue(hr1.getOnlineRegion(hri.getEncodedNameAsBytes()) == null);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue