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

[do not merge] [branch-2.9] just reproduce issue: ledgers lost #18661

Closed
wants to merge 1 commit into from

Conversation

poorbarcode
Copy link
Contributor

@poorbarcode poorbarcode commented Nov 28, 2022

Motivation

In PR #17526, we know that a topic can be closed multiple times and that it is possible to have two same-named objects of class Persistenttopic in the same broker instance.

We know that closing the topic triggers the closure of the ManagedLedger. The topic object can be closed multiple times which means the ManagedLedger can be closed multiple times. This PR is used to prove: If a ManagedLedger is closed more than once, and switched ledgerHandle operation of ManagedLedger and method closed executed concurrently, there will be two of the same-named Managedledger in the same broker, possibly with different numbers of cursors.

If both Managedledgers are available and there are different numbers of cursors, this can cause the operation trimLedgers to delete too many ledgers from the meta of ManagedLedger.

Here is the process:

managedLedger_1.close switch ledgerHandle(managedLedger_1) create managedLedger_2 create managedLedger_3
close current LedgerHandle
async create new LedgerHandle
do close
set the state to Closed
remove managedLedger_1 from ManagedFactory.ledgers
set current ledger to the new LedgerHandle
set the state to LedgerOpened
do close the second time
create managedLedger_2
put managedLedger_2 to ManagedFactory.ledgers
remove managedLedger_2 from ManagedFactory.ledgers
create cursor_1 into managedLedger_2
create managedLedger_3
put managedLedger_3 to ManagedFactory.ledgers
recover cursor_1 from meta
create cursor_2 into managedLedger_3
has one cursor cursor_1 has two cursor: cursor_1, cursor_2

How to reproduce

Run the test LedgerLostTest.testConcurrentCloseLedgerAndSwitchLedger

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

  • 1

@poorbarcode poorbarcode closed this Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant