Skip to content

[feat] PIP-468: V5 flow-control knob test coverage#25689

Merged
merlimat merged 1 commit intoapache:masterfrom
merlimat:st-v5-flow-control-tests
May 6, 2026
Merged

[feat] PIP-468: V5 flow-control knob test coverage#25689
merlimat merged 1 commit intoapache:masterfrom
merlimat:st-v5-flow-control-tests

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

@merlimat merlimat commented May 5, 2026

Summary

Coverage gap from the V5 audit — the plumbing for these knobs was wired but never exercised in any test, so a regression that broke the V5 → v4 mapping would have shipped silently. Pins the contract for four flow-control settings.

Test class Tests What it covers
V5ConsumerPriorityLevelTest 2 Behavioral: high + low priority consumers on a Shared subscription. With prefetch drained by acks, the high-priority consumer receives every message; with prefetch full (no acks), the broker overflows to the low one. Single-segment topic to keep per-segment dispatch deterministic.
V5ConsumerReceiverQueueSizeTest 2 receiverQueueSize(int) propagates from the V5 builder to every per-segment v4 ConsumerImpl — verified via reflection on segmentConsumers + ConsumerBase.getCurrentReceiverQueueSize(). Covers single-segment and 3-segment topics.
V5ProducerFlowControlTest 4 sendTimeout(Duration) and blockIfQueueFull(boolean) propagate from the V5 builder to every per-segment v4 ProducerImpl — verified via reflection on segmentProducers + ProducerBase#conf. Tests cover blockIfQueueFull(true), blockIfQueueFull(false), single-segment sendTimeout, and 3-segment sendTimeout. Sends warm-up messages before reading state because V5 segment producers are created lazily on first send.

Why config-propagation tests for the producer knobs and not behavioral? Behavioral verification of the actual timeout-firing and queue-full paths lives in the v4 test suite (SimpleProducerConsumerTest.testSendTimeout etc.); those tests stop the broker mid-send to force the pending-queue overflow / timeout, which the in-process SharedPulsarBaseTest cluster used here cannot do. The plumbing tests added here suffice as a regression guard for the V5 → v4 mapping.

Test plan

  • All 8 new tests pass (8 of 8).
  • Full V5 broker test suite green (133/133).
  • pulsar-broker checkstyle clean.

Coverage gap from the V5 audit. The plumbing was wired but never
exercised — these tests pin the V5 → v4 contract for four flow-control
knobs that were previously easy to silently break.

V5ConsumerPriorityLevelTest:
- High + low priority consumers on a Shared subscription. With prefetch
  drained by acks, the high-priority consumer receives every message;
  with prefetch full (no acks), the broker overflows to the low one.
- Single-segment topic to keep per-segment dispatch deterministic.

V5ConsumerReceiverQueueSizeTest:
- receiverQueueSize(int) propagates from the V5 builder to every
  per-segment v4 ConsumerImpl. Verified via reflection on
  segmentConsumers + ConsumerBase.getCurrentReceiverQueueSize().
- Covers both single-segment and 3-segment topics.

V5ProducerFlowControlTest:
- sendTimeout(Duration) and blockIfQueueFull(boolean) propagate from the
  V5 builder to every per-segment v4 ProducerImpl. Verified via
  reflection on segmentProducers + ProducerBase#conf.
- Tests cover blockIfQueueFull(true), blockIfQueueFull(false),
  single-segment sendTimeout, and 3-segment sendTimeout.
- Sends warm-up messages before reading state because V5 segment
  producers are created lazily on first send.

Behavioural verification of the actual timeout-firing and queue-full
paths still lives in the v4 test suite (SimpleProducerConsumerTest
.testSendTimeout etc.); those tests stop the broker mid-send to force
the pending-queue overflow / timeout, which the in-process shared
cluster used here cannot do. The plumbing tests added here suffice as a
regression guard for the V5 → v4 mapping.
@merlimat merlimat changed the title PIP-468: V5 flow-control knob test coverage [feat] PIP-468: V5 flow-control knob test coverage May 5, 2026
@merlimat merlimat merged commit a1f4473 into apache:master May 6, 2026
117 of 122 checks passed
@merlimat merlimat deleted the st-v5-flow-control-tests branch May 6, 2026 01:33
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.

2 participants