-
Notifications
You must be signed in to change notification settings - Fork 625
HDDS-8168. Make deadlines inside MoveManager for move commands configurable #4415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
5ff4138
f495e2d
1f18a24
9f125d7
f8247c7
65d1bbe
afb28c2
0628847
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -409,6 +409,18 @@ private void validateConfiguration(ContainerBalancerConfiguration conf) | |
| "should be greater than hdds.datanode.du.refresh.period {}", | ||
| conf.getBalancingInterval(), refreshPeriod); | ||
| } | ||
|
|
||
| // "move.replication.timeout" should be lesser than "move.timeout" | ||
| if (conf.getMoveReplicationTimeout().toMillis() >= | ||
| conf.getMoveTimeout().toMillis()) { | ||
| LOG.warn("hdds.container.balancer.move.replication.timeout {} should " + | ||
| "be lesser than hdds.container.balancer.move.timeout {}.", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: lesser -> less |
||
| conf.getMoveReplicationTimeout().toMinutes(), | ||
| conf.getMoveTimeout().toMinutes()); | ||
| throw new InvalidContainerBalancerConfigurationException( | ||
| "hdds.container.balancer.move.replication.timeout should " + | ||
| "be lesser than hdds.container.balancer.move.timeout."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: lesser -> less |
||
| } | ||
| } | ||
|
|
||
| public ContainerBalancerMetrics getMetrics() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,8 +109,11 @@ public enum MoveResult { | |
| // TODO - Should pending ops notify under lock to allow MM to schedule a | ||
| // delete after the move, but before anything else can, eg RM? | ||
|
|
||
| // TODO - these need to be config defined somewhere, probably in the balancer | ||
| private static final long MOVE_DEADLINE = 1000 * 60 * 60; // 1 hour | ||
| /* | ||
| moveDeadline and replicationDeadline are set by ContainerBalancer. | ||
| */ | ||
| private long moveDeadline = 1000 * 90 * 60; | ||
| private long replicationDeadline = 1000 * 60 * 60; | ||
|
adoroszlai marked this conversation as resolved.
Outdated
|
||
| private static final double MOVE_DEADLINE_FACTOR = 0.95; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if using a factor like this makes sense for these longer duration timeouts. The idea I had, is that the datanode should timeout before SCM does, so that when SCM abandons the command, we know the DN has given up on it too. If we have a replication timeout of 50 mins, then 95% of that is 47.5, so the DN will give up 2.5 mins before SCM does. Feels like the DN is then giving up too early. If we have a 10 minute timeout or a 60 minute timeout, the DN doesn't need to give up earlier for the longer timeout. Perhaps we could take factor away from here completely, and then let RM decide what the DN timeout should be. That would simplify the API slightly into RM, as we only need to pass a single timeout. Perhaps 30 seconds less than the SCM timeout for all values, rather than a percentage like we have now, but it could have a single configuration in RM, rather than having the factor defined here and also in RM.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could have another small PR to change the factor if you think it will complicate this PR too much. I am happy either way.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's a good point. Created HDDS-8230 for fixing this. |
||
|
|
||
| private final ReplicationManager replicationManager; | ||
|
|
@@ -320,8 +323,11 @@ private void notifyContainerOpCompleted(ContainerReplicaOp containerReplicaOp, | |
| try { | ||
| handleSuccessfulAdd(containerID); | ||
| } catch (ContainerNotFoundException | NodeNotFoundException | | ||
| ContainerReplicaNotFoundException e) { | ||
| LOG.warn("Can not handle successful Add for move", e); | ||
| ContainerReplicaNotFoundException | NotLeaderException e) { | ||
| LOG.warn("Failed to handle successful Add for container {} being " + | ||
| "moved from source {} to target {}.", containerID, | ||
| mdnp.getSrc(), mdnp.getTgt(), e); | ||
| pair.getLeft().complete(MoveResult.FAIL_UNEXPECTED_ERROR); | ||
| } | ||
| } else if ( | ||
| opType.equals(PendingOpType.DELETE) && mdnp.getSrc().equals(dn)) { | ||
|
|
@@ -355,8 +361,8 @@ private void notifyContainerOpExpired(ContainerReplicaOp containerReplicaOp, | |
|
|
||
| private void handleSuccessfulAdd(final ContainerID cid) | ||
| throws ContainerNotFoundException, | ||
| ContainerReplicaNotFoundException, NodeNotFoundException { | ||
|
|
||
| ContainerReplicaNotFoundException, NodeNotFoundException, | ||
| NotLeaderException { | ||
| Pair<CompletableFuture<MoveResult>, MoveDataNodePair> pair = | ||
| pendingMoves.get(cid); | ||
| if (pair == null) { | ||
|
|
@@ -442,29 +448,28 @@ private void sendReplicateCommand( | |
| containerInfo.containerID(), src); | ||
| long now = clock.millis(); | ||
| replicationManager.sendLowPriorityReplicateContainerCommand(containerInfo, | ||
| replicaIndex, src, tgt, now + MOVE_DEADLINE, | ||
| now + Math.round(MOVE_DEADLINE * MOVE_DEADLINE_FACTOR)); | ||
| replicaIndex, src, tgt, now + replicationDeadline, | ||
| now + Math.round(replicationDeadline * MOVE_DEADLINE_FACTOR)); | ||
| } | ||
|
|
||
| /** | ||
| * Sends delete container command for the given container to the given | ||
| * datanode. | ||
| * | ||
| * @param containerInfo Container to be deleted | ||
| * @param datanode The datanode on which the replica should be deleted | ||
| * @param datanode The datanode on which the replica should be deleted | ||
| */ | ||
| private void sendDeleteCommand( | ||
| final ContainerInfo containerInfo, final DatanodeDetails datanode) | ||
| throws ContainerReplicaNotFoundException, ContainerNotFoundException { | ||
| throws ContainerReplicaNotFoundException, ContainerNotFoundException, | ||
| NotLeaderException { | ||
| int replicaIndex = getContainerReplicaIndex( | ||
| containerInfo.containerID(), datanode); | ||
| try { | ||
| replicationManager.sendDeleteCommand( | ||
| containerInfo, replicaIndex, datanode, true); | ||
| } catch (NotLeaderException nle) { | ||
| LOG.warn("Skipped deleting the container as this SCM is not the leader.", | ||
| nle); | ||
| } | ||
| long deleteDeadline = moveDeadline - replicationDeadline; | ||
| long now = clock.millis(); | ||
| replicationManager.sendDeleteCommand( | ||
| containerInfo, replicaIndex, datanode, true, now + deleteDeadline, | ||
| now + Math.round(deleteDeadline * MOVE_DEADLINE_FACTOR)); | ||
| } | ||
|
|
||
| private int getContainerReplicaIndex( | ||
|
|
@@ -488,4 +493,12 @@ public void opCompleted(ContainerReplicaOp op, ContainerID containerID, | |
| notifyContainerOpCompleted(op, containerID); | ||
| } | ||
| } | ||
|
|
||
| void setMoveDeadline(long moveDeadline) { | ||
| this.moveDeadline = moveDeadline; | ||
| } | ||
|
|
||
| void setReplicationDeadline(long replicationDeadline) { | ||
| this.replicationDeadline = replicationDeadline; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra blank line here - probably best to remove it.