HBASE-10809: HBaseAdmin#deleteTable fails when META region happen to move around same time

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1582841 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jeffreyz 2014-03-28 17:38:30 +00:00
parent 897554ff3c
commit 026e89af76
3 changed files with 9 additions and 6 deletions

View File

@ -640,7 +640,6 @@ public class HBaseAdmin implements Abortable, Closeable {
* @throws IOException if a remote or network exception occurs
*/
public void deleteTable(final TableName tableName) throws IOException {
HRegionLocation firstMetaServer = getFirstMetaServerForTable(tableName);
boolean tableExists = true;
executeCallable(new MasterCallable<Void>(getConnection()) {
@ -652,10 +651,11 @@ public class HBaseAdmin implements Abortable, Closeable {
}
});
int failures = 0;
// Wait until all regions deleted
for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
try {
HRegionLocation firstMetaServer = getFirstMetaServerForTable(tableName);
Scan scan = MetaReader.getScanForTableName(tableName);
scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
ScanRequest request = RequestConverter.buildScanRequest(
@ -694,7 +694,8 @@ public class HBaseAdmin implements Abortable, Closeable {
}
}
} catch (IOException ex) {
if(tries == numRetries - 1) { // no more tries left
failures++;
if(failures == numRetries - 1) { // no more tries left
if (ex instanceof RemoteException) {
throw ((RemoteException) ex).unwrapRemoteException();
} else {

View File

@ -2445,9 +2445,11 @@ public class HRegionServer extends HasThread implements
String regionNameStr = regionName == null?
encodedRegionName: Bytes.toStringBinary(regionName);
if (isOpening != null && isOpening.booleanValue()) {
throw new RegionOpeningException("Region " + regionNameStr + " is opening");
throw new RegionOpeningException("Region " + regionNameStr +
" is opening on " + this.serverName);
}
throw new NotServingRegionException("Region " + regionNameStr + " is not online");
throw new NotServingRegionException("Region " + regionNameStr +
" is not online on " + this.serverName);
}
return region;
}

View File

@ -114,7 +114,7 @@ public class TestRowProcessorEndpoint {
Configuration conf = util.getConfiguration();
conf.setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
RowProcessorEndpoint.class.getName());
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
conf.setLong("hbase.hregion.row.processor.timeout", 1000L);
util.startMiniCluster();
}