HBASE-8164 TestTableLockManager fails intermittently in trunk builds
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1463194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d814bff215
commit
58ec4f8e68
|
@ -1943,15 +1943,20 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
|
|||
attempted.clear();
|
||||
}
|
||||
regCount = regions.size();
|
||||
idx = random.nextInt(regions.size());
|
||||
// if we have just tried this region, there is no need to try again
|
||||
if (attempted.contains(idx)) continue;
|
||||
try {
|
||||
regions.get(idx).checkSplit();
|
||||
return regions.get(idx);
|
||||
} catch (Exception ex) {
|
||||
LOG.warn("Caught exception", ex);
|
||||
attempted.add(idx);
|
||||
// There are chances that before we get the region for the table from an RS the region may
|
||||
// be going for CLOSE. This may be because online schema change is enabled
|
||||
if (regCount > 0) {
|
||||
idx = random.nextInt(regCount);
|
||||
// if we have just tried this region, there is no need to try again
|
||||
if (attempted.contains(idx))
|
||||
continue;
|
||||
try {
|
||||
regions.get(idx).checkSplit();
|
||||
return regions.get(idx);
|
||||
} catch (Exception ex) {
|
||||
LOG.warn("Caught exception", ex);
|
||||
attempted.add(idx);
|
||||
}
|
||||
}
|
||||
attempts++;
|
||||
} while (maxAttempts == -1 || attempts < maxAttempts);
|
||||
|
|
|
@ -355,10 +355,16 @@ public class TestTableLockManager {
|
|||
public void chore() {
|
||||
try {
|
||||
HRegion region = TEST_UTIL.getSplittableRegion(tableName, -1);
|
||||
byte[] regionName = region.getRegionName();
|
||||
admin.flush(regionName);
|
||||
admin.compact(regionName);
|
||||
admin.split(regionName);
|
||||
if (region != null) {
|
||||
byte[] regionName = region.getRegionName();
|
||||
admin.flush(regionName);
|
||||
admin.compact(regionName);
|
||||
admin.split(regionName);
|
||||
} else {
|
||||
LOG.warn("Could not find suitable region for the table. Possibly the " +
|
||||
"region got closed and the attempts got over before " +
|
||||
"the region could have got reassigned.");
|
||||
}
|
||||
} catch (NotServingRegionException nsre) {
|
||||
// the region may be in transition
|
||||
LOG.warn("Caught exception", nsre);
|
||||
|
|
Loading…
Reference in New Issue