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

Fixed logic for forceful topic deletion #7356

Merged
merged 2 commits into from
Jun 26, 2020

Conversation

merlimat
Copy link
Contributor

Motivation

In the topic deletion, during the removal of non-durable subscriptions, there is a race condition that leads to a state the topic cannot get deleted anymore, not even forcefully, until it gets unloaded/reloaded.

The log trace is:

2020-06-20 00:00:23.763000+00:00 [WARN ] [.persistent.PersistentSubscription]  [persistent://TOPIC] [reader-15ab065c34] Failed to remove non durable cursor
	org.apache.bookkeeper.mledger.ManagedLedgerException: ManagedCursor not found: reader-15ab065c34

There are a couple of issues here:

  1. The isFenced flag is only set after all producers/consumers are disconnected, but that won't prevent the from reconnecting.

  2. We're doing these 3 operations in steps:

    1. Disconnecting the consumers
    2. Unsubscribing the subscription
    3. Deleting the topic

    The problem with (2) is that, for a non-durable subscription, the cursor is already deleted after (1), so the unsubscribing will fail there.

  3. When deleting the topic, all the cursors are going to get deleted when the managed ledger is deleted. There is no need to pre-delete all of them.

  4. Regarding USAGE_COUNT_UPDATER, if we're trying to force-delete operation, this operation should go through even if the counter is not correct. (eg: after the effects of Handling error in creation of non-durable cursor #7355)

  5. Fixed one case in which USAGE_COUNT_UPDATER wasn't decremented after an error.

@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Jun 25, 2020
@merlimat merlimat added this to the 2.7.0 milestone Jun 25, 2020
@merlimat merlimat self-assigned this Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/2.6.4 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants