[fix][broker]Ensure that the ledgerId updated by currentLedger is monotonically increasing
Motivation
When updating the currentLedger, it is necessary to ensure that the updated ledgerId is greater than the ledgerId of the current currentLedger.
Documentation
Check the box below or label this PR directly.
Need to update docs?
-
[ ]
doc-required(Your PR needs to update docs and you will update later) -
[x]
doc-not-needed(Please explain why) -
[ ]
doc(Your PR contains doc changes) -
[ ]
doc-complete(Docs have been already added)
/pulsarbot run-failure-checks
/pulsarbot run-failure-checks
@lordcheng10 Looks like we have the lock to ensure concurrency problem, could you describe the detail?
@lordcheng10 Looks like we have the lock to ensure concurrency problem, could you describe the detail?
@mattisonchao When there is a serious Full GC, there may be multiple ledgers to update the metadata information on zookeeper at the same time. Suppose we create ledger in the order of ledger1, ledger2, ledger3, ledger4, ledger5, and assume that a comparison occurs. In severe Full GC, ledger5 may grab the metadataMutex lock before ledger4, so ledger5 may trigger the zookeeper callback method operationComplete before ledger4, so that ledger4 may cover ledger5: https://github.com/apache/pulsar/blob/4d64e2e66689381ebbb94fbfc03eb4e1dfba0405/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L1559-L1566
@codelipenghui @hangc0276 PTAL,thanks!
The pr had no activity for 30 days, mark with Stale label.