Commit Graph

13792 Commits

Author SHA1 Message Date
David Arthur 7095280495
MINOR: Separate GH workflows for PRs and trunk (#16936)
This patch creates separate GitHub Actions workflows for trunk and for pull requests.

On trunk, each commit will be built separately and the build scan will be uploaded to ge.apache.org. The trunk builds will also populate a Gradle cache managed by Github Actions.

Pull Requests will be built on each commit, but will interrupt an ongoing build (for the same PR). These builds will not populate the Gradle cache and will not upload the build scan unless the PRs are in apache/kafka.

For now, only pull requests with branches named like "gh-*" will run the junit tests. This is to allow developers to opt-in to the GH build.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 18:39:42 -04:00
Mason Chen fb7e47f6e2
KAFKA-17169: Add EndpointsTest (#16659)
Reviewers: Omnia Ibrahim <o.g.h.ibrahim@gmail.com>, Colin P. McCabe <cmccabe@apache.org>
2024-08-20 15:08:28 -07:00
Xuan-Zhang Gong a537e716eb
KAFKA-17137 Ensure Admin APIs are properly tested (#16658)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-21 03:34:10 +08:00
Mickael Maison e23172a48a
MINOR: Move OffsetCheckpointFile to storage module (#16917)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 16:29:24 +02:00
Sean Quah c207438823
KAFKA-17279: Handle retriable errors from offset fetches (#16826)
Handle retriable errors from offset fetches in ConsumerCoordinator.

Reviewers: Lianet Magrans <lianetmr@gmail.com>, David Jacot <djacot@confluent.io>
2024-08-20 06:13:25 -07:00
David Jacot de67ac6a9a
MINOR: Update `getOrMaybeCreateClassicGroup` to only throw GroupIdNotFoundException (#35) (#16919)
This patch updates getOrMaybeCreateClassicGroup to only throw GroupIdNotFoundException as we did for other internal methods. The callers are responsible for translating the error to the appropriate one depending on the context. There is only one case.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 04:36:42 -07:00
ShivsundarR 932e84096a
KAFKA-17325: Updated result handling in ShareConsumeRequestManager::commitAsync(). (#16903)
Currently we were not updating the result count when we merged commitAsync() requests into one batch in ShareConsumeRequestManager, so this led to lesser acknowledgements sent to the application thread (ShareConsumerImpl) than expected.
Fix : Now if the acknowledge response came from a commitAsync, then we do not wait for other requests to complete, we always prepare a background event to be sent.

This PR also fixes a bug in ShareConsumeRequestManager, where during the final ShareAcknowledge sent during close(), we also pick up any piggybacked acknowledgements which were waiting to be sent along with ShareFetch.

 Reviewers:  Andrew Schofield <aschofield@confluent.io>,  Manikumar Reddy <manikumar.reddy@gmail.com>
2024-08-20 16:44:53 +05:30
Andrew Schofield f6bfa9406c
KAFKA-17350: Improve share group describe for empty groups (#16897)
When you use kafka-share-groups.sh --describe for an empty group, it prints an empty table consisting of only the table header. kafka-consumer-groups.sh summarises the group status to make the output more informative and only prints the table if it contains more than zero rows.

This PR applies this principle across all of the variants of describing share groups which makes the output much nicer where the output would otherwise be strangely empty.

Reviewers:  Manikumar Reddy <manikumar.reddy@gmail.com>
2024-08-20 12:05:08 +05:30
Kuan-Po Tseng 4271565409
KAFKA-16900 kafka-producer-perf-test reports error when using transaction. (#16646)
Currently, users need to set --transaction-duration-ms to enable transactions in kafka-producer-perf-test, which is not straightforward. A better approach is to enable transactions when a transaction ID is provided.

This PR allows enabling transaction in kafka-producer-perf-test by either

- set transaction.id=<id> via --producer-props or
- set transaction.id=<id> in config file via --producer.config or
- set --transaction-id <id> or
- set --transaction-duration-ms=<ms>

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 10:23:55 +08:00
David Arthur 4e1a015d36
MINOR: Remove 11 and 17 from GH workflow (#16927)
This patch removes Java versions 11 and 17 from the "check" job. This patch also fixes the develocity build scan upload.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 21:59:36 -04:00
Chung, Ming-Yen 65786fecbf
KAFKA-17181 Replace fileChannel.write with Utils.writeFully to prevent partial write (#16707)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 09:26:43 +08:00
TengYao Chi c3d552d273
KAFKA-12824 Remove Deprecated method KStream#branch (#16803)
The method branch in both Java and Scala KStream class was deprecated in version 2.8:

1) org.apache.kafka.streams.scala.kstream.KStream#branch
2) org.apache.kafka.streams.kstream.KStream#branch(org.apache.kafka.streams.kstream.Predicate<? super K,? super V>...)
3) org.apache.kafka.streams.kstream.KStream#branch(org.apache.kafka.streams.kstream.Named, org.apache.kafka.streams.kstream.Predicate<? super K,? super V>...)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 09:05:13 +08:00
José Armando García Sancio ee71156295
KAFKA-17332; Controller always flush and can call resign on observers (#16907)
This change includes two improvements.

When the leader removes itself from the voters set clients of RaftClient may call resign. In those cases the leader is not in the voter set and should not throw an exception.

Controllers that are observers must flush the log on every append because leader may be trying to add them to the voter set. Leader always assume that voters flush their disk before sending a Fetch request.

Reviewers: David Arthur <mumrah@gmail.com>, Alyssa Huang <ahuang@confluent.io>
2024-08-19 20:44:23 -04:00
David Schlosnagle 050edfaf00
KAFKA-14336: MetadataResponse#convertToNodeArray uses iteration (#12782)
Avoids stream allocation on hot code path in Admin#listOffsets

This patch avoids allocating the stream reference pipeline & spliterator for this case by explicitly allocating the pre-sized Node[] and using a for loop with int induction over the specified IDs List argument.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Kirk True <kirk@kirktrue.pro>, David Arthur <mumrah@gmail.com>
2024-08-19 19:46:51 -04:00
Greg Harris b40b5a24f4
KAFKA-17369: Remove Reflections from logging and update licenses (#16924)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 16:27:36 -07:00
PoAn Yang d0cd3a899a
KAFKA-17180 Upgrade gradle from 8.8 to 8.10 (#16908)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 06:37:59 +08:00
Andrew Schofield 34475070e1
KAFKA-17368 Add delivery count to kafka-console-share-consumer.sh (#16925)
Now that ConsumerRecord.deliveryCount() exists, enhance kafka-console-share-consumer.sh to exploit it. Added support to the DefaultMessageFormatter and the option print.delivery to the usage message for kafka-console-share-consumer.sh. Note that it was not added to kafka-console-consumer.sh even though the option would be recognised - this is because delivery with a consumer group does not count deliveries, and the result would include Delivery:NOT_PRESENT for all records if it was enabled - not really that useful with a consumer group.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 06:19:36 +08:00
David Arthur 3d868aacf2
MINOR add GH action for PR builds (#16895)
For now this will only run on PRs with branch names starting with "gh-"

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 16:46:20 -04:00
David Arthur fd60d2d980
MINOR add tags for Gradle build scans (#16923)
This adds three tags for the Gradle build scans: jenkins, github, and local. Adding these tags will allow us to more easily differentiate build scan statistics based on the origin of the build.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 16:40:21 -04:00
Apoorv Mittal 3db6e68c4c
KAFKA-17346: Create :share Gradle module (#16888)
Establishes the new `:share` Gradle module. This module is intended to be used for server-side KIP-932 classes that are not part of the new share group coordinator.

This patch relocates and renames some existing classes. A small amount of compatibility changes were also made, but do not affect any logic.

Reviewers: Andrew Schofield <aschofield@confluent.io>, David Arthur <mumrah@gmail.com>
2024-08-19 16:13:08 -04:00
Ken Huang e38fc50d1e
MINOR: inter.broker.protocol.version is not clearly in KRaft and Zookeeper mode (#16910)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 04:00:51 +08:00
Logan Zhu d28ddcb9f4
KAFKA-17357 Replace the deprecated `retry.maxRetries` / retry.maxFailures` (#16913)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-20 01:57:24 +08:00
Steven Xu e24354a21d
KAFKA-15203: Use Classgraph since org.reflections is no longer under maintenance (#16604)
Reviewers: Liam Miller-Cushon <cushon@google.com>, Greg Harris <greg.harris@aiven.io>
2024-08-19 10:46:24 -07:00
PoAn Yang 2f0ae82d4a
KAFKA-12989 MockClient should respect the request matcher passed to prepareUnsupportedVersionResponse (#16849)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 23:19:01 +08:00
Apoorv Mittal b63b20eeee
KAFKA-16749: [Minor] Addressed additional review comments (#16890)
Reviewers: Andrew Schofield <aschofield@confluent.io>, Jun Rao <junrao@gmail.com>
2024-08-19 07:38:00 -07:00
Sushant Mahajan 4928b549fa
KAFKA-17330: New share-coordinator module. Added record schemas. (#16877)
What
Introduced a new module share-coordinator to house relevant implementation code and resources.
Modified settings.gradle and build.gradle to accommodate the module.
Added ShareSnapshot[Key, Value], ShareUpdate[Key, Value] message record schemas.
Introduced a trivial impl of ShareCoordinatorShard class to establish dependencies with other modules (:coordinator-common, :metadata). The actual impl for this class will be done in future PRs.

Why
The share coordinator component has been introduced as part of KIP-932 (QFK). This component is will be responsible for managing persistence for various data related to share partitions into a dedicated internal topic.
To keep all this functionality contained, we want to create a separate module in line with group and transaction coordinators.


Reviewers:  Andrew Schofield <aschofield@confluent.io>, Apoorv Mittal <apoorvmittal10@gmail.com>,  Manikumar Reddy <manikumar.reddy@gmail.com>
2024-08-19 19:24:07 +05:30
lushilin 5f02ef952e
KAFKA-17340 correct the docs of allow.auto.create.topics (#16880)
Reviewers: Guozhang Wang <wangguoz@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 03:56:25 +08:00
Eric Chang 4b41071165
KAFKA-17086 add missing Java 21 to ops.html (#16911)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 00:51:27 +08:00
Sushant Mahajan c5e9154672
KAFKA-17342 Moved common coordinator code to separate module (#16883)
There is a lot of code in group-coordinator which is not share/consumer/classic group specific.

Since we are introducing a share-coordinator as part of KIP-932 (in a new module), it would make sense to get the common coordinator functionality into a separate common coordinator module so that share-coordinator need not depend on group-coordinator.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, David Jacot <djacot@confluent.io>, Andrew Schofield <aschofield@confluent.io>, Jeff Kim <jeff.kim@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-18 21:48:44 +08:00
Justine Olshan fd544024aa
Make TestFeatureVersion 2 always map to MetadataVersion.latestTesting (#16901)
After some discussion on: https://github.com/apache/kafka/pull/16841#discussion_r1714322320

We decided it is best for test version to always map to MetadataVersion.latestTesting. We should always have one unstable MV (either because there is a feature being worked on OR when we mark the latest version stable we create a new one).

Reviewers: Jun Rao <junrao@apache.org>
2024-08-16 17:29:08 -07:00
Clay Johnson 2a6f449af7
KAFKA-17352 Migrate from Gradle Enterprise Gradle Plugin to Develocity Gradle Plugin (#16902)
Reviewers: David Arthur <mumrah@gmail.com>
2024-08-16 17:34:26 -04:00
José Armando García Sancio 20c3e7324b
KAFKA-16842; Fix config validation and support unknown voters (#16892)
This change fixes the Kafka configuration validation to take into account the reconfiguration changes to configuration and allows KRaft observers to start with an unknown set of voters.

For the Kafka configuration validation the high-level change is that now the user only needs to specify either the controller.quorum.bootstrap.servers property or the controller.quorum.voters property. The other notable change in the configuration is that controller listeners can now be (and should be) specified in advertise.listeners property.

Because Kafka can now be configured without any voters and just the bootstrap servers. The KRaft client needs to allow for an unknown set of voters during the initial startup. This is done by adding the VoterSet#empty set of voters to the KRaftControlRecordStateMachine.

Lastly the RaftClientTestContext type is updated to support this new configuration for KRaft and a test is added to verify that observers can start and send Fetch requests when the voters are unknown.

Reviewers: David Arthur <mumrah@gmail.com>
2024-08-16 15:53:13 -04:00
Apoorv Mittal 9f330c374d
KAFKA-16753: [MINOR] Addressing additional review comments (#16894)
Reviewers: Jun Rao <junrao@gmail.com>
2024-08-16 11:59:57 -07:00
Apoorv Mittal cd47b3c1cc
KAFKA-17283: Integration test for share group heartbeat (#16823)
The PR adds integration test for share group. 

Reviewers: Andrew Schofield <aschofield@confluent.io>, Manikumar Reddy <manikumar.reddy@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-16 18:03:40 +05:30
ShivsundarR 8cfd631264
KAFKA-16723 : Added kafka-console-share-consumer.sh tool. (#16860)
Added kafka-console-share-consumer.sh which will start a share consumer on a share group.
This tool helps to read data from Kafka topics using share groups and outputs it to standard output.

Reviewers:  Andrew Schofield <aschofield@confluent.io>, Apoorv Mittal <apoorvmittal10@gmail.com>,  Manikumar Reddy <manikumar.reddy@gmail.com>
2024-08-16 15:26:54 +05:30
Apoorv Mittal 011d35237c
KAFKA-16752: [MINOR] Addressed additional review comments (#16891)
Reviewers: Andrew Schofield <aschofield@confluent.io>, Jun Rao <junrao@gmail.com>
2024-08-15 14:36:39 -07:00
xijiu 21dd5cd421
KAFKA-16818 Move event processing-related tests from ConsumerNetworkThreadTest to ApplicationEventProcessorTest (#16875)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-16 02:27:52 +08:00
TengYao Chi 81f0b13a70
KAFKA-17238 Move VoterSet and ReplicaKey from raft.internals to raft (#16775)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-16 00:24:51 +08:00
Andrew Schofield 7031855570
KAFKA-17318 ConsumerRecord.deliveryCount and remove deprecations (#16872)
Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-16 00:11:08 +08:00
Josep Prat adaf2d390f
MINOR: Fix visibility for classes exposed outside of their scope (#16886)
These 2 classes are package protected but they are part of the public
API of public methods. To have clean APIs we should make this
consistent.

Static class ReplicaState is exposed in RaftUtil#singletonDescribeQuorumResponse method which is public.

RequestSender is implemented by a public class and it's exposed in the public constructor of AddVoterHandler.

Reviewers: José Armando García Sancio <jsancio@apache.org>
2024-08-15 12:10:10 -04:00
Ken Huang b767c65527
KAFKA-17326 The LIST_OFFSET request is removed from the "Api Keys" page (#16870)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-15 18:59:38 +08:00
José Armando García Sancio 0f7cd4dcde
KAFKA-17304; Make RaftClient API for writing to log explicit (#16862)
RaftClient API is changed to separate the batch accumulation (RaftClient#prepareAppend) from scheduling the append of accumulated batches (RaftClient#schedulePrepatedAppend) to the KRaft log. This change is needed to better match the controller's flow of replaying the generated records before replicating them. When the controller replay records it needs to know the offset associated with the record. To compute a table offset the KafkaClient needs to be aware of the records and their log position.

The controller uses this new API by generated the cluster metadata records, compute their offset using RaftClient#prepareAppend, replay the records in the state machine, and finally allowing KRaft to append the records with RaftClient#schedulePreparedAppend.

To implement this API the BatchAccumulator is changed to also support this access pattern. This is done by adding a drainOffset to the implementation. The batch accumulator is allowed to return any record and batch that is less than the drain offset.

Lastly, this change also removes some functionality that is no longer needed like non-atomic appends and validation of the base offset.

Reviewers: Colin Patrick McCabe <cmccabe@apache.org>, David Arthur <mumrah@gmail.com>
2024-08-14 15:42:04 -04:00
Dongnuo Lyu 5dd4d84eec
KAFKA-17272: [1/2] System test framework for consumer protocol migration (#16845)
This patch adds the necessary framework for system tests of consumer protocol upgrade/downgrade paths. The change mainly includes
- adding `ConsumerProtocolConsumerEventHandler` for the consumers using the new protocol.
- some other fixes to consumer_test.py with the new framework which fixes
  - [KAFKA-16576](https://issues.apache.org/jira/browse/KAFKA-16576): fixed by getting `partition_owner` after the group is fully stabilized.
  - [KAFKA-17219](https://issues.apache.org/jira/browse/KAFKA-17219): The first issue is the same as KAFKA-16576. The second issue is fixed by taking `num_rebalances` after the group is fully stabilized.
  - [KAFKA-17295](https://issues.apache.org/jira/browse/KAFKA-17295): Same as KAFKA-17219 second issue. Fixed by taking `num_rebalances` after the group is fully stabilized.

A test result of `tests/kafkatest/tests/client` is [here](https://confluent-open-source-kafka-branch-builder-system-test-results.s3-us-west-2.amazonaws.com/trunk/2024-08-13--001.54e3cf70-869c-465c-bd7a-2ec0c26b2f05--1723594100--confluentinc--kip-848-migration-system-test-framework-comment-aug12--2388f23da7/report.html).

Reviewers: David Jacot <djacot@confluent.io>
2024-08-14 06:47:51 -07:00
DL1231 3a0efa2845
KAFKA-14510; Extend DescribeConfigs API to support group configs (#16859)
This patch extends the DescribeConfigs API to support group configs.

Reviewers: Andrew Schofield <aschofield@confluent.io>, David Jacot <djacot@confluent.io>
2024-08-14 06:37:57 -07:00
Andrew Schofield d64f4b9cd0
KAFKA-16714: kafka-share-groups.sh list and describe (#16835)
Introduces kafka-share-groups.sh for listing and describing share groups. The PR also contains the remaining options in the command parser and usage message in preparation of their implementation.

Reviewers:  Manikumar Reddy <manikumar.reddy@gmail.com>, Apoorv Mittal <apoorvmittal10@gmail.com>
2024-08-14 16:22:26 +05:30
xijiu 75bcb9eb42
KAFKA-17239 add request-latency metrics for node in admin client (#16832)
Reviewers: TengYao Chi <kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-14 04:33:47 +08:00
Andrew Schofield 8d29bc1fa8
KAFKA-17247 Revised share group record schemas (#16786)
In KIP-932, the group coordinator does not persist assignments for share groups. While this sounds like a good idea in terms of minimising overhead for data which doesn't strictly need to be recoverable, it significantly adds to the complexity of working with the coordinator framework.

This PR revises the definitions of the share group record schemas following more closely the schemas used for consumer groups, and eliminating the need to maintain soft state alongside the group coordinator's timeline structure.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-14 02:21:00 +08:00
TengYao Chi ad08ec600f
KAFKA-16682 Rewrite JaasTestUtils by Java (#16579)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-14 02:11:33 +08:00
TaiJuWu 5b9cbcf886
KAFKA-16689 Move LogValidatorTest to storage module (#16167)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-13 23:04:31 +08:00
xijiu 079c82906d
MINOR: Fix some transaction state flaky junit tests in PlaintextAdminIntegrationTest (#16861)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-13 22:49:08 +08:00