Commit Graph

3501 Commits

Author SHA1 Message Date
Bill Bejeck 31545eb614
Add integration test for IQv2 in KIP-1071 (#18856)
* Merging the Refactory to add standby tasks heartbeat response
added test

Add stability check and refactor partition assignments

Introduces a `membersStable` method in `StreamsGroup` to ensure group members are in a stable state before partition assignments. Refactors `EndpointToPartitionsManager` to streamline input topic handling and updates related tests for clarity and correctness. Adds integration test for validating partition assignment logic with multiple configurations.

* Refactor IQv2 metadata handling and endpoint partition mapping.

Streamlined metadata validation logic in IQv2 integration tests and removed redundant code. Simplified `maybeBuildEndpointToPartitions` by eliminating unnecessary stability checks, improving clarity and maintainability of endpoint-to-partition mapping.

* Remove unused `membersStable` method from StreamsGroup

* Refactor and enhance IQv2 test metadata validation.

Replaced redundant variable names and improved metadata handling for active and standby tasks in the IQv2 test. Added validations for state store names using `EXPECTED_STORE_NAME` and organized metadata assertions to enhance clarity and testing coverage. These changes improve maintainability and ensure better validation of stream metadata.

* Add inspection of standby topics
2025-02-18 11:25:13 -05:00
Bill Bejeck 138c2a211a
Refactor heartbeat response to include standbys (#18827)
* Adding standby tasks heartbeat response

* Refactory to add standby tasks heartbeat response
added test

* Addressing comments plus some minor checkstyle side cleanup
2025-02-11 10:32:20 -05:00
Bruno Cadonna 6ec17cfc6d
Add warm-up tasks to Streams membership manager (#18214)
This commit adds warm-up tasks assignment to the
Streams membership manager.
2024-12-17 13:07:14 +01:00
Alieh Saeedi faf000be73
Implement kafka-streams-groups.sh --list (#18167)
Implement the core of kafka-streams-groups.sh
Implement --list and its options: (only --state)
2024-12-16 11:58:05 +01:00
Bruno Cadonna db1361d065
Add standby task assignment to Streams membership manager (#18077)
Until now the Streams membership manager only processed active tasks. This commit adds the capability to also handle assigned standby tasks.
2024-12-13 16:36:44 +01:00
Lucas Brutschy c5d6f1aab5
Add describeStreamsGroup to Admin API (#18125)
Adds describeStreamsGroup to Admin API.

Also includes some minor clean-ups in the describe RPC.
2024-12-12 15:06:17 +01:00
Bill Bejeck 4e1b29d8aa Add KIP-1082 (#18044)
This PR integrates KIP-1082 changes into the KIP-1071. The change centers around clients creating the member id on startup, vs. waiting for the GroupCoordinator to create the member id and return it in the response to initial heartbeat.

The changes were small and included some changes to the GroupMetadataManagerTest streams group related tests.
I'll add comments in-line regarding the updates. Overall, the impact can be best summarized by stating that now certain actions will now happen one epoch earlier. For example, task assignment would typically happen on epoch 2 (bumping up from 1) since clients waited for the membership id to be returned and the assignment occurred in the subsequent heartbeat request.

For testing, I updated the GroupMetadataManagerTest to get all tests passing.
2024-12-06 16:22:16 -05:00
Bruno Cadonna cf2586103e Use LeaveOnClose event with Streams membership manager (#18054)
The Streams membership manager did not use the LeaveOnClose event
to faster leaving the group on closing. With the event the Streams
membership manager leaves the group without invoking any callback
for releasing the active tasks.

With this commit the Streams membership member uses the LeaveOnClose
event.
2024-12-06 16:22:15 -05:00
Lucas Brutschy 9783c987f4 Implement support for streams groups in kafka-groups.sh (#18043)
Add support for streams groups in kafka-groups.sh, including a little integration test that spins up a kafka streams application and lists the group.
2024-12-06 16:22:15 -05:00
Lucas Brutschy dfc69c2301 MINOR: add endpoint to sync RPCs with KIP (#18035) 2024-12-06 16:22:15 -05:00
Bruno Cadonna ddfadf72ad Follow-ups to the integration of Streams membership manager (#18019) 2024-12-06 16:22:14 -05:00
Bill Bejeck ce9ce51e8e MINOR: Updates from running spotless apply (#18007) 2024-12-06 16:22:14 -05:00
Lucas Brutschy fb4a3e6fd7 Topology epochs and topic validation (#17721)
This PR implements two changes in the KIP, and related logic on client & server side.

We replace topology ID with topology epoch. We only include the basic changes to the schema and basic validation for now (fail if topology is changed without a topology epoch bump) - since topology updating will follow later on.
We add status codes for topic validation, and implement the required logic to validate the internal topics.
2024-12-06 16:22:13 -05:00
Bill Bejeck a085a76d49 Resolve conflict from 12/6 trunk rebase - KIP1071 trunk rebase 11_25 add streams membership manager stream thread integration (#17968)
Rebase on trunk
2024-12-06 16:22:12 -05:00
Bill 718fb9b2c4 Correctness updates from rebase 2024-12-06 16:22:11 -05:00
Lucas Brutschy 4a68f95cac Resolve conflict from 12/6 rebase - Resolve conflicts from 11/15 trunk rebase - Initialize topologies as part of heartbeat (#17695)
We merge the initialization of the Streams group into the heartbeat of the Streams group.
As a result the first heartbeat of a member (member epoch is zero) contains the topology
metadata required for initialization.
2024-12-06 16:22:11 -05:00
Bruno Cadonna 6cda02d7e8 Introduce the streams membership manager (#17564)
The streams membership manager manages the state of the member
and is responsible for reconciling the received task assignment
with the current task assignment of the member. Additionally,
it requests the call of the callback that installs the
reconciled task assignment in the Streams client.
2024-12-06 16:22:11 -05:00
Lucas Brutschy d43bdc3450 Resolve conflicts from trunk rebase - Port tools for topic configuration (#17371)
* KSTREAMS-6456: Port tools for topic configuration

Ports several tools for topic configuration from the client side, to the
broker-side. Several things are refactored:

 - Decoupling. On the client side, for example, RepartitionTopics was
   using the CopartitionedTopicEnforcer, the InternalTopicCreator, the
   TopologyMetadata and the Cluster objects. All of those are mocked
   with Mockito during testing. This points to bad coupling. We
   refactored all classes to be mostly self-sufficient, only relying on
   themselves and simple interfaces.
 - Tests only use JUnit5, not hamcrast matchers and no other streams
   utilities, to not pollute the group coordinator module.
 - All classes only modify the configurations -- the code does not
   actually call into the AdminClient anymore.
 - We map all errors to new errors in the broker, in particular,
   the error for missing topics, inconsistent internal topics, and
   invalid topologies.

We include the internal, mutable datastructures, that are set- and
map-based for effiecient algorithms. They are distinctly different
from the data represented in `StreamsGroupTopologyValue` and
`StreamsGroupInitializeRequest`, since regular expressions must
be resolved at this point.

Both the topic creation and internal topic validation will be
based on this code, the basics of this are implemented in the
`InternalTopicManager`.

Every time, either the broker-side topology or the topic metadata
on the broker changes, we reconfigure the internal topics, check
consistency with the current topics on the broker, and possibly
trigger creation of the missing internal topics. These changes
will be built on top of this change.

* formatting fixes
2024-12-06 16:22:10 -05:00
Bruno Cadonna 8b6d3f921d Resolve conflicts from 11/25 trunk rebase - MINOR: Rebase dev branch on current trunk 2024-12-06 16:22:09 -05:00
Lucas Brutschy 4f1328f5b0 Complete topic metadata for automatic topic creation (#17391)
* KSTREAMS-6456: Complete topic metadata for automatic topic creation

This change updates the current RPCs and schemas to add the following
metadata:

 - copartition groups are added to topology record and initialize RPC
 - multiple regexs are added to topology record and initialize RPC
 - replication factors are added for reach internal topic

We also add code to fill this information correctly from the
`InternalTopologyBuilder` object.

The fields `assignmentConfiguration` and `assignor` in the
`StreamsAssignmentInterface` are removed, because they are not
needed anymore.

* fixes
2024-12-06 16:22:09 -05:00
Lucas Brutschy 8d0a6f84e5 MINOR: Fix unit tests (#17374)
* MINOR: Fix unit tests

Some unit tests were failing on the KIP1071 feature branch. This fixes
them.

* spotlessApply
2024-12-06 16:22:09 -05:00
Lucas Brutschy 09a2593457 MINOR: Use subtopologyId and spelling consistently (#17370)
Throughout RPCs, we were using subtopology instead of subtopologyId for
the string ID of a subtopology. We were also using sub-topology
spelling. Cleaning this up before merging the auto-topic creating code.
2024-12-06 16:22:08 -05:00
Lucas Brutschy c0ae9c5386 Resolve conflict from 11/25 trunk rebase - Rebase on AK trunk 2024-09-25 2024-12-06 16:22:08 -05:00
Matthias J. Sax ece269de75 Resolve confict from 12/6 rebase - Add broker configs for streams group
Adds broker configs for Streams group for the MVP.
2024-12-06 16:22:07 -05:00
Bruno Cadonna 9eba835a6f Improve the Streams group initialization handler
This commit:
- schedules a timeout for the initialization call
- requests the initialization only from the one member
- intializations of unknown topologies or already initialized topologies
are silently dropped
2024-12-06 16:22:06 -05:00
Bruno Cadonna 5ca2155e1d Rename streamsHeartbeatX and streamsInitializeX to streamsGroupX 2024-12-06 16:22:06 -05:00
Lucas Brutschy 50482108dd Minor: Revert test changes 2024-12-06 16:22:05 -05:00
Bruno Cadonna 00a7e85444 Resolve conflict from 11/25 trunk rebase - Rebase on AK trunk 2024-08-15 2024-12-06 16:22:05 -05:00
Lucas Brutschy 50cdd5f2dc Resolve conflicts from 12/6 rebase Resolve conflicts from 11/25 trunk rebase - Implement DescribeStreamsGroup RPC handling
Implement the DescribeStreamsGroup RPC handling for KIP-1071.
2024-12-06 16:22:04 -05:00
Bruno Cadonna 871aa86e88 Resovle conflicts from 11/25 trunk rebase - Update RPCs
Updates RPCs from KIP-1071
2024-12-06 16:22:04 -05:00
Bruno Cadonna ac6a2e4d48 Resolve conficts from 12/6 rebase Resolve conflicts for 11/25 trunk rebase - Rebased on AK trunk 2024-07-16 2024-12-06 16:22:03 -05:00
Lucas Brutschy a4a5245239 Resolve conflict in 12/6 rebase - Resolve conflicts from 11/25 rebase - Get SmokeTestDriverIntegrationTest working
See https://github.com/lucasbru/kafka/pull/22
2024-12-06 16:22:03 -05:00
Lucas Brutschy 1c69f5ab03 Minor: Rename TaskId to TaskIds
See https://github.com/lucasbru/kafka/pull/16
2024-12-06 16:22:01 -05:00
Lucas Brutschy 793b02a5fd Define initial record types for the consumer offset topic
The goal is to define initial record types for storing group metadata. The aim is roughly match the data represented in the RPCs and the KIP-848 records. There is an extra record for the topology that is called when StreamsInitialize is called.

See https://github.com/lucasbru/kafka/pull/14

target assignment and topology

current assignment

member metadata

names and version

initial copy
2024-12-06 16:22:00 -05:00
Lucas Brutschy e0b43baa93 Minor: Test fixes
Fixed some tests and some actual bugs. Added missing request parsing.

See https://github.com/lucasbru/kafka/pull/13
2024-12-06 16:21:59 -05:00
Lucas Brutschy eb2865d3b7 Resolve conflict from 11/25 trunk rebase - Create and inject StreamsHeartbeatRequestManager
Find a way to inject the StreamsHeartbeatRequestManager into AsyncKafkaConsumer from Kafka Streams

Also trigger assignment logic in Kafka Streams

See https://github.com/lucasbru/kafka/pull/12
2024-12-06 16:21:59 -05:00
Bruno Cadonna de6e314e08 Implement StreamsInitialize request manager
See https://github.com/lucasbru/kafka/pull/11
2024-12-06 16:21:59 -05:00
Lucas Brutschy c0f8c2fdaa Resolve merge conflict from 11/25 rebase - Specify AsyncKafkaConsumer interface with Streams for the Rebalance PoC
Extend internal AsyncKafkaConsumer interface to exchange rebalance information with Streams.

See https://github.com/lucasbru/kafka/pull/9
2024-12-06 16:21:58 -05:00
Lucas Brutschy 95f6e141de Resolve merge conflict from 11/25 trunk rebase - Define RPCs to perform client-side assignment
Even if we do not implement client-side assignment in the POC, let's define all public interfaces that will be part of the KIP in the branch, so that we have a single source of truth.

Also updates the RPCs following discussions with responsive

 * Adds "userdata" for client-side assignment to the RPCs, as requested by Sophie.
 * Use task offsets instead of task lags
 * Allow the task offsets to be updated for 4 reasons

See https://github.com/lucasbru/kafka/pull/8
2024-12-06 16:21:58 -05:00
Lucas Brutschy f5020ad2e0 Reslove merge conflict from 11/25 trunk rebase - StreamsInitialize RPC and some errors
Initial RPCs for StreamsInitialize.

See https://github.com/lucasbru/kafka/pull/7
2024-12-06 16:21:58 -05:00
Lucas Brutschy b719edae63 Very initial (compiling) streams RPCs.
Basic initial RPCS.

See https://github.com/lucasbru/kafka/pull/6
2024-12-06 16:21:57 -05:00
TengYao Chi 9ee3247281
MINOR: Fix broken javadoc in NetworkClientTest (#18075)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-12-07 01:37:30 +08:00
Calvin Liu 755adf8a56
KAFKA-14563: RemoveClient-Side AddPartitionsToTxn Requests (#17698)
Removes the client side AddPartitionsToTxn/AddOffsetsToTxn calls so that the partition is implicitly added as part of KIP-890 part 2. 

This change also requires updating the valid state transitions. The client side can not know for certain if a partition has been added server side when the request times out (partial completion). Thus for TV2, the transition to PrepareAbort is now valid for Empty, CompleteCommit, and CompleteAbort. 

For readability, the V1 and V2 endTransaction methods have been separated. 

Reviewers: Artem Livshits <alivshits@confluent.io>, Justine Olshan <jolshan@confluent.io>, Ritika Reddy <rreddy@confluent.io>
2024-12-06 09:00:04 -08:00
Andrew Schofield e7d986e48c
KAFKA-17550: DescribeGroups v6 exploitation (#17706)
This PR introduces the DescribeGroups v6 API as part of KIP-1043. This adds an error message for the described groups so that it is possible to get some context on the error. It also changes the behaviour for when the group ID cannot be found but returning error code GROUP_ID_NOT_FOUND rather than NONE.

Reviewers: David Jacot <djacot@confluent.io>
2024-12-05 23:12:24 -08:00
Lianet Magrans 36b48536f6
MINOR: Fix broken test (#18062)
Reviewers: David Jacot <djacot@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>, TaiJuWu <tjwu1217@gmail.com>
2024-12-05 21:31:52 -05:00
ShivsundarR 8fde6dedea
KAFKA-18155 : Fix bug in response handler for ShareAcknowledge (#18029)
In the response handler for ShareAcknowledge, we are passing the clientResponse.receivedTimeMs() to the handler methods. But when there is a disconnect or when the response received is null, we should be passing the current time instead.

This bug was causing consumer to hang as it did not call the handler methods on disconnect, and further requests were blocked waiting for its completion.

Reviewers: Andrew Schofield <aschofield@confluent.io>,  Apoorv Mittal <apoorvmittal10@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
2024-12-05 12:59:13 +05:30
Ken Huang 2b43c49f51
KAFKA-18050 Upgrade the checkstyle version to 10.20.2 (#17999)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-12-05 10:59:18 +08:00
Kirk True 4362ab7090
KAFKA-17947: Update currentLag(), pause(), and resume() to update SubscriptionState in background thread (#17699)
Reviewers: Lianet Magrans <lmagrans@confluent.io>
2024-12-04 21:31:44 -05:00
Lianet Magrans bd0ea70912
KAFKA-18096: Allow join with regex if no matching topics (#18024)
Reviewers: David Jacot <djacot@confluent.io>
2024-12-04 11:35:42 -05:00
Lianet Magrans f60382bf21
KAFKA-18127 Validate SubscriptionPattern used on v0 HB (#17989)
Reviewers: David Jacot <djacot@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2024-12-04 19:55:12 +08:00