HBASE-2499 Race condition when disabling a table leaves regions in transition
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@939157 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9272667079
commit
3b924fea46
|
@ -295,6 +295,7 @@ Release 0.21.0 - Unreleased
|
|||
master.jsp moved under webapps/master(Cristian Ivascu via Stack)
|
||||
HBASE-2487 Uncaught exceptions in receiving IPC responses orphan clients
|
||||
(Todd Lipcon via Stack)
|
||||
HBASE-2499 Race condition when disabling a table leaves regions in transition
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -23,7 +23,9 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
import org.apache.hadoop.hbase.client.Delete;
|
||||
import org.apache.hadoop.hbase.client.Get;
|
||||
import org.apache.hadoop.hbase.client.Put;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.ipc.HRegionInterface;
|
||||
import org.apache.hadoop.hbase.util.Writables;
|
||||
|
||||
|
@ -85,6 +87,9 @@ class ChangeTableState extends TableOperation {
|
|||
continue;
|
||||
}
|
||||
|
||||
// If it's already offline then don't set it a second/third time, skip
|
||||
// Same for online, don't set again if already online
|
||||
if (!(i.isOffline() && !online) && !(!i.isOffline() && online)) {
|
||||
// Update meta table
|
||||
Put put = updateRegionInfo(i);
|
||||
server.put(m.getRegionName(), put);
|
||||
|
@ -92,6 +97,7 @@ class ChangeTableState extends TableOperation {
|
|||
delete.deleteColumns(CATALOG_FAMILY, SERVER_QUALIFIER);
|
||||
delete.deleteColumns(CATALOG_FAMILY, STARTCODE_QUALIFIER);
|
||||
server.delete(m.getRegionName(), delete);
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Removed server and startcode from row and set online=" +
|
||||
this.online + ": " + i.getRegionNameAsString());
|
||||
|
@ -124,6 +130,15 @@ class ChangeTableState extends TableOperation {
|
|||
|
||||
// Cause regions being served to be taken off-line and disabled
|
||||
for (HRegionInfo i: e.getValue()) {
|
||||
// The scan we did could be totally staled, get the freshest data
|
||||
Get get = new Get(i.getRegionName());
|
||||
get.addColumn(CATALOG_FAMILY, SERVER_QUALIFIER);
|
||||
Result values = server.get(m.getRegionName(), get);
|
||||
String serverAddress = BaseScanner.getServerAddress(values);
|
||||
// If this region is unassigned, skip!
|
||||
if(serverAddress.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Adding region " + i.getRegionNameAsString() +
|
||||
" to setClosing list");
|
||||
|
|
Loading…
Reference in New Issue