KAFKA-20697: Add cross-version system tests for the streams rebalance protocol - #23145
Closed
suzhiking wants to merge 1 commit into
Closed
KAFKA-20697: Add cross-version system tests for the streams rebalance protocol#23145suzhiking wants to merge 1 commit into
suzhiking wants to merge 1 commit into
Conversation
… protocol Kafka 4.4 bumps the streams rebalance protocol RPCs, StreamsGroupHeartbeat (apiKey 88) and StreamsGroupDescribe (apiKey 89), from version 0 to version 1. Heartbeat response v1 replaces the v0 int32 AcceptableRecoveryLag field with an ignorable int64 AcceptableRecoveryLag, adds TopologyDescriptionRequired (KIP-1331), and permits the new MISSING_CLIENT_TAGS status code (KAFKA-20744), which the coordinator only returns on v1 requests since v0 clients do not know the code. Describe v1 adds IncludeTopologyDescription on the request and TopologyDescription, TopologyDescriptionStatus and AssignorName on the response (KIP-1331, KIP-1357). New fields flow only when both sides are 4.4+, so mixed-version deployments must keep working in both directions. Add ducktape coverage using 4.2.1/4.3.1 as the older side, 4.2 being the earliest release that supports streams groups (streams.version 1 requires metadata version 4.2-IV1). The tests drive the StreamsUpgradeTest harness, which ships in the 4.2/4.3 streams test jars, with group.protocol=streams. New streams_protocol_cross_version_test.py: - test_new_client_old_broker: a trunk client against 4.2/4.3/dev brokers reaches RUNNING; the client logs acceptableRecoveryLag as not provided exactly when the broker answered with a v0 heartbeat response. - test_old_client_new_broker: a 4.2/4.3 client against a trunk broker reaches RUNNING; the ignorable v1 lag field is dropped cleanly at v0. - test_missing_client_tags_status_gated_by_rpc_version: with rack-aware assignment tags required but not configured on the client, only a trunk client is sent the MISSING_CLIENT_TAGS status; 4.2/4.3 clients never see it. - test_missing_client_tags_status_absent_when_tag_configured: a trunk client that does configure the required tag receives no such status, proving the version gate is not simply never firing. - test_describe_new_tool_old_broker: plain kafka-streams-groups.sh --describe from trunk works against 4.2/4.3 brokers; --describe --topology cannot be served at describe v0 and must fail diagnosably rather than hang. - test_describe_old_tool_new_broker: the 4.2/4.3 CLI describes a group hosted on a trunk broker. - test_topology_description_not_stored_for_old_client: a plugin-configured trunk broker reports no stored topology description for a 4.2/4.3 client, which can never be asked to push one. Extended streams_topology_description_plugin_test.py: - test_no_push_solicited_by_old_broker: a trunk client against a 4.2/4.3 broker is never solicited for a topology description push and never sends one, since TopologyDescriptionRequired only exists in response v1. The headline scenario of KAFKA-20697, verifying that clients which cannot report task offsets are never assigned warm-up tasks, is deliberately not covered yet: the group coordinator's AssignmentRefiner is still a stub that returns the target assignment unchanged, so such a test would pass vacuously until KAFKA-20665 lands.
Contributor
Author
|
Superseded by a re-opened PR from a renamed branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Kafka 4.4 bumps the streams rebalance protocol RPCs,
StreamsGroupHeartbeat(apiKey 88) andStreamsGroupDescribe(apiKey 89), from version 0 to version 1:AcceptableRecoveryLagfield with an ignorable int64AcceptableRecoveryLag, addsTopologyDescriptionRequired(KIP-1331), and permits the newMISSING_CLIENT_TAGSstatus code (KAFKA-20744), which the coordinator only returns on v1 requests because v0 clients do not know the code. The heartbeat request is byte-identical between v0 and v1; it was bumped so the response version is negotiated.IncludeTopologyDescriptionon the request andTopologyDescription,TopologyDescriptionStatusandAssignorNameon the response (KIP-1331, KIP-1357).New fields flow only when both sides are 4.4+, so mixed-version deployments must keep working in both directions. This PR adds ducktape coverage for that, using 4.2.1/4.3.1 as the older side — 4.2 is the earliest release that supports streams groups (
streams.version1 requires metadata version 4.2-IV1). The tests drive theStreamsUpgradeTestharness, which ships in the 4.2/4.3 streams test jars and accepts arbitrary config from its properties file, withgroup.protocol=streams.New suite:
streams_protocol_cross_version_test.py(7 tests, 15 matrix cases)test_new_client_old_brokeracceptableRecoveryLag=not provided (older broker)exactly when the broker answered v0; noUnsupportedVersionExceptiontest_old_client_new_brokertest_missing_client_tags_status_gated_by_rpc_versiongroup.streams.rack.aware.assignment.tagsset and no client tag configured, only the dev client is sentMISSING_CLIENT_TAGS; 4.2/4.3 clients never see ittest_missing_client_tags_status_absent_when_tag_configuredtest_describe_new_tool_old_brokerkafka-streams-groups.sh --describefrom dev works against old brokers;--describe --topologycannot be served at describe v0 and must fail diagnosably rather than hangtest_describe_old_tool_new_brokertest_topology_description_not_stored_for_old_clientExtended:
streams_topology_description_plugin_test.py(+1 test, 2 matrix cases)test_no_push_solicited_by_old_broker(broker 4.2.1/4.3.1): a dev client against an old broker is never solicited for a topology description push and never sends one, sinceTopologyDescriptionRequiredonly exists in response v1.setup_kafkagained an optionalbroker_versionparameter; the three existing tests are unchanged.Deliberately not covered yet
The headline scenario of KAFKA-20697 — verifying that clients which cannot report task offsets are never assigned warm-up tasks — is not testable on current trunk:
AssignmentRefiner.refine()is still a stub that returns the target assignment unchanged, so the assertion would pass vacuously. That test should follow once KAFKA-20665 lands.Notes for reviewers
test_describe_new_tool_old_brokerasserts only that the--topologyfailure names the unsupported field or version. Today the CLI exits 1 with a generic message and a stack trace (theUnsupportedVersionExceptionfrom serializing the non-ignorableIncludeTopologyDescriptionat v0 falls through to the top-levelcatch (Throwable)); the--delete-offsetspath already models a friendlier "not supported by the broker version" message. Whether describe should degrade gracefully is left as a follow-up; the assertion is deliberately loose so it survives such a fix.Testing
Both files byte-compile, and an AST-level check validates that every
@matrixkey matches its test method signature (the checker reproduces the known 30 cases ofstreams_broker_compatibility_test.py). All asserted log lines and CLI outputs were verified against the shipped sources of 4.2.1, 4.3.1 and trunk (e.g. theState transition from REBALANCING to RUNNINGline exists in all three; theMISSING_CLIENT_TAGSdetail string and thenot provided (older broker)rendering are trunk-side). A ducktape run of the two suites has not been executed yet; results will be posted on this PR.