-
Notifications
You must be signed in to change notification settings - Fork 911
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
add async or sync for :ledger metadata index's rocksdb write #3368
add async or sync for :ledger metadata index's rocksdb write #3368
Conversation
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.
overall the patch is good
but I left one comment about concurrency management, it deserves some double check
try { | ||
keyWrapper.set(STORAGE_FLAGS); | ||
newFlagsWrapper.set(newFlags); | ||
synchronized (ledgersDb) { |
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.
it seems to be that synchronisation around ledgersDb
is not consistent.
sometimes we don't access the variable that way.
I wonder why spotbugs does not complain
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.
This logic has not been updated, and the code to move according to #2936
It doesn't seem to be a problem, or if I modify synchronized to the method, I will make a unified correction to the historical code. @eolivelli
reopen the pr, run the new workflow |
Temporarily close first, and reopen after improvement |
Descriptions of the changes in this PR:
Motivation
bookie flush mainly composed of three pieces:
1. flush-entrylog: it's flushing entrylog
2. flush-locations-index: it's flushing entrly location index, use sync mode to flush
3. flush-ledger-index: it's flushing ledger metadata index, this index(LedgerMetadataIndex) use async mode to flush
sync is different from async:
sync mode:
1. create a batch;
5. add msg to the batch
6. call method(batch.flush) to flush the batch
async mode:
1. just call method(sync) to write the data
2. the rocksdb server will be timed to flush the data
Changes