HBASE-5781 Zookeeper session got closed while trying to assign the region to RS using hbck -fix
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1326280 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a2c1c0cd3e
commit
44a05d4380
|
@ -118,38 +118,28 @@ public class HBaseFsckRepair {
|
||||||
*/
|
*/
|
||||||
public static void waitUntilAssigned(HBaseAdmin admin,
|
public static void waitUntilAssigned(HBaseAdmin admin,
|
||||||
HRegionInfo region) throws IOException, InterruptedException {
|
HRegionInfo region) throws IOException, InterruptedException {
|
||||||
HConnection connection = admin.getConnection();
|
long timeout = admin.getConfiguration().getLong("hbase.hbck.assign.timeout", 120000);
|
||||||
|
long expiration = timeout + System.currentTimeMillis();
|
||||||
try {
|
while (System.currentTimeMillis() < expiration) {
|
||||||
long timeout = admin.getConfiguration().getLong("hbase.hbck.assign.timeout", 120000);
|
try {
|
||||||
long expiration = timeout + System.currentTimeMillis();
|
Map<String, RegionState> rits=
|
||||||
while (System.currentTimeMillis() < expiration) {
|
|
||||||
try {
|
|
||||||
Map<String, RegionState> rits=
|
|
||||||
admin.getClusterStatus().getRegionsInTransition();
|
admin.getClusterStatus().getRegionsInTransition();
|
||||||
|
|
||||||
if (rits.keySet() != null && !rits.keySet().contains(region.getEncodedName())) {
|
if (rits.keySet() != null && !rits.keySet().contains(region.getEncodedName())) {
|
||||||
// yay! no longer RIT
|
// yay! no longer RIT
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
// still in rit
|
|
||||||
LOG.info("Region still in transition, waiting for "
|
|
||||||
+ "it to become assigned: " + region);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOG.warn("Exception when waiting for region to become assigned,"
|
|
||||||
+ " retrying", e);
|
|
||||||
}
|
}
|
||||||
Thread.sleep(1000);
|
// still in rit
|
||||||
}
|
LOG.info("Region still in transition, waiting for "
|
||||||
throw new IOException("Region " + region + " failed to move out of " +
|
+ "it to become assigned: " + region);
|
||||||
"transition within timeout " + timeout + "ms");
|
} catch (IOException e) {
|
||||||
} finally {
|
LOG.warn("Exception when waiting for region to become assigned,"
|
||||||
try {
|
+ " retrying", e);
|
||||||
connection.close();
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
throw ioe;
|
|
||||||
}
|
}
|
||||||
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
|
throw new IOException("Region " + region + " failed to move out of " +
|
||||||
|
"transition within timeout " + timeout + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue