-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDDS-1981: Datanode should sync db when container is moved to CLOSED or QUASI_CLOSED state #1319
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
@supratimdeka Can you please review the PR? |
💔 -1 overall
This message was automatically generated. |
// Close container is not expected to be instantaneous. | ||
compactDB(); | ||
// We must sync the DB after close operation | ||
flushAndSyncDB(); |
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.
updateContainerData takes care to revert the state of the container in case of failure.
Won't that be a problem with flushDB? If flush fails, don't we want the container to remain Open?
Also, related question : what should be the relative order - sync first and then change state to close, both with the writeLock held
Same question applies to quasiClose as well.
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.
The recent commit moves sync before state change. Any failure in flush should now move to container to UNHEALTHY state in HddsDispatcher#dispatchRequest.
|
||
// It is ok if this operation takes a bit of time. | ||
// Close container is not expected to be instantaneous. | ||
compactDB(); |
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.
question unrelated to this patch : why do we need to run compact during close? what is the benefit?
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.
Good question. I feel we don't have to run compactDB in quasi close or close.
Thanks @lokeshj1703 for working on this. I think running explicit compaction before close might make it heavy operation. Can we run compaction in the background or in a separate thread after closing the container? |
💔 -1 overall
This message was automatically generated. |
@supratimdeka @bshashikant Thanks for reviewing the PR! I have pushed a commit addressing your comments. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Thanks @lokeshj1703 for updating the patch . The patch looks good to me. I am +1 on this change. |
@bshashikant @supratimdeka @nandakumar131 Thanks for reviewing the PR. I have merged it with trunk. |
…or QUASI_CLOSED state (apache#1319)
…or QUASI_CLOSED state (apache#1319)
Datanode should sync db when container is moved to CLOSED or QUASI_CLOSED state. This will ensure that the metadata of a container is persisted.