Commit Graph

13998 Commits

Author SHA1 Message Date
Abhinav Dixit cb3b03377d
KAFKA-17742: Move DelayedShareFetchPurgatory declaration to ReplicaManager (#17437)
Declare the delayed share fetch purgatory inside ReplicaManager along with the existing purgatories. 

Check the share fetch purgatory when a replica becomes the follower or a replica is deleted from a broker through ReplicaManager.

Perform a checkAndComplete for share fetch when HWM is updated.

Reviewers:  Andrew Schofield <aschofield@confluent.io>,  Apoorv Mittal <apoorvmittal10@gmail.com>, Jun Rao <junrao@gmail.com>
2024-10-17 13:58:10 -07:00
Zhengke Zhou 6d39031958
KAFKA-17558: Remove parameterization from streams integration tests (#17315)
Integration tests should run with either at-least-once or exactly-once.
There is no need to run them twice.
This PR removes the corresponding test parameters and picks either one of both.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2024-10-17 13:54:30 -07:00
Apoorv Mittal 5da3b9410d
KAFKA-17778: Add listener to remove client instances on connection disconnect (#17474)
The ClientsMetricManager keeps the client instance cache at a limit of 16384. The active connections can be low, but connections can be created and destroyed in short span. Which hits the cache limit and results in cache miss for new connections.

The client instance cache keeps the instances for 3 * push interval ms. Hence when the cache gets full it creates new instances for every request while evicting others from cache. This gives some bumps to the GC for the broker and eventually CPU. Though with evicting early it will still be garbage collected but the long running active connections will not be removed from the cache.

This PR adds capability to evict client instances from cache when the connection from client is dropped.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Andrew Schofield <aschofield@confluent.io>, Jun Rao <junrao@gmail.com>
2024-10-17 10:10:13 -07:00
Kuan-Po Tseng f7498a40f2
MINOR: fix broken link in javadoc (#17526)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-18 00:50:27 +08:00
kartik-3513 267220a7af
KAFKA-17802 Update Bouncy castle from 1.75 to 1.78.1 (#17512)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-18 00:45:46 +08:00
Ken Huang 05a6898610
KAFKA-17812 upgrade base image of e2e from JDK 11 to JDK 17 (#17520)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 20:54:13 +08:00
Andrew Schofield 66aa9cd282
KAFKA-17724 Move SubscriptionState changes to background thread (#17418)
Reviewers: Jason Gustafson <jason@responsive.dev>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 18:29:19 +08:00
Sean Quah 017da21099
KAFKA-17710; Rework uniform heterogeneous assignor to improve perf (#17385)
Rework the uniform heterogeneous assignor to improve performance, while
preserving the high level ideas and structure from the existing
implementation:
 * The assignor works in 3 stages: importing the previous assignment for
   stickiness, assigning unassigned partitions and iteratively
   reassigning partitions to improve balance.
 * Unassigned partitions are assigned to the subscribers with the least
   number of partitions. This maximizes balance within a single topic.
 * During the iterative rebalancing phase, partitions are reassigned to
   their previous owner if it improves balance (stickiness restoration).
 * During the iterative rebalancing phase, partitions are reassigned to
   the subscriber with the least number of partitions to improve
   balance.

A non-exhaustive list of changes is:
 * The assignment of unassigned partitions and iterative reassignment
   stages now works through partitions topic by topic. Previously
   partitions from topics with the same number of partitions per
   subscriber would be interleaved. Since we iterate topic by topic, we
   can reuse data about topic subscribers.
 * Instead of maintaining TreeSets to find the least loaded subscribers,
   we sort an ArrayList of subscribers once per topic and start filling
   up subscribers, least loaded first. In testing, this approach was
   found to be faster than maintaining PriorityQueues.
 * Implement stickiness restoration by creating a mapping of partitions
   to previous owner and checking against that mapping, instead of
   tracking partition movements during iterative reassignment.
 * Track member partition counts using a plain int array, to avoid
   overhead from boxing and HashMap lookups. Member partition counts are
   accessed very frequently and this needs to be fast. As a consequence,
   we have to number members 0 to M - 1.
 * Bound the iterative reassignment stage to a fixed number of
   iterations. Under some uncommon subscription patterns, the iterative
   reassignment stage converges slowly. In these cases, the iterative
   reassignment stage terminates without producing an optimally balanced
   assignment anyway (see javadoc for balanceTopics).
 * Re-use Maps from the previous assignment where possible,
   ie. introduce a copy-on-write mechanism while computing the new
   assignment.

Reviewers: David Jacot <djacot@confluent.io>
2024-10-17 01:43:29 -07:00
Josep Prat c20c244fd5
KAFKA-17810 upgrade Jetty because of CVE-2024-8184 (#17517)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 14:24:11 +08:00
TengYao Chi 863b728c40
KAFKA-17677 Remove atomicGetOrUpdate (#17484)
Since we are removing support for Scala 2.12, CoreUtils#atomicGetOrUpdate should also be removed, as it is a workaround for the different behavior between ConcurrentMap.getOrElse and JConcurrentMapWrapper.

JMH results show no significant performance regression when using `getOrElseUpdate`:

Benchmark                                                            (mapSize)  (writePercentage)  Mode  Cnt  Score   Error  Units
ConcurrentMapBenchmark.testConcurrentHashMapComputeIfAbsentReadOnly        100                0.1  avgt    5  4.182 ± 0.006  ns/op
ConcurrentMapBenchmark.testConcurrentHashMapGetReadOnly                    100                0.1  avgt    5  3.372 ± 0.024  ns/op
JMH benchmarks done

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 14:16:44 +08:00
David Arthur ef6c950b88
KAFKA-17767 Extract test catalog from JUnit output [1/n] (#17397)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 14:09:22 +08:00
dengziming 337e80e78a
MINOR: Correctly catch console messages (#17407)
Some tests didn't catch output messages correctly, for example, the output of a test should be "Completed updating config for user admin." but we didn't got it. Copied a method from `ToolsTestUtils.java` which can be removed after we move ConfigCommand to tools module.
 Change the output stream from `scala.Console.println` to `System.out.println` to make test easier.
2024-10-17 13:12:28 +08:00
Apoorv Mittal 5791397d03
KAFKA-17776 Capability for connection disconnect listeners in socket server (#17473)
As of now, there isn't any way that resources can be cleaned in Kafka when client disconnects the connections. Generally time bound clean up happens which keep the resources occupied.

This PR provides capability to attach listeners in Socket Server which can react to client connection disconnections.

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 12:28:46 +08:00
Chung, Ming-Yen 54e9d75a3f
KAFKA-17683 Remove Zookeeper from READMEs in 4.0 (#17354)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 11:48:04 +08:00
Kuan-Po Tseng 60ea0999fb
KAFKA-17728 Add missing config `replica-directory-id` to raft README (#17518)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 11:32:27 +08:00
Kuan-Po Tseng 8adfdbbde0
KAFKA-17256 KRAFT should honor the listener name and security protocol from ClusterConfig (#16824)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-17 10:34:15 +08:00
A. Sophie Blee-Goldman 1de4f27ec0
KAFKA-17805: Deprecate named topologies in Kafka Streams (#17513)
Deprecate for 4.0. This feature will be phased out, with new functionality generally not supporting named topologies, so users are encouraged to migrate off of named topologies as soon as possible.

Though who are using this experimental feature are encouraged to reach out by filing a jira ticket so we can better understand your use case and how to support it going forward.

Reviewers: Matthias Sax <mjsax@apache.org>
2024-10-16 14:24:30 -07:00
Bill Bejeck 493e4c1cc9
KAFKA-17248: Override admin client to push metrics true, test for case where streams metrics [4/N] (#17422)
This PR disables metrics push for the AdminClient as the default. KafkaStreams enables metrics push for its internal AdminClient.

Tests are included that assert an error if a user disables either the main consumer or admin client metrics push but Kafka Streams metrics push config is enabled.

Reviewers: Matthias Sax <mjsax@apache.org>
2024-10-16 15:01:50 -04:00
Apoorv Mittal 0d6d3effd0
KAFKA-17809: Fixing flaky share consumer integration test (#17515)
The tests fails sometime while reading for timed out records. Moved the timeout from Thread.sleep to waituntilcondition and increased it so records can be read in cases where it took more than expected.

Reviewers: ShivsundarR <rshiva1405@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
2024-10-16 23:21:15 +05:30
TengYao Chi 5fe59f83e0
KAFKA-17741 Cleanup code base for JDK 11 (#17441)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-16 23:05:39 +08:00
Ken Huang bb7c083049
KAFKA-17781 add `psutil` to e2e dockerfile and upgrade ducktape version (#17480)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-16 22:38:23 +08:00
Bruno Cadonna 3b619db404
MINOR: Fix flakiness in state updater unit tests (#16562)
Unit test shouldRestoreSingleActiveStatefulTask() in DefaultStateUpdaterTest is flaky.

The flakiness comes from the fact that the state updater thread could call the first time changelogReader.allChangelogsCompleted() before it calls the first time changelogReader.completedChangelogs(). That happens, if runOnce() is run before the state updater thread reads a task from the input queue.

This commit fixes the flakiness, by making stubbing changelogReader.allChangelogsCompleted() depend on stubbing changelogReader.completedChangelogs().

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2024-10-16 14:37:50 +02:00
Yung ff5ef8355d
MINOR: Fix inter.broker docs description (#17509)
Fix sentence break errors in the inter.broker description.

Reviewers: Luke Chen <showuon@gmail.com>, TengYao Chi <kitingiao@gmail.com>
2024-10-16 17:44:02 +08:00
Chia-Chuan Yu 078760a008
KAFKA-17773 Upgrade spotbug to work under java 23 (#17483)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-16 16:48:22 +08:00
PoAn Yang 8e54a04723
KAFKA-17536; Ensure clear error message when new consumer used with incompatible cluster (#17411)
In Kafka 4.0, by default the consumer uses the updated consumer group protocol defined in KIP-848. When the consumer is used with a cluster that does not support (or is not configured to use) the new protocol, the consumer will get an unfriendly error about unavailable APIs. Since this error could be the user's first impression when attempting to upgrade to 4.0, we need to make sure that the error is very clear about the remediation steps (set the group.protocol to CLASSIC on the client or upgrade and enable the new protocol on the cluster).

Reviewers: Kirk True <ktrue@confluent.io>, David Jacot <djacot@confluent.io>
2024-10-16 01:30:57 -07:00
Kamal Chandraprakash 604564cce3
KAFKA-15859: Complete delayed RemoteListOffsets requests when replica moves away from broker (#17487)
Removed the ListOffsetsMetadata wrapper class. Complete the response when replica is not a leader.

Reviewers: Jun Rao <junrao@gmail.com>
2024-10-15 17:04:33 -07:00
kwonyonghyun 491395e0b0
MINOR: Cleanups in SharePartitionTest (#17464)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Andrew Schofield <andrew_schofield@live.com>, Ken Huang <s7133700@gmail.com>
2024-10-15 10:13:27 +02:00
Chirag Wadhwa d8b15ecd40
KAFKA-17756: Added dynamic share group configs share.heartbeat.interval.ms and share.session.timeout.ms (#17450)
This PR adds the 2 configs share.heartbeat.interval.ms and share.session.timeout.ms in GroupConfig. These can be dynamically set for a share group without restarting the server

Reviewers: Andrew Schofield <aschofield@confluent.io>,  Apoorv Mittal <apoorvmittal10@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
2024-10-15 13:36:12 +05:30
陳昱霖(Yu-Lin Chen) 676228c708
KAFKA-17769 Fix flaky PlaintextConsumerSubscriptionTest.testSubscribeInvalidTopicCanUnsubscribe (#17490)
Reviewers: TaiJuWu <tjwu1217@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-15 15:26:56 +08:00
Sushant Mahajan 5545d717c3
KAFKA-17633: Add share group record formatter and parser. (#17467)
As part of KIP-932, a new internal topic __share_group_state was introduced. There are 2 types of records which are currently being added in this topic - ShareSnapshotKey/Value and ShareUpdateKey/Value
In light of this, we must make the existing tooling like kafka-console-consumer and kafka-dump-log aware of these records for debugging and introspection purposes.
This PR introduces ShareGroupStateMessageFormatter to be used used with kafka-console-consumer and adds an internal class ShareGroupStateMessageParser in DumpLogSegments.scala.
Unit tests have been added to DumpLogSegmentsTest.scala


Reviewers:  Andrew Schofield <aschofield@confluent.io>,  Manikumar Reddy <manikumar.reddy@gmail.com>
2024-10-15 11:44:15 +05:30
Ken Huang aa6460dbed
MINOR: remove unused method in IntegrationTestUtils (#17469)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-15 14:05:40 +08:00
TengYao Chi 582bb48e88
KAFKA-17748 Remove scala-java8-compat (#17497)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-15 13:34:21 +08:00
Chung, Ming-Yen 1e5b6b8e83
KAFKA-17693 Remove testEarliestLocalTimestampVersion and testCheckLatestTieredTimestampVersion (#17456)
Reviewers: TengYao Chi <kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-15 12:04:06 +08:00
Ken Huang 203f3237ec
KAFKA-17374 add bootstrap.controller to kafka-reassign-partitions.sh (#16964)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-14 21:17:00 +08:00
Linsiyuan9 a51eec17e1
KAFKA-17765 Remove TestUtils.toSet (#17479)
Reviewers: TengYao Chi <kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-14 20:28:05 +08:00
Mickael Maison f3b9c5f94b
MINOR: Delete BaseConsumerRecord (#17496)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-14 20:18:00 +08:00
Linsiyuan9 76a1af984b
KAFKA-17746 Replace JavaConverters with CollectionConverters (#17451)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-14 17:13:20 +08:00
Logan Zhu d55b4e640c
KAFKA-17763 Remove Utils.covariantCast and use var for type inference (#17468)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-14 15:22:43 +08:00
ClarkChen 4529cc4e98
MINOR: Fix transactionPartitionVerificationEnable return type (#17476)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-14 01:16:39 +08:00
Chengyan a880c846ae
KAFKA-17722 Fix "this-escape" compiler warnings (BrokerTopicMetrics) for JDK 23 (#17439)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-13 00:04:28 +08:00
David Arthur ca42226864
MINOR: clean up GHA names (#17470)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-12 10:33:34 +08:00
Chung, Ming-Yen d74f1f847a
KAFKA-17199 Add UT for TransactionLogConfig and TransactionStateManagerConfig (#17442)
Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-12 09:42:54 +08:00
Andrew Schofield fef105e5ad
MINOR: Adjust maximum value of group.share.record.lock.duration.ms (#17472)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-12 08:57:02 +08:00
David Arthur d66d808172
MINOR: fix some GHA run syntax (#17471)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-12 08:52:55 +08:00
陳昱霖(Yu-Lin Chen) e864d8f168
KAFKA-17661 Fix flaky BufferPoolTest.testBlockTimeout (#17319)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-11 22:06:21 +08:00
mingdaoy b3b86d52f4
KAFKA-17717 Remove ConfigUtils#translateDeprecatedConfigs and tests (#17458)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-11 21:57:22 +08:00
Anshul Goyal 2353a7c508
KAFKA-17723 Fix "this-escape" compiler warnings (MultiThreadedEventProcessor and DistributedHerder) for JDK 23 (#17417)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-11 21:28:27 +08:00
Gaurav Narula b03fe66cfe
KAFKA-17759 Remove Utils.mkSet (#17460)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-11 21:20:43 +08:00
Chia-Chuan Yu b2380d7bf6
KAFKA-17772 Remove inControlledShutdownBrokers(Set<Integer>) and unfenceBrokers(Set<Integer>) from ReplicationControlManagerTest (#17466)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-10-11 17:14:12 +08:00
Andrew Schofield edd3860433
KAFKA-17764 Remove unnecessary ignorable annotations (#17452)
KIP-932 used ignorable annotations in some RPC schemas when they are not applicable in situations where there is only a single version of the RPC in existence. This PR removes the unnecessary annotations. The KIP has been updated accordingly.

Reviewers: Jun Rao <junrao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-10-11 14:58:31 +08:00