Skip to content
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

HDDS-8158. Replication Manager: Make all handlers send commands immediately instead of returning commands #4399

Merged
merged 10 commits into from Mar 16, 2023

Conversation

sodonnel
Copy link
Contributor

What changes were proposed in this pull request?

To allow better throttling control all the unhealthy handlers should send the command directly using the RM API, rather than gathering up a list of commands and returning them.

This change involves a change to the UnhealthyReplicationHandler interface, which previously returned the commands, but now returns just the count of commands sent instead.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-8158

How was this patch tested?

Various existing tests modified.

Copy link
Contributor

@siddhantsangwan siddhantsangwan left a comment

Choose a reason for hiding this comment

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

@sodonnel Nicely done change. Mostly looks good, just a few minor comments.

excess--;
}
}
return commands;
return commandsSent;
}

private DeleteContainerCommand createDeleteCommand(ContainerInfo container) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this method since it's unused now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I missed that, thanks. Removed it now.

overReplicatedProcessor.processAll();

Mockito.verify(replicationManager).sendDatanodeCommand(any(), any(), any());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove these verifications in this test and the next one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided the tests here didn't need to validate the functionality of replicationManager actually sending commands. All the tests here need to do, is validate a successful run does not requeue the command, while a failed run does requeue, as that is basically the only thing the processor does now.

Sending the commands is internal to RM now (before RM returned the commands and then this processor sent them, so it was valid to test it does the sending), which we cannot really verify with a mocked RM anyway.

@@ -156,8 +100,6 @@ public void testMessageRequeuedOnException() throws IOException {
.thenThrow(new AssertionError("Should process only one item"));
underReplicatedProcessor.processAll();

Mockito.verify(replicationManager, Mockito.times(0))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same answer as above.

Copy link
Contributor

@siddhantsangwan siddhantsangwan left a comment

Choose a reason for hiding this comment

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

LGTM, let's merge once CI is green.

@sodonnel sodonnel merged commit f093f71 into apache:master Mar 16, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants