Commit Graph

15463 Commits

Author SHA1 Message Date
Nick Guo fcf6da0a0d
KAFKA-19098 Remove `lastOffset` from PartitionResponse (#19398)
The `lastOffset` is not used actually, so it can be removed.

Reviewers: Jhen-Yung Hsu <jhenyunghsu@gmail.com>, Ken Huang
<s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-04-08 00:06:02 +08:00
Stanislav Kozlovski b8c095074d
MINOR: Rename RemoteLogStorageManager variable to RemoteStorageManager (#19401)
This patch renames the KIP-405 Plugin variable from
`remoteLogStorageManager` to `remoteStorageManager`. After [writing
about

it](https://aiven.io/blog/apache-kafka-tiered-storage-in-depth-how-writes-and-metadata-flow),
I realized I got swayed by the code and called the component incorrectly
- the official name doesn't have `Log` in it. I thought i'd go ahead and
change the code so it's consistent with the naming too

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-08 00:02:38 +08:00
Sanskar Jhajharia 2ae4ffb5e0
MINOR: Cleanup Core Module (#19372)
Now that Kafka Brokers support Java 17, this PR makes some changes in
core module. The changes in this PR are limited to only the Java files
in the Core module. Scala related changes may follow next.
The changes mostly include:
- Collections.emptyList(), Collections.singletonList() and
Arrays.asList() are replaced with List.of()
- Collections.emptyMap() and Collections.singletonMap() are replaced
with Map.of()
- Collections.singleton() is replaced with Set.of()
- Some changes to use enhanced switch statement.

Reviewers: Andrew Schofield <aschofield@confluent.io>, PoAn Yang <payang@apache.org>, Ken Huang <s7133700@gmail.com>
2025-04-07 16:57:52 +01:00
Lucas Brutschy 391b258d50
KAFKA-19077: Propagate shutdownRequested field (#19359)
When a member indicates that the application should shut down, set a
soft-state flag on the streams group and continuously set the status
`SHUTDOWN_APPLICATION` to all members, until the group is empty, which
resets the flag.

Reviewers: Matthias J. Sax <matthias@confluent.io>, Chia-Ping Tsai
<chia7712@gmail.com>, Jeff Kim <jeff.kim@confluent.io>
2025-04-07 15:11:59 +02:00
Lucas Brutschy 2a05c0cdd6
KAFKA-19001: Use streams group-level configurations in heartbeat (#19219)
Implements the use of session timeout, standby tasks and heartbeat
interval
configurations in the streams group heartbeat.

Piggy-backed is another test that streams groups react to changes
in the topic metadata.

Reviewers: Bill Bejeck <bbejeck@apache.org>, Bruno Cadonna
<cadonna@apache.org>, Matthias J. Sax <matthias@confluent.io>
2025-04-07 11:32:00 +02:00
Shivsundar R 2d02f1d52d
KAFKA-19084: Port KAFKA-16224, KAFKA-16764 for ShareConsumers (#19369)
Currently for ShareConsumers, if we receive an
`UNKNOWN_TOPIC_OR_PARTITION` error code in the
`ShareAcknowledgeResponse`, then we retry sending the acknowledgements
until the timer expires.
We ideally do not want this when a topic/partition is deleted, hence
like the
`CommitRequestManager`(https://github.com/apache/kafka/pull/15581), we
will treat this error as fatal and not retry the acknowledgements.

PR also suppresses `InvalidTopicException` during `unsubscribe()` which
was also added in the
`AsyncKafkaConsumer`(https://github.com/apache/kafka/pull/16043). It was
later removed in the regular consumer
as they notified the background operations of metadata errors instead of
propagating them via `ErrorEvent`. `ShareConsumerImpl` however does
not require that change and it still propagates the metadata error back
to the application. So we would need to suppress this exception during
unsubscribe().

Reviewers: Andrew Schofield <aschofield@confluent.io>, Sushant Mahajan <smahajan@confluent.io>
2025-04-07 10:04:48 +01:00
Hong-Yi Chen 6dd2cc70c3
MINOR: Clean up comments and remove unused code in RecordVersion and CreateTopicsRequestTest (#19342)
## Summary

This PR updates the `RecordVersion` javadoc for clarity. It removes
outdated references to `message.format.version` mentioned in the [Kafka
4.0 upgrade
documentation](48f06981ee/40/upgrade.html (L135))
and aligns with feedback from a previous discussion in [#19325
](https://github.com/apache/kafka/pull/19325).

## Changes
- Cleaned up javadoc in `RecordVersion`
- Removed outdated or deprecated references

Reviewers: PoAn Yang <payang@apache.org>, Ken Huang
<s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-04-07 07:47:06 +08:00
TengYao Chi 6d68f8a82c
MINOR: Move BrokerReconfigurable to the sever-common module (#19383)
This patch moves `BrokerReconfigurable` to the `server-common module`
and decouples the `TransactionLogConfig` and `KafkaConfig` to unblock
KAFKA-14485.

Reviewers: PoAn Yang <payang@apache.org>, TaiJuWu <tjwu1217@gmail.com>,
Chia-Ping Tsai <chia7712@gmail.com>
2025-04-07 07:39:01 +08:00
Nick Guo e69a311068
KAFKA-19076 replace `String` by `Supplier<String>` for UnifiedLog#maybeHandleIOException (#19392)
jira: https://issues.apache.org/jira/browse/KAFKA-19076

the message is used when the function encounters error, so the error
message should be created lazy.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-07 00:43:44 +08:00
Thomas Gebert a65626b6a8
MINOR: Add functionalinterface to the producer callback (#19366)
The Callback interface is a perfect example of a place that can use the
functionalinterface in Java. Strictly for Java, this isn't "required"
since Java will automatically coerce, but for Clojure (and other JVM
languages I belive) to interop with Java lambdas it needs the
FunctionalInterface annotation.

Since FunctionalInterface doesn't add any overhead and provides
compiler-enforced documentation, I don't see any reason *not* to have
this. This has already been added into Kafka Streams here:
https://github.com/apache/kafka/pull/19234#pullrequestreview-2740742487

I am happy to add it to any other spots in that might be useful too.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-06 22:21:09 +08:00
Parker Chang 9f676dd7e2
MINOR: Clean up unreachable code in FetcherTest (#19376)
This is from [#16532's comment](https://github.com/apache/kafka/pull/16532/files#r2028985028):

The forEach loop in the assertion will never execute because
`nonResponseData` is empty.

This happens because the above assertion `emptyMap()` has a size of 0,
so there are no elements to iterate over.

Reviewers: PoAn Yang <payang@apache.org>, Ken Huang
<s7133700@gmail.com>, TaiJuWu <tjwu1217@gmail.com>, TengYao Chi
<kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-04-06 22:17:02 +08:00
Xuan-Zhang Gong ab4a0f0ec1
MINOR: small optimization by judgment (#19386)
judgments can help avoid unnecessary `segments.sizeInBytes()`  loops

from https://github.com/apache/kafka/pull/18393/files#r2029925512

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-06 22:08:05 +08:00
TengYao Chi 74acbd200d
KAFKA-16758: Extend Consumer#close with an option to leave the group or not (#17614)
JIRA: [KAFKA-16758](https://issues.apache.org/jira/browse/KAFKA-16758)
This PR is aim to deliver

[KIP-1092](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=321719077),
please refer to KIP-1092 and KAFKA-16758 for further details.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, Chia-Ping
Tsai <chia7712@gmail.com>, Kirk True <kirk@kirktrue.pro>
2025-04-05 22:02:45 -07:00
Ayoub Omari b963e58000
KAFKA-16407: Fix foreign key INNER join on change of FK from/to a null value (#19303)
Fixes both KAFKA-16407 and KAFKA-16434.

Summary of existing issues:

- We are ignoring new left record when its previous FK value is null
- We do not unset foreign key join result when FK becomes null

Reviewers: Matthias J. Sax <matthias@confluent.io>
2025-04-05 20:13:31 -07:00
David Arthur 3f8e86ab67
KAFKA-19013 Reformat PR body to 72 characters (#19242)
Parse the body of a PR and re-format it to a text wrap of 72 characters.
Since GitHub will do this automatically when merging PRs with the merge
queue, we should do our best to pre-format the commit message.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-05 12:34:07 -04:00
Ming-Yen Chung 8c77953d5f
MINOR: Revert "migrate LogFetchInfo, Assignment and RequestAndCompletionHandler to java record" (#19177)
Revert some java record migration in #19062  #18783 

We assume java record is purely immutable data carriers.
As discussed in
https://github.com/apache/kafka/pull/19062#issuecomment-2709637352, if a
class has fields that may be mutable, we shouldn't migrate it to Java
record because the hashcode/equals behavior are changed.

* LogFetchInfo (Records)
* Assignment (successCallback)
* Remove `equals` method from Assignment since `Assignment` is not and
shouldn't be used in Map/Set key.
* RequestAndCompletionHandler (handler)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-05 23:01:17 +08:00
Gaurav Narula 3f0e14a3e8
MINOR: rename metric variable name in Processor#accept (#19361)
`Processor#accept` accepts a metric which tracks the amount of time for
which the Acceptor thread was blocked. It's misleading to name it
`acceptorIdlePercentMeter` and this change updates its naming to align
with the call site.

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-05 22:54:21 +08:00
PoAn Yang 3d96b20630
KAFKA-19042 Move TransactionsExpirationTest to client-integration-tests module (#19288)
Use Java to rewrite `TransactionsExpirationTest` by new test infra and
move it to client-integration-tests module.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-05 20:01:31 +08:00
TaiJuWu ebb62812d9
KAFKA-19074 Remove the cached responseData from ShareFetchResponse (#19357)
Jira: https://issues.apache.org/jira/browse/KAFKA-19074

Similar fix https://github.com/apache/kafka/pull/16532

2b8aff58b5
make it accept input to return "partial" data.
The content of output is based on the input but we cache the output ...
It will return same output even though we pass different input. That is
a potential bug.

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-05 19:56:59 +08:00
Mickael Maison 08a93fe12a
KAFKA-14523: Move DelayedRemoteListOffsets to the storage module (#19285)
Decouple RemoteLogManager and ReplicaManager.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-05 19:51:13 +08:00
PoAn Yang d6ff7b80dd
KAFKA-13747: refactor TopologyTest to test different store type parametrized (#19323)
Use `ParameterizedTest` to test both `IN_MEMORY` and `ROCKS_DB` store
type in `TopologyTest`.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2025-04-04 14:45:13 -07:00
Abhinav Dixit 30c511d640
KAFKA-19085: SharePartitionManagerTest testMultipleConcurrentShareFetches throws silent exception and works incorrectly (#19370)
The test `testMultipleConcurrentShareFetches` is throwing a silent
exception.
`ERROR Error processing delayed share fetch request
(kafka.server.share.DelayedShareFetch:225)`

This is due to incomplete mocks setup for the test and also requires
changes in timeout.

Reviewers: Andrew Schofield <aschofield@confluent.io>
2025-04-04 20:20:47 +01:00
lorcan 6af849f864
KAFKA-7952: use in memory stores for KTable test (#19218)
Switch to in-memory story for KTable-KTable left-join test.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2025-04-04 09:22:08 -07:00
Ken Huang ef73fb921b
MINOR: Remove DeleteSegmentsByRetentionTimeTest#executeTieredStorageTest flaky annotation (#19301)
This test was fixed by [this
commit](https://github.com/apache/kafka/pull/18861) and hasn't failed
for about two weeks. Therefore, we can remove the `@Flaky` annotation.

Gradle report:
https://develocity.apache.org/scans/tests?search.rootProjectNames=kafka&search.startTimeMax=1743081652853&search.startTimeMin=1741795200000&search.tags=github%2Ctrunk&search.timeZoneId=Asia%2FTaipei&tests.container=org.apache.kafka.tiered.storage.integration.DeleteSegmentsByRetentionTimeTest

Reviewers: TaiJuWu <tjwu1217@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-05 00:05:57 +08:00
Alieh Saeedi cd49634268
MINOR: Rename streams group configs for consistency with other configuration settings. (#19360)
This is a fix for the naming in ff785ac.

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
2025-04-04 16:46:46 +02:00
Gaurav Narula 25f9b1ee4c
MINOR: ShutdownableThread: log on error level on FatalExitError (#19351)
This will help debugging the error as the stacktrace is valuable in identifying the origin.

Reviewers: TaiJuWu <tjwu1217@gmail.com>, Igor Soarez <i@soarez.me>, Ken Huang <s7133700@gmail.com>
2025-04-04 15:38:45 +01:00
Bruno Cadonna 36c2faca1e
MINOR: Consider repartition source topic for changelog topics (#19373)
With the Streams rebalance protocol, when the partition count 
for changelog topics are computed the topic manager only
considers external source topics and throws if there are no
source topics. However, subtopologies are allowed to only
have repartition topics as source topics.

This commit also considers repartition source topics when
computing the partition count for changelog topics.

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
2025-04-04 16:30:16 +02:00
Andrew Schofield d4d9f11816
KAFKA-18761: [2/N] List share group offsets with state and auth (#19328)
This PR approaches completion of Admin.listShareGroupOffsets() and
kafka-share-groups.sh --describe --offsets.

Prior to this patch, kafka-share-groups.sh was only able to describe the
offsets for partitions which were assigned to active members. Now, the
Admin.listShareGroupOffsets() uses the persister's knowledge of the
share-partitions which have initialised state. Then, it uses this list
to obtain a complete set of offset information.

The PR also implements the topic-based authorisation checking. If
Admin.listShareGroupOffsets() is called with a list of topic-partitions
specified, the authz checking is performed on the supplied list,
returning errors for any topics to which the client is not authorised.
If Admin.listShareGroupOffsets() is called without a list of
topic-partitions specified, the list of topics is discovered from the
persister as described above, and then the response is filtered down to
only show the topics to which the client is authorised. This is
consistent with other similar RPCs in the Kafka protocol, such as
OffsetFetch.

Reviewers: David Arthur <mumrah@gmail.com>, Sushant Mahajan <smahajan@confluent.io>, Apoorv Mittal <apoorvmittal10@gmail.com>
2025-04-04 13:25:19 +01:00
Abhinav Dixit 98c0f3024d
MINOR: Added trace logs to help debug SharePartition (#19358)
Added `trace` logs to help debug `nextFetchOffset` functionality within
SharePartition. We did not have a way to figure out the fetch offsets of
a share partition through logs. Forward moving `fetchOffset` confirms
that the consumption from a given share partition is happening correctly
on the broker.

Reviewers: Andrew Schofield <aschofield@confluent.io>
2025-04-04 09:52:17 +01:00
nilmadhab mondal d35ab4d27a
KAFKA-18713: Fix FK Left-Join result race condition (#19005)
When a row in a FK-join left table is updated, we should send a "delete
subscription with no response" for the old FK to the right hand side, to
avoid getting two responses from the right hand side. Only the "new
subscription" for the new FK should request a response. If two responses
are requested, there is a race condition for which both responses could
be processed in the wrong order, leading to an incorrect join result.

This PR fixes the "delete subscription" case accordingly, to no request
a response.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2025-04-03 16:22:47 -07:00
TengYao Chi 5eb4e116bc
KAFKA-18067: Add a flag to disable producer reset during active task creator shutting down (#19269)
JIRA: KAFKA-18067

Fix producer client double-closing issue in Kafka Streams. 
During StreamThread shutdown, TaskManager closes first, which closes the
producer client. Later, calling `unsubscribe` on the main consumer may
trigger the `onPartitionsLost` callback, attempting to reset
StreamsProducer when EOS is enabled. This causes an already closed
producer to be closed twice while the newly created producer is never
closed.

In detail:
This patch adds a flag to control the producer reset and has a new
method to change this flag, which is only invoked in
`ActiveTaskCreator#close`.
This would guarantee that the disable reset producer will only occur
when StreamThread shuts down.

Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, Matthias Sax <mjsax@apache.org>
2025-04-03 14:13:22 -07:00
Logan Zhu a4375045d6
KAFKA-19055 Cleanup the 0.10.x information from clients module (#19320)
Removes outdated references to Kafka 0.10.x in the clients module
documentation. Since the baseline version is now 2.1, any mentions of
versions earlier than this are unnecessary and have been removed or
updated accordingly.

Changes:
- Updated `ClusterResource`, `ClusterResourceListener`, and
`DescribeClusterResult` Javadoc to reflect the minimum supported broker
version as 2.1.
- Updated `TopicConfig` documentation: Removed references to consumers
older than 0.10.2.
- Removed references to 0.10.x and adjusted explanations to remain
relevant for newer versions.

Testing & Impact:
- This PR only modifies Javadoc comments—no functional code changes.
- No impact on existing functionality.

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-04 04:17:13 +08:00
TengYao Chi 6f92896d44
MINOR: Cleanup test-common-runtime module (#19305)
This patch does some cleanups for the `test-common-runtime`.

- `.collect(Collectors.toList())` -> `.toList()`
- lambda block -> lambda expression
- remove unnecessary semicolon
- switch block -> switch expression
- add `final` keyword

Reviewers: PoAn Yang <payang@apache.org>, Ken Huang
<s7133700@gmail.com>, TaiJuWu <tjwu1217@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-04 02:19:50 +08:00
Sanskar Jhajharia 03b1b720e9
MINOR: Cleanup Storage Module (#19072)
Given that now we support Java 17 on our brokers, this PR replace the
use of the following in storage module:

- Collections.singletonList() and Collections.emptyList() with List.of()
- Collections.singletonMap() and Collections.emptyMap() with Map.of()
- Collections.singleton() and Collections.emptySet() with Set.of()
- Arrays.asList() with List.of()

Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-04 02:15:58 +08:00
Thomas Gebert db4e74b46e
MINOR: Add Functional Interface annotation to interfaces used by Lambdas (#19234)
Adds the FunctionalInterface annotation to relevant Kafka Streams
classes. While this is not strictly required for Java, it's still best
practice and also useful for better integration with other JVM
languages, for example Clojure, to allow using these interfaces as
lambdas.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2025-04-03 09:30:56 -07:00
TaiJuWu f1bb29b93a
MINOR: migrate BrokerCompressionTest to storage module (#19277)
There are two change for this PR.

1. Move `BrokerCompressionTest ` from core to storage
2. Rewrite `BrokerCompressionTest ` from scala to java

Reviewers: TengYao Chi <kitingiao@gmail.com>, PoAn Yang
<payang@apache.org>, Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-03 22:43:42 +08:00
Chirag Wadhwa c3f0890f53
KAFKA-19075: Included other share group dynamic configs in extractShareGroupConfigMap method in ShareGroupConfig (#19348)
This PR includes `share.session.timeout.ms` and
`share.heartbeat.interval.ms` in the `extractShareGroupConfigMap` method
in `ShareGroupConfig`. With this change, the default value of
`share.session.timeout.ms` and `share.heartbeat.interval.ms` for every
group will be set as the value of the static configs
`group.share.session.timeout.ms` and `group.share.heartbeat.interval.ms`
respectively

Reviewers: Andrew Schofield <aschofield@confluent.io>
2025-04-03 13:47:25 +01:00
Sean Quah d7fa406b32
KAFKA-19064: Handle exceptions from deferred events in coordinator (#19333)
Previously in KAFKA-18484, we added exception handling for exceptions
coming from batch events. Also handle exceptions from 0-record write
events and transaction completion events.

Reviewers: David Jacot <djacot@confluent.io>
2025-04-03 05:16:48 -07:00
Bruno Cadonna 6ef42d1524
MINOR: Deduplicate topics of a topology for authorization check (#19352)
With the new Streams rebalance protocol, the Streams client sends the
topology with the used topics to the broker for initialization. For the
initialization the broker needs to describe the topics in the topology
and consequently the Streams application needs to be authorized to
describe the topics.

The broker checks the authorization by filtering the topics in the
topology by authorization. This filtering implicitly deduplicates the
topics of the topology if they appear multiple times in the topology
send to the brokers. After that the broker compares the size of the
authorized topics with the topics in the topology. If the authorized
topics are less than the topics in the topology a
TOPIC_AUTHORIZATION_FAILED error is returned.

In Streams a topology that is sent to the brokers likely has duplicate
topics because a repartition topic appears as a sink for one subtopology
and as a source for another subtopology.

This commit deduplicates the topics of a topology before the
verification of the authorization.

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
2025-04-03 13:39:55 +02:00
Sushant Mahajan 37f7434eac
KAFKA-18827: Incorporate initializing topics in share group heartbeat [4/N] (#19339)
* Currently, when we get a heartbeat with new share partition
subscriptions, we return an initialize request to the caller which the
caller executes asynchronously as a timer task.
* Meanwhile, if a new heartbeat request comes with same or null
subscription - the same initialize request will be returned since the
`GroupMetadataManager` has no idea about the older in flight request.
* In this PR, we have added a new field to the
`ShareGroupStatePartitionMetadata` record `initializingTopics` where
this information can be recorded in the GMM. Consequently, the
subsequent heartbeats can check this field and not return duplicate
initialize requests.
* If any errors are encountered while initializing by the
`GroupCoordinatorService` an additional method
`uninitializeShareGroupState` has been added which will remove the
requisite info from the `initializingFields`.
* New tests have been added wherever applicable and older ones updated.

Reviewers: Andrew Schofield <aschofield@confluent.io>
2025-04-03 09:38:20 +01:00
PoAn Yang be80e3cb8a
KAFKA-18923: resource leak in RSM fetchIndex inputStream (#19111)
Fix resource leak in RSM inputStream.

Reviewers: Luke Chen <showuon@gmail.com>
2025-04-03 15:18:05 +08:00
PoAn Yang 5c01fd0b76
KAFKA-18949 add consumer protocol to testDeleteRecordsAfterCorruptRecords (#19317)
The `PlaintextAdminIntegrationTest#testDeleteRecordsAfterCorruptRecords`
was only enabled for classic protocol. Add consumer protocol to it.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-03 13:24:25 +08:00
Ken Huang d619cc5b88
KAFKA-19058 Running the streams/streams-scala module tests produces a streams-scala.log (#19324)
Remove streams-scala module log4j2 file appender.

Reviewers: PoAn Yang <payang@apache.org>, Matthias J. Sax <matthias@confluent.io>
2025-04-02 12:12:16 -07:00
Ritika Reddy eeffd8c475
KAFKA-19003: Add forceTerminateTransaction command to CLI tools (#19276)
This patch is part of KIP-939 [Support Participation in
2PC](https://cwiki.apache.org/confluence/display/KAFKA/KIP-939%3A+Support+Participation+in+2PC)

The kafka-transactions.sh tool will support a new command
--forceTerminateTransaction It has one required argument
--transactionalId that would take the transactional id for the
transaction to be terminated.

The command uses the existing Admin#fenceProducers method to forcefully
abort the transaction associated with the specified transactional ID.
Under the hood, it sends an InitProducerId request to the transaction
coordinator with the given transactional ID and keepPreparedTxn = false
by default. This is aligned with the functionality outlined in the KIP.

We will be creating a new public method in the Admin Client **public
TerminateTransactionResult forceTerminateTransaction(String
transactionalId)**, and re-use the existing fence producer method.

Reviewers: Artem Livshits <alivshits@confluent.io>, Justine Olshan <jolshan@confluent.io>
2025-04-02 11:51:26 -07:00
Xuan-Zhang Gong 2994e5eff3
KAFKA-19004 Move DelayedDeleteRecords to server-common module (#19226)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Ken Huang
<s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2025-04-03 00:06:27 +08:00
Sanskar Jhajharia 75f384a019
MINOR: Cleanup Raft Module (#19284)
Given that now we support Java 17 on our brokers, this PR replace the
use of the following in raft module:

- Collections.singletonList() and Collections.emptyList() with List.of()
- Collections.singletonMap() and Collections.emptyMap() with Map.of()
- Collections.singleton() and Collections.emptySet() with Set.of()
- Arrays.asList() with List.of()

Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>
2025-04-02 21:46:48 +08:00
Bill Bejeck 87a299a081
KAFKA-18826: Add global thread metrics (#18953)
When implementing
[KIP-1091](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1091%3A+Improved+Kafka+Streams+operator+metrics)
metrics for the Global Stream thread was overlooked. This ticket adds
the Global Thread metrics so they are available via the KIP-1076 process
of adding external Kafka metrics.

The existing integration test has been updated to confirm GlobalThread
metrics are sent via the broker plugin.

Reviewers: Matthias Sax <mjsax@apache.org>
2025-04-02 09:17:49 -04:00
Chirag Wadhwa 793b47011c
KAFKA-19016: Updated the retention behaviour of share groups to retain them forever (#19343)
This PR makes the required changes for retaining a share group forever
post creation. A new field `shouldExpire` is added to all types
implementing the interface `Group`. It returns false only in case of
`ShareGroup` and true otherwise. A check is also added in
`cleanupGroupMetadata` in `GroupCoordinatorShard` and it proceeds with
group expiration only if `shouldExpire` returns true

Reviewers: Andrew Schofield <aschofield@confluent.io>, PoAn Yang <payang@apache.org>
2025-04-02 11:36:04 +01:00
Calvin Liu e3430fef88
KAFKA-19072: Add system test for ELR (#19344)
Verified locally.
```
test_id:    kafkatest.tests.core.eligible_leader_replicas_test.EligibleLeaderReplicasTest.test_basic_eligible_leader_replicas.metadata_quorum=ISOLATED_KRAFT.group_protocol=classic
status:     PASS
run time:   2 minutes 6.074 seconds
--------------------------------------------------------------------------------
test_id:    kafkatest.tests.core.eligible_leader_replicas_test.EligibleLeaderReplicasTest.test_basic_eligible_leader_replicas.metadata_quorum=ISOLATED_KRAFT.group_protocol=consumer
status:     PASS
run time:   2 minutes 6.611 seconds
--------------------------------------------------------------------------------
```

Reviewers: Justine Olshan <jolshan@confluent.io>
2025-04-01 16:27:58 -07:00
Andrew Schofield cee55dbdec
KAFKA-18794: Disable flaky tests pending investigation (#19340)
KafkaShareConsumerTest is proving very flaky. The behaviour of
MockClient does not appear to match the expectations of the test. This
PR disables the flaky tests to reduce build noise. When a proper
solution has been worked out, the tests can be re-enabled.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2025-04-01 16:52:06 +01:00