[fix][broker] Avoid Bookie data is never deleted #19992
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
When we clean up the data now, we first delete the index (metadata in Zookeeper), and then delete the Bookie data.
If the data deletion of Bookie fails, but the index is not there because it was deleted first,
the data of Bookie can never be deleted.
Therefore, we need to delete the data first, and then delete the index.
In this way, the entire delete operation is idempotent.
Data that is not deleted in the current cycle can be retried and deleted in the next cycle
Modifications
Verifying this change
315157973#8
Documentation
doc
doc-required
doc-not-needed
doc-complete