Skip to content

[fix][consumer] Use resolved partition topic for single-partition zero queue consumer - #1531

Merged
RobertIndie merged 2 commits into
apache:masterfrom
Technoboy-:fix1
Aug 25, 2026
Merged

[fix][consumer] Use resolved partition topic for single-partition zero queue consumer#1531
RobertIndie merged 2 commits into
apache:masterfrom
Technoboy-:fix1

Conversation

@Technoboy-

Copy link
Copy Markdown
Contributor

Motivation

When a partitioned topic has exactly one partition, TopicPartitions returns the physical partition topic, e.g. topic-partition-0. However, the zero queue consumer path ignored that resolved topic and still created the internal consumer with the original base topic.

With newer brokers that enforce topic consistency, subscribing to the base topic after partitioned metadata exists is rejected with "Found partitioned metadata for non-partitioned topic". This change makes zero queue consumers use the resolved single partition topic, matching the normal consumer path and avoiding repeated failed subscribe attempts.

Modifications

Describe the modifications you've done.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

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): (yes / no)
  • The public API: (yes / no)
  • The schema: (yes / no / don't know)
  • The default values of configurations: (yes / no)
  • The wire protocol: (yes / no)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@Technoboy- Technoboy- self-assigned this Aug 24, 2026
@crossoverJie
crossoverJie requested a balanced review from Copilot August 24, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes zero-queue consumer subscription behavior for single-partition partitioned topics by ensuring it uses the resolved physical partition topic name (e.g., *-partition-0) instead of the base topic, avoiding broker rejections due to partitioned metadata.

Changes:

  • Pass the resolved single partition topic (partitions[0]) into the zero-queue consumer constructor.
  • Add a unit/integration test validating the zero-queue consumer uses the resolved partition topic internally.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pulsar/consumer_impl.go Ensures zero-queue consumer uses the resolved single-partition topic name when partitions==1.
pulsar/consumer_zero_queue_test.go Adds coverage asserting zero-queue consumer binds to the single physical partition topic.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pulsar/consumer_zero_queue_test.go Outdated
@RobertIndie
RobertIndie merged commit bf4809d into apache:master Aug 25, 2026
7 checks passed
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.

3 participants