-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-9748. When the command status is reported, the command set sent to the datanode is updated #5672
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
Conversation
…to the datanode is updated
|
https://github.com/jianghuazhu/ozone/actions/runs/6986022982 |
sumitagrawl
left a comment
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.
@jianghuazhu Thanks for working over this. This is one of solution to reduce duplicate delete blocks command,
Here, based on response from DN, removing blocks already handled in prepared request.
But this do not avoid the problem, as at DN, multiple delete block command may be queued already.
Another solution,
DN side have small cache to remove duplicate command comparing previous and next command at DN. This I was thinking which can reduce duplicate blocks deletion even its present at DN queue.
One of solution for which PR already raised, "Avoid duplicate command from SCM itself tracking when the command is send to DN and handle retry"
#4988
IMO, changes may not be required in this PR.
|
Thanks @sumitagrawl for the comment and reivew. |
This is not fixing the scenario completely. Duplicate blocks still exist for request in queue at DN. |
|
Thanks @sumitagrawl for the comment and review. |
| return commands; | ||
| } | ||
|
|
||
| private void updateCommands(List<SCMCommand> commands, |
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.
nit:
- There is too much nesting which can be avoided using early returns.
- Use static import.
| private void updateCommands(List<SCMCommand> commands, | |
| private void updateCommands(List<SCMCommand> commands, | |
| CommandStatusReportsProto commandStatusReport) { | |
| if (commands == null) { | |
| return; | |
| } | |
| List<StorageContainerDatanodeProtocolProtos.CommandStatus> cmdStatusList | |
| = commandStatusReport.getCmdStatusList(); | |
| for (StorageContainerDatanodeProtocolProtos.CommandStatus cmdStatus : | |
| cmdStatusList) { | |
| if (cmdStatus.getType() != deleteBlocksCommand || | |
| cmdStatus.getStatus() != EXECUTED) { | |
| continue; | |
| } | |
| ContainerBlocksDeletionACKProto ackProto = | |
| cmdStatus.getBlockDeletionAck(); | |
| List<DeleteBlockTransactionResult> results = ackProto.getResultsList(); | |
| for (SCMCommand command : commands) { | |
| if (command.getType() != deleteBlocksCommand) { | |
| continue; | |
| } | |
| DeleteBlocksCommand deleteBlocksCommand = (DeleteBlocksCommand) command; | |
| List<DeletedBlocksTransaction> deletedBlocks = | |
| deleteBlocksCommand.blocksTobeDeleted(); | |
| for (DeleteBlockTransactionResult result : results) { | |
| deletedBlocks.removeIf(delete -> | |
| delete.getTxID() == result.getTxID()); | |
| } | |
| } | |
| } | |
| } |
|
Thanks @hemantk-12 for the comment and review. |
What changes were proposed in this pull request?
When SCM repeatedly issues deletion commands, the datanode will execute these commands repeatedly, which is unnecessary.
There is a situation that will cause this problem, that is, SCMBlockDeletingService created the DeleteBlocksCommand in advance, but did not update it.
Details: HDDS-9748
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9748
How was this patch tested?
Unit tests need to pass validation.