Skip to content

[fix][broker] Fix REST API to produce messages to single-partitioned topics #24450

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Joforde
Copy link
Contributor

@Joforde Joforde commented Jun 24, 2025

Fixes #24442

Motivation

The REST API fails to produce messages to single-partitioned topics (partition count = 1) due to incorrect topic type detection.

Modifications

  • Fixed topic type detection condition in TopicsBase to properly handle single-partitioned topics
  • Changed from if (!topicName.isPartitioned() && metadata.partitions > 1)
    to if (!topicName.isPartitioned() && metadata.partitions > 0)

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Extended TopicsTest.testProduceToPartitionedTopic test cases with single-partition topic testing.

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

If the box was checked, please highlight the changes

  • 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
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository: Joforde@408ac9d

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 24, 2025
@BewareMyPower BewareMyPower added release/3.0.13 release/4.0.6 release/3.3.8 type/bug The PR fixed a bug or issue reported a bug labels Jun 26, 2025
@Joforde
Copy link
Contributor Author

Joforde commented Jun 26, 2025

I am doing pulsarbot run-failure-checks

@Joforde
Copy link
Contributor Author

Joforde commented Jun 29, 2025

I am doing pulsarbot run-failure-checks

The tests for BROKER_GROUP_2 were successfully executed using the command:
mvn test -pl pulsar-broker -Dgroups='schema,utils,functions-worker,broker-io,broker-discovery,broker-compaction,broker-naming,broker-replication,websocket,other',
as confirmed by the successful GitHub Actions run:
https://github.com/Joforde/pulsar/actions/runs/15842886147/job/44659112127.

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 ready-to-test release/3.0.13 release/3.3.8 release/4.0.6 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.

[Bug] REST API to produce messages to a single-partitioned topic fails with "Unable to add schema" error
3 participants