HBASE-6329 Stopping META regionserver when splitting region could cause daughter region to be assigned twice (chunhui shen)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1358820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5bbb8e78d7
commit
a7dcdedb86
|
@ -872,6 +872,11 @@ public class HRegionServer implements ClientProtocol,
|
|||
this.hbaseMaster = null;
|
||||
}
|
||||
this.leases.close();
|
||||
|
||||
if (!killed) {
|
||||
join();
|
||||
}
|
||||
|
||||
try {
|
||||
deleteMyEphemeralNode();
|
||||
} catch (KeeperException e) {
|
||||
|
@ -884,9 +889,6 @@ public class HRegionServer implements ClientProtocol,
|
|||
LOG.info("stopping server " + this.serverNameFromMasterPOV +
|
||||
"; zookeeper connection closed.");
|
||||
|
||||
if (!killed) {
|
||||
join();
|
||||
}
|
||||
LOG.info(Thread.currentThread().getName() + " exiting");
|
||||
}
|
||||
|
||||
|
@ -1634,6 +1636,7 @@ public class HRegionServer implements ClientProtocol,
|
|||
public void postOpenDeployTasks(final HRegion r, final CatalogTracker ct,
|
||||
final boolean daughter)
|
||||
throws KeeperException, IOException {
|
||||
checkOpen();
|
||||
LOG.info("Post open deploy tasks for region=" + r.getRegionNameAsString() +
|
||||
", daughter=" + daughter);
|
||||
// Do checks to see if we need to compact (references or too many files)
|
||||
|
|
|
@ -69,6 +69,13 @@ class SplitRequest implements Runnable {
|
|||
st.execute(this.server, this.server);
|
||||
this.server.getMetrics().incrementSplitSuccessCount();
|
||||
} catch (Exception e) {
|
||||
if (this.server.isStopping() || this.server.isStopped()) {
|
||||
LOG.info(
|
||||
"Skip rollback/cleanup of failed split of "
|
||||
+ parent.getRegionNameAsString() + " because server is"
|
||||
+ (this.server.isStopping() ? " stopping" : " stopped"), e);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LOG.info("Running rollback/cleanup of failed split of " +
|
||||
parent.getRegionNameAsString() + "; " + e.getMessage(), e);
|
||||
|
|
|
@ -342,11 +342,6 @@ public class SplitTransaction {
|
|||
boolean stopping = services != null && services.isStopping();
|
||||
// TODO: Is this check needed here?
|
||||
if (stopped || stopping) {
|
||||
// add 2nd daughter first (see HBASE-4335)
|
||||
MetaEditor.addDaughter(server.getCatalogTracker(),
|
||||
b.getRegionInfo(), services.getServerName());
|
||||
MetaEditor.addDaughter(server.getCatalogTracker(),
|
||||
a.getRegionInfo(), services.getServerName());
|
||||
LOG.info("Not opening daughters " +
|
||||
b.getRegionInfo().getRegionNameAsString() +
|
||||
" and " +
|
||||
|
@ -397,7 +392,8 @@ public class SplitTransaction {
|
|||
* @param a second daughter region
|
||||
* @throws IOException If thrown, transaction failed. Call {@link #rollback(Server, RegionServerServices)}
|
||||
*/
|
||||
/* package */void transitionZKNode(final Server server, HRegion a, HRegion b)
|
||||
/* package */void transitionZKNode(final Server server,
|
||||
final RegionServerServices services, HRegion a, HRegion b)
|
||||
throws IOException {
|
||||
// Tell master about split by updating zk. If we fail, abort.
|
||||
if (server != null && server.getZooKeeper() != null) {
|
||||
|
@ -421,7 +417,8 @@ public class SplitTransaction {
|
|||
parent.getRegionInfo(), a.getRegionInfo(), b.getRegionInfo(),
|
||||
server.getServerName(), this.znodeVersion);
|
||||
spins++;
|
||||
} while (this.znodeVersion != -1);
|
||||
} while (this.znodeVersion != -1 && !server.isStopped()
|
||||
&& !services.isStopping());
|
||||
} catch (Exception e) {
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -455,7 +452,7 @@ public class SplitTransaction {
|
|||
throws IOException {
|
||||
PairOfSameType<HRegion> regions = createDaughters(server, services);
|
||||
openDaughters(server, services, regions.getFirst(), regions.getSecond());
|
||||
transitionZKNode(server, regions.getFirst(), regions.getSecond());
|
||||
transitionZKNode(server, services, regions.getFirst(), regions.getSecond());
|
||||
return regions;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,8 @@ public class TestEndToEndSplitTransaction {
|
|||
assertTrue(test(con, tableName, lastRow, server));
|
||||
|
||||
// 4. phase III
|
||||
split.transitionZKNode(server, regions.getFirst(), regions.getSecond());
|
||||
split.transitionZKNode(server, server, regions.getFirst(),
|
||||
regions.getSecond());
|
||||
assertTrue(test(con, tableName, firstRow, server));
|
||||
assertTrue(test(con, tableName, lastRow, server));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue