[fix] [ml] The atomicity of multiple fields of ml is broken
@@ -1554,16 +1554,16 @@ public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
log.debug("[{}] Updating of ledgers list after create complete. version={}", name, stat);
}
ledgersStat = stat;
+ synchronized (ManagedLedgerImpl.this) {
ledgers.put(lh.getId(), newLedger);
currentLedger = lh;
currentLedgerEntries = 0;
currentLedgerSize = 0;
- metadataMutex.unlock();
updateLedgersIdsComplete();
- synchronized (ManagedLedgerImpl.this) {
mbean.addLedgerSwitchLatencySample(System.currentTimeMillis()
- lastLedgerCreationInitiationTimestamp, TimeUnit.MILLISECONDS);
}
+ metadataMutex.unlock();
// May need to update the cursor position
maybeUpdateCursorBeforeTrimmingConsumedLedger();
