Visitar URL original
[fix][broker] Report metadata write failures when creating partitioned topics by oneby-wang · Pull Request #27606 · apache/pulsar · GitHub
Skip to content

[fix][broker] Report metadata write failures when creating partitioned topics - #27606

Open
oneby-wang wants to merge 1 commit into
apache:masterfrom
oneby-wang:fix/partitioned-topic-metadata-failure
Open

oneby-wang wants to merge 1 commit into
apache:masterfrom
oneby-wang:fix/partitioned-topic-metadata-failure

Conversation

@oneby-wang

Copy link
Copy Markdown
Contributor

Motivation

Inspired by #27576 (originally oneby-wang#64), which fixed a similar failure during cluster migration.

When the metadata store is closing, a partitioned-topic metadata write can fail with an AlreadyClosedException whose cause is null. The whenComplete callback passes ex.getCause() to RestException, which throws a NullPointerException before the callback can complete the separate future returned to the caller. The admin request stays pending.

Modifications

  • Return the handle stage directly so a metadata failure reaches the REST error handler. A closed store now produces HTTP 500 with the original message.
  • Use unwrapCompletionException to recognize both direct and wrapped conflicts. A version conflict returns 409. An existing partitioned topic also returns 409, except when createLocalTopicOnly allows local partition creation to continue.

Verifying this change

  • Make sure that the change passes the CI checks.

Added AdminTopicApiTest.testCreatePartitionedTopicReportsMetadataStoreFailure. It injects the failure only for the test topic's metadata write. Before the fix, the request received no response within five seconds. With the fix, it receives HTTP 500 and the original store error message.

All seven tests in AdminTopicApiTest and quickCheck passed locally.

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

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints (error response when creating a partitioned topic)
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

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