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

fix pendingDeletedLedgers do not remove ledger error #4525

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TakaHiR07
Copy link
Contributor

@TakaHiR07 TakaHiR07 commented Nov 15, 2024

Motivation

fix this pr #3989 cause ledger not remove in pendingDeletedLedgers.

Previous would do poll(), but later just do forEach()

Changes

keep the same logic before pr-3989.

Alternative fix is revert previous pr.

@@ -345,6 +345,7 @@ public void removeDeletedLedgers() throws IOException {
log.debug("Persisting deletes of ledgers {}", deletedLedgers);
}

pendingDeletedLedgers.clear();
Copy link
Contributor

@AnonHxy AnonHxy Nov 15, 2024

Choose a reason for hiding this comment

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

Thanks for your fix. But I think we should call pendingDeletedLedgers.remove(ledgerId) after line342.
pendingDeletedLedgers cloud being adding when call clear(), cause some ledgers not have deleted from ledgersDB but clear from pendingDeletedLedgers .

By the way. pendingDeletedLedgers is a Sets.newConcurrentHashSet(). I think it will not concurrent error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's ok

@TakaHiR07 TakaHiR07 force-pushed the fix_pendingDeletedLedgers_not_remove_ledger branch from 495513d to 2fc7cf0 Compare November 18, 2024 02:20
Copy link
Member

@shoothzj shoothzj left a comment

Choose a reason for hiding this comment

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

is there any chance we can add unit test for this?

@TakaHiR07
Copy link
Contributor Author

is there any chance we can add unit test for this?

you can see the new code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants