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

[broker] Cancel scheduled tasks when deleting ManagedLedgerImpl #12565

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

massakam
Copy link
Contributor

@massakam massakam commented Nov 1, 2021

Motivation

If we delete a persistent topic, the following error may be output to the broker log 4 hours later.

2021-11-01T13:29:30,175+0900 [bookkeeper-ml-scheduler-OrderedScheduler-0-0] INFO  org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl - [public/default/persistent/t1] Start checking if current ledger is full
2021-11-01T13:29:30,184+0900 [main-EventThread] WARN  org.apache.bookkeeper.meta.AbstractZkLedgerManager - Ledger node does not exist in ZooKeeper: ledgerId=0
2021-11-01T13:29:30,184+0900 [main-EventThread] ERROR org.apache.bookkeeper.client.MetadataUpdateLoop - UpdateLoop(ledgerId=0,loopId=4a56f38f) Error writing metadata to store
org.apache.bookkeeper.client.BKException$BKNoSuchLedgerExistsOnMetadataServerException: No such ledger exists on Metadata Server
        at org.apache.bookkeeper.meta.AbstractZkLedgerManager$4.processResult(AbstractZkLedgerManager.java:505) [bookkeeper-server-4.14.2.jar:4.14.2]
        at org.apache.pulsar.metadata.impl.PulsarZooKeeperClient$22$1.processResult(PulsarZooKeeperClient.java:1096) [pulsar-metadata.jar:2.10.0-SNAPSHOT]
        at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:638) [zookeeper-3.6.3.jar:3.6.3]
        at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:563) [zookeeper-3.6.3.jar:3.6.3]
2021-11-01T13:29:30,189+0900 [main-EventThread] WARN  org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl - Error when closing ledger 0. Status=No such ledger exists on Metadata Server

This happens because a task that regularly rolls over a ledger attempts to close already deleted one. This task is canceled when the ManagedLedgerImpl is closed, but not when it is deleted.

Modifications

Cancel checkLedgerRollTask not only when closing ManagedLedgerImpl, but also when deleting it.

Verifying this change

  • Make sure that the change passes the CI checks.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

Check the box below and label this PR (if you have committer privilege).

  • no-need-doc

@massakam massakam added type/bug The PR fixed a bug or issue reported a bug area/broker doc-not-needed Your PR changes do not impact docs labels Nov 1, 2021
@massakam massakam added this to the 2.10.0 milestone Nov 1, 2021
@massakam massakam self-assigned this Nov 1, 2021
@merlimat merlimat merged commit a95a382 into apache:master Nov 1, 2021
@massakam massakam deleted the cancel-ml-scheduled-tasks branch November 2, 2021 04:07
eolivelli pushed a commit to eolivelli/pulsar that referenced this pull request Nov 29, 2021
@shoothzj
Copy link
Member

shoothzj commented Dec 6, 2021

@lhotari This PR may need cherry pick to other branches

lhotari pushed a commit that referenced this pull request Dec 9, 2021
@lhotari lhotari added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Dec 9, 2021
lhotari pushed a commit that referenced this pull request Dec 9, 2021
@lhotari lhotari added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Dec 9, 2021
lhotari pushed a commit that referenced this pull request Dec 9, 2021
@lhotari lhotari added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Dec 9, 2021
@lhotari
Copy link
Member

lhotari commented Dec 9, 2021

@lhotari This PR may need cherry pick to other branches

thanks for the heads up @shoothzj . I have cherry-picked to branch-2.7, branch-2.8 and branch-2.9 . /cc @315157973 @eolivelli

nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Dec 10, 2021
(cherry picked from commit a95a382)
(cherry picked from commit 76330a1)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Dec 10, 2021
(cherry picked from commit a95a382)
(cherry picked from commit 935f8ba)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-2.7 Archived: 2.7 is end of life cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.7.4 release/2.8.2 release/2.9.1 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