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

[Issue 12774][metadata] Fix race condition in PulsarLedgerIdGenerator#generateShortLedgerId #14118

Merged
merged 3 commits into from
Feb 5, 2022

Conversation

Jason918
Copy link
Contributor

@Jason918 Jason918 commented Feb 4, 2022

Fixes #12774

Motivation

See #12774
The root cause is there are multi threads calling PulsarLedgerIdGenerator#generateLedgerId --> #generateShortLedgerId --> store.put(shortIdGenPath,...). The first success, and the rest fails with exception.

Modifications

Skip the exception when the path shortIdGenPath already created by others.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as ReplicatorTest.testDoNotReplicateSystemTopic

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

If yes was chosen, please highlight the changes

  • 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).

Need to update docs?

  • no-need-doc

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Feb 4, 2022
@Jason918
Copy link
Contributor Author

Jason918 commented Feb 5, 2022

/pulsarbot run-failure-checks

@merlimat merlimat merged commit 794f229 into apache:master Feb 5, 2022
@merlimat merlimat added this to the 2.10.0 milestone Feb 5, 2022
@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Feb 5, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
…#generateShortLedgerId (apache#14118)

* Fix race condition in org.apache.pulsar.metadata.bookkeeper.PulsarLedgerIdGenerator#generateShortLedgerId

* restore testDoNotReplicateSystemTopic

* fix BadVersionException check in createHOBPathAndGenerateId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs 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.

Flaky-test: ReplicatorTest.testDoNotReplicateSystemTopic
3 participants