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] [ml] The atomicity of multiple fields of ml is broken #19346

Merged
merged 2 commits into from
Jan 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1554,16 +1554,16 @@ public void operationComplete(Void v, Stat stat) {
log.debug("[{}] Updating of ledgers list after create complete. version={}", name, stat);
}
ledgersStat = stat;
ledgers.put(lh.getId(), newLedger);
currentLedger = lh;
currentLedgerEntries = 0;
currentLedgerSize = 0;
metadataMutex.unlock();
updateLedgersIdsComplete();
synchronized (ManagedLedgerImpl.this) {
ledgers.put(lh.getId(), newLedger);
currentLedger = lh;
currentLedgerEntries = 0;
currentLedgerSize = 0;
updateLedgersIdsComplete();
mbean.addLedgerSwitchLatencySample(System.currentTimeMillis()
Comment on lines 1557 to 1563
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to move updateLedgersIdsComplete() into the synchronized block? I see before #16420 this method is out of synchronized too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is not necessary. But it should be executed after these fields changes.

- lastLedgerCreationInitiationTimestamp, TimeUnit.MILLISECONDS);
}
metadataMutex.unlock();

// May need to update the cursor position
maybeUpdateCursorBeforeTrimmingConsumedLedger();
Expand Down