Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public class AssignmentManager {

public static final int DEFAULT_FORCE_REGION_RETAINMENT_RETRIES = 600;

private static final int MAX_RETRY_LIMIT = 5;

private final ProcedureEvent<?> metaAssignEvent = new ProcedureEvent<>("meta assign");
private final ProcedureEvent<?> metaLoadEvent = new ProcedureEvent<>("meta load");

Expand All @@ -186,6 +188,8 @@ public class AssignmentManager {
private final RegionStates regionStates = new RegionStates();
private final RegionStateStore regionStateStore;

private final Map<RegionInfo, Integer> retryCountMap = new HashMap<>();

/**
* When the operator uses this configuration option, any version between the current cluster
* version and the value of "hbase.min.version.move.system.tables" does not trigger any
Expand Down Expand Up @@ -2483,7 +2487,21 @@ private void processAssignmentPlans(final HashMap<RegionInfo, RegionStateNode> r
acceptPlan(regions, balancer.retainAssignment(retainMap, servers));
} catch (HBaseIOException e) {
LOG.warn("unable to retain assignment", e);
addToPendingAssignment(regions, retainMap.keySet());

for(RegionInfo hri : retainMap.keySet()) {
int retryCount = retryCountMap.getOrDefault(hri,0) + 1;
retryCountMap.put(hri, retryCount);

if(retryCount > MAX_RETRY_LIMIT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better add a backoff here? If we go with this PR, the region will be in RIT state forever and only restarting master can trigger the reassign...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we can consider using backoff to solve the feedback loop as well. Simple blocking may be to harsh on the system.

// Drop the region assignment and log an error
LOG.error("Dropping region " + hri + " after exceeding retry limit " + MAX_RETRY_LIMIT);
retryCountMap.remove(hri);
}
else {
// Add back to pending assignment for retry
addToPendingAssignment(regions, Collections.singleton(hri));
}
}
}
}

Expand Down Expand Up @@ -2527,6 +2545,8 @@ private void acceptPlan(final HashMap<RegionInfo, RegionStateNode> regions,
}
} else {
events[evcount++] = regionNode.getProcedureEvent();
// Remove successfully assigned regions from retryCountMap
retryCountMap.remove(hri);
}
}
}
Expand Down