HBASE-8943 TestRegionMergeTransactionOnCluster#testWholesomeMerge may fail due to race in opening region
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1503470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a054e38b91
commit
9e740fed1a
@ -27,6 +27,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
|
|||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.RegionLoad;
|
import org.apache.hadoop.hbase.RegionLoad;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
|
import org.apache.hadoop.hbase.exceptions.RegionOpeningException;
|
||||||
import org.apache.hadoop.hbase.executor.EventHandler;
|
import org.apache.hadoop.hbase.executor.EventHandler;
|
||||||
import org.apache.hadoop.hbase.executor.EventType;
|
import org.apache.hadoop.hbase.executor.EventType;
|
||||||
import org.apache.hadoop.hbase.master.CatalogJanitor;
|
import org.apache.hadoop.hbase.master.CatalogJanitor;
|
||||||
@ -117,6 +118,7 @@ public class DispatchMergingRegionHandler extends EventHandler {
|
|||||||
|
|
||||||
RegionPlan regionPlan = new RegionPlan(region_b, region_b_location,
|
RegionPlan regionPlan = new RegionPlan(region_b, region_b_location,
|
||||||
region_a_location);
|
region_a_location);
|
||||||
|
LOG.info("Moving regions to same server for merge: " + regionPlan.toString());
|
||||||
masterServices.getAssignmentManager().balance(regionPlan);
|
masterServices.getAssignmentManager().balance(regionPlan);
|
||||||
while (!masterServices.isStopped()) {
|
while (!masterServices.isStopped()) {
|
||||||
try {
|
try {
|
||||||
@ -143,19 +145,27 @@ public class DispatchMergingRegionHandler extends EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (onSameRS) {
|
if (onSameRS) {
|
||||||
try{
|
startTime = EnvironmentEdgeManager.currentTimeMillis();
|
||||||
masterServices.getServerManager().sendRegionsMerge(region_a_location,
|
while (!masterServices.isStopped()) {
|
||||||
region_a, region_b, forcible);
|
try {
|
||||||
LOG.info("Successfully send MERGE REGIONS RPC to server "
|
masterServices.getServerManager().sendRegionsMerge(region_a_location,
|
||||||
+ region_a_location.toString() + " for region "
|
region_a, region_b, forcible);
|
||||||
+ region_a.getRegionNameAsString() + ","
|
LOG.info("Sent merge to server " + region_a_location + " for region " +
|
||||||
+ region_b.getRegionNameAsString() + ", focible=" + forcible);
|
region_a.getEncodedName() + "," + region_b.getEncodedName() + ", focible=" + forcible);
|
||||||
} catch (IOException ie) {
|
break;
|
||||||
LOG.info("Failed send MERGE REGIONS RPC to server "
|
} catch (RegionOpeningException roe) {
|
||||||
+ region_a_location.toString() + " for region "
|
if ((EnvironmentEdgeManager.currentTimeMillis() - startTime) > timeout) {
|
||||||
+ region_a.getRegionNameAsString() + ","
|
LOG.warn("Failed sending merge to " + region_a_location + " after " + timeout + "ms",
|
||||||
+ region_b.getRegionNameAsString() + ", focible=" + forcible + ", "
|
roe);
|
||||||
+ ie.getMessage());
|
break;
|
||||||
|
}
|
||||||
|
// Do a retry since region should be online on RS immediately
|
||||||
|
} catch (IOException ie) {
|
||||||
|
LOG.warn("Failed sending merge to " + region_a_location + " for region " +
|
||||||
|
region_a.getEncodedName() + "," + region_b.getEncodedName() + ", focible=" + forcible,
|
||||||
|
ie);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Cancel merging regions " + region_a.getRegionNameAsString()
|
LOG.info("Cancel merging regions " + region_a.getRegionNameAsString()
|
||||||
@ -164,5 +174,4 @@ public class DispatchMergingRegionHandler extends EventHandler {
|
|||||||
+ (EnvironmentEdgeManager.currentTimeMillis() - startTime) + "ms");
|
+ (EnvironmentEdgeManager.currentTimeMillis() - startTime) + "ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user