GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — [fix][cli][branch-4.2] Don't pass unset pulsar-perf pending-message options to the producer by lhotari · Pull Request #26371 · apache/pulsar Conversation
Member
Fixes #26340
Motivation
With both bounds gone, a producer that outruns its broker buffers without limit. #15283 already fixed exactly this shape for Note that #15283's fix is for partitioned topics: the across-partitions budget is what Modifications
Effective behaviour for Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:If the box was checked, please highlight the changes
Documentation
The option help text states that an unset value is left to the client.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…ptions to the producer ### Motivation `pulsar-perf produce` can exhaust the client's direct memory against a slow broker, because nothing bounds its producer: - `PerformanceBaseArguments.memoryLimit` has no initializer and is passed on unconditionally, so the client memory limit is disabled unless `--memory-limit` is given. - `--max-outstanding` defaults to `DEFAULT_MAX_PENDING_MESSAGES`, which is 0, and that value was passed to `maxPendingMessages(...)` unconditionally. 0 is the client's "no message-count limit", so the pending-message queue is unbounded too. `ProducerImpl` only creates its semaphore `if (conf.getMaxPendingMessages() > 0)`, so with both bounds gone a producer that outruns its broker buffers without any limit. apache#15283 fixed the same shape for `--max-outstanding-across-partitions` by only applying the option when it was set. That one is the across-partitions budget, which is divided between partitions and ignored on a non-partitioned topic; `--max-outstanding` is the one that matters there. ### Modifications Both options become `Integer` with no default, so "the user did not pass this flag" is distinguishable from "the user asked for 0", and each is applied only when it was given. `createProducerBuilder` uses `newProducer(Schema.BYTES)` rather than the no-argument `newProducer()`. They build the same producer, except that the former carries the defaults the client applies when its memory limit is disabled (1000 / 50000, added in apache#15723 so that a producer without byte-based backpressure still has some) - which is what an unset option now falls back to. `ProducerConfigurationData.setMaxPendingMessagesAcrossPartitions` no longer rejects a value below `maxPendingMessages`. That check makes the two setters order-dependent, and it is what forced apache#15283 to guard on `> 0` rather than on "was it set": with a per-producer default of 1000 now in place, `pulsar-perf -p 500` would throw `IllegalArgumentException`. The relationship is enforced where it is used - `PartitionedProducerImpl` lowers the per-partition limit to its share of the budget when a budget is set. With no flags, `pulsar-perf produce` now throttles - it sets `blockIfQueueFull(true)` - instead of buffering without limit, on partitioned and non-partitioned topics alike. `-o 0` restores the old unbounded behaviour. Assisted-by: Claude Code (Opus 5)
1 of 10 tasks
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
nodece
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
lhotari
added a commit
that referenced
this pull request
…26342 backport ### Motivation #26371 landed on branch-4.2 before #26342 was backported. It pinned "the pending-message limits are left to the client when unset" by asserting that the *builder's* configuration already carried positive limits, which held because `newProducer(Schema)` eagerly wrote the no-memory-limit defaults onto the builder. #26342 removes exactly that eager application: the defaults are now resolved on a copy when the producer is created, so that an explicit 0 stays meaningful and the no-argument `newProducer()` overload gets the same treatment. The builder therefore no longer carries the limits, and `testPendingMessageLimitsAreLeftToTheClientWhenUnset` fails. ### Modifications Assert the intent where it is now observable, and more directly than before: - the builder leaves both limits *unconfigured* — this is what pulsar-perf's fix actually does; - the *created producer's* effective configuration carries positive limits — this is the client applying its defaults. Also drop the stale comment on `createProducerBuilder`'s use of `newProducer(Schema.BYTES)`: since #26342 both overloads apply the defaults, so the reason it gave no longer holds. The call itself is left alone. No behaviour change; test-only apart from the comment.
lhotari
added a commit
that referenced
this pull request
…ptions to the producer (#26371) Backport of the branch-4.2 fix, limited to pulsar-testclient: #26371's hunks in ProducerConfigurationData and ProducerBuilderImplTest already arrived on this branch with the #26342 backport (4c9e045), which carries the same "maxPendingMessagesAcrossPartitions needs to be >= 0" relaxation. The branch-4.2 follow-up d705ea3, which adapted the pulsar-perf test once #26342 landed there, is folded in here because on this branch #26342 landed first. (cherry picked from commit e0d4fd3) (cherry picked from commit d705ea3)
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
…ptions to the producer (apache#26371) Backport of the branch-4.2 fix, limited to pulsar-testclient: apache#26371's hunks in ProducerConfigurationData and ProducerBuilderImplTest already arrived on this branch with the apache#26342 backport (4c9e045), which carries the same "maxPendingMessagesAcrossPartitions needs to be >= 0" relaxation. The branch-4.2 follow-up d705ea3, which adapted the pulsar-perf test once apache#26342 landed there, is folded in here because on this branch apache#26342 landed first. (cherry picked from commit e0d4fd3) (cherry picked from commit d705ea3)
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
…ptions to the producer (apache#26371) Backport of the branch-4.2 fix, limited to pulsar-testclient: apache#26371's hunks in ProducerConfigurationData and ProducerBuilderImplTest already arrived on this branch with the "maxPendingMessagesAcrossPartitions needs to be >= 0" relaxation. The branch-4.2 follow-up d705ea3, which adapted the pulsar-perf test once apache#26342 landed there, is folded in here because on this branch apache#26342 landed first. (cherry picked from commit e0d4fd3) (cherry picked from commit d705ea3)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |