Skip to content

Commit

Permalink
HBASE-24117 Shutdown AssignmentManager before ProcedureExecutor may c…
Browse files Browse the repository at this point in the history
…ause SCP to accidentally skip assigning a region (apache#1865)

Author: Duo Zhang
Reason: Bug
Ref: CDPD-15964

Signed-off-by: Michael Stack <stack@apache.org>

Change-Id: I6bb4b16b68ea8c9e5baa39aa719447268da24c5c
(cherry picked from commit 3419317)
  • Loading branch information
Apache9 authored and robertkerek-cldr committed Sep 2, 2020
1 parent 846a0b0 commit e410d0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,11 @@ protected void stopServiceThreads() {

LOG.debug("Stopping service threads");

// stop procedure executor prior to other services such as server manager and assignment
// manager, as these services are important for some running procedures. See HBASE-24117 for
// example.
stopProcedureExecutor();

if (this.quotaManager != null) {
this.quotaManager.stop();
}
Expand All @@ -1472,8 +1477,6 @@ protected void stopServiceThreads() {
this.assignmentManager.stop();
}

stopProcedureExecutor();

if (this.walManager != null) {
this.walManager.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
Expand Down Expand Up @@ -473,6 +474,12 @@ private void assignRegions(MasterProcedureEnv env, List<RegionInfo> regions) thr
// updated the region location, or even finished itself, so the region is no longer on us
// any more, we should not try to assign it again. Please see HBASE-23594 for more details.
if (!serverName.equals(regionNode.getRegionLocation())) {
// See HBASE-24117, though we have already changed the shutdown order, it is still worth
// double checking here to confirm that we do not skip assignment incorrectly.
if (!am.isRunning()) {
throw new DoNotRetryIOException(
"AssignmentManager has been stopped, can not process assignment any more");
}
LOG.info("{} found a region {} which is no longer on us {}, give up assigning...", this,
regionNode, serverName);
continue;
Expand Down

0 comments on commit e410d0e

Please sign in to comment.