Skip to content

M7, ports part 3: the Stream consumer - #50

Merged
merlimat merged 1 commit into
mainfrom
m7-ports-stream
Nov 23, 2026
Merged

merlimat merged 1 commit into
mainfrom
m7-ports-stream

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

Java V5 tests of the Stream consumer, ported (PLAN.md, M7: tests/PORTING.md shows the Java scenarios in scope covered; that file follows in its own PR). Only test code changes.

Java Rust
V5CumulativeAckTest.testRetryingAnAckIssuedWhileDisconnectedAdvancesTheCursor protocol consumer.rs::a_cumulative_ack_made_while_disconnected_goes_first_on_the_next_subscription
V5MultipleConsumersTest.testStreamConsumersSplitSegmentsAcrossConsumers, and V5MultiBrokerScalableTopicTest.testStreamConsumerControllerCoordinationAcrossBrokers on one broker testkit stream_consumer.rs::members_split_the_segments_and_each_message_goes_to_one
V5MultipleConsumersTest.testStreamConsumerReconnectWithinGraceKeepsAssignment testkit stream_consumer.rs::a_member_back_under_its_name_takes_the_same_keys_again
V5StreamConsumerOrderingTest.testPerKeyOrderAcrossAnEmptySegment testkit stream_consumer.rs::keys_keep_their_order_across_an_empty_segment (beside an_empty_segment_does_not_let_its_children_ahead_of_its_parent, which joins after the splits)
V5EntryBucketDispatchTest.testConsumerJoiningMidTrafficPreservesPerKeyOrder testkit stream_consumer.rs::a_member_joining_mid_traffic_keeps_each_key_in_order
V5EntryBucketDispatchTest.testSegmentReleaseWithPendingAcksHandsOffCleanly testkit stream_consumer.rs::a_segment_moves_once_what_was_taken_from_it_is_acknowledged
V5EntryBucketDispatchTest.testConsumerRejoiningAfterLeaveDoesNotWedgeRelease testkit stream_consumer.rs::members_beyond_the_segments_share_them_by_bucket (extended: a third member joins after the second left)
V5SubscriptionInitialPositionTest.testStreamConsumerLatestSkipsPriorMessages stream_tests.rs::a_consumer_at_latest_skips_what_was_stored_before
V5ScalableTopicAutoCreateTest.testStreamConsumerAutoCreatesScalableTopic, and the Stream consumer's part of testNoAutoCreateWhenNamespaceDisallows stream_tests.rs::a_missing_topic_is_created_or_not_found
V5AuthErrorTest.testLookupNotAuthorized (Stream consumer) stream_tests.rs::a_refused_lookup_fails_the_subscribe
The spec's C15 for the Stream consumer stream_tests.rs::a_broker_without_scalable_topics_is_refused
V5MultiBrokerControllerFailoverTest (the client's side), ClientSegmentLayoutTest.testControllerBrokerUrlPropagated (driver) stream_tests.rs::follows_the_controller_the_layout_names_across_brokers: three simulated brokers, the layout naming the controller on one, then on another once the first drops its connections

A bug, pinned by an ignored test

stream_tests.rs::follows_the_controller_while_a_producer_holds_the_layout_watch is the same failover with a producer of the topic on the client, as in Java's testStreamConsumerFollowsControllerLeaderShutdown. It fails, so it is #[ignore]d with the reason: the consumer registers again with the old controller.

  • stream_task::controller() reads the controller from the topic's layout watch, which it shares with the producer.
  • A controller takeover keeps the layout's epoch, and the watch ignores a layout that doesn't supersede the one it has.
  • Java opens a new watch for each registration attempt, and client-behavior §8 says to re-run the lookup after a lost connection.

From the code, a grouped Checkpoint member holds the watch itself, so it would keep the old controller even alone. A fix follows in its own PR, which removes the #[ignore].

Not ported

  • The split after the failover, in testStreamConsumerFollowsControllerLeaderShutdown: the simulated controllers would need one cluster behind several listeners.
  • A TLS controller URL on the driver: the simulated cluster sets none. Reading it from the layout is tested in protocol layout.rs.

Testing

  • Every workspace test passes, and each new or extended test passed 5 runs in a row; the testkit's stream tests passed 30.
  • Each new test was checked against a client (or a simulated controller) broken on purpose, in the way it guards against: it fails.
  • cargo fmt; clippy -D warnings with Rust 1.100. No library code changes.

Java V5's tests of the Stream consumer that had no Rust counterpart, ported (PLAN.md, M7;
tests/PORTING.md follows in its own PR): a cumulative ack made while disconnected going first
on the next subscription, members splitting the segments, a member back under its name taking
the same keys again, keys keeping their order across an empty segment and as a member joins
mid-traffic, a segment moving once what was taken from it is acknowledged, a member joining
after another left, a consumer at latest, a missing topic created or not found, a refused
lookup, a broker without scalable topics, and following the controller the layout names
across brokers. Only test code changes.

follows_the_controller_while_a_producer_holds_the_layout_watch is the same controller
failover with a producer of the topic on the client. It fails, so it is ignored with the
reason: registering again takes the controller from the layout watch the producer holds,
which names the old one. A fix follows in its own PR.
@merlimat
merlimat merged commit eec9645 into main Nov 23, 2026
15 checks passed
@merlimat
merlimat deleted the m7-ports-stream branch November 23, 2026 23:37
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