pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[fix][broker]Ensure that the ledgerId updated by currentLedger is monotonically increasing

Open lordcheng10 opened this issue 3 years ago • 6 comments

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)

lordcheng10 avatar Jul 18 '22 08:07 lordcheng10

/pulsarbot run-failure-checks

lordcheng10 avatar Jul 18 '22 13:07 lordcheng10

/pulsarbot run-failure-checks

lordcheng10 avatar Jul 18 '22 14:07 lordcheng10

@lordcheng10 Looks like we have the lock to ensure concurrency problem, could you describe the detail?

mattisonchao avatar Jul 18 '22 15:07 mattisonchao

@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

lordcheng10 avatar Jul 29 '22 03:07 lordcheng10

@codelipenghui @hangc0276 PTAL,thanks!

lordcheng10 avatar Jul 29 '22 04:07 lordcheng10

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar Sep 03 '22 02:09 github-actions[bot]