Commit Graph

10811 Commits

Author SHA1 Message Date
Philip Nee eee2bf9686
KAFKA-6793: Unused configuration logging appears to be noisy and unnecessary (#13225)
Warnings about unused configs are most often spurious. This patch changes the current warning to an info message.

Reviewers: Chris Egerton <chrise@aiven.io>, Jason Gustafson <jason@confluent.io>
2023-02-13 09:27:55 -08:00
Chris Egerton 8cfafba279
KAFKA-14021: Implement new KIP-618 APIs in MirrorSourceConnector (#12366)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-02-13 10:09:14 -05:00
Ismael Juma 959756ae9d
MINOR: Remove unnecessary usage of `LazyIndex` (#13218)
The remote index classes use `LazyIndex`, but immediately
force materialization. This results in more verbose code
and it's misleading since the indexes are not lazily
used in practice.

Also simplify `LazyIndex.forOffset/forTime` by removing
`writable` parameter, which is always `true`.

Reviewers: Satish Duggana <satishd@apache.org>
2023-02-13 13:46:37 +05:30
Rajini Sivaram ef9c9486da
KAFKA-14676: Include all SASL configs in login cache key to ensure clients in a JVM can use different OAuth configs (#13211)
We currently cache login managers in static maps for both static JAAS config using system property and for JAAS config specified using Kafka config sasl.jaas.config. In addition to the JAAS config, the login manager callback handler is included in the key, but all other configs are ignored. This implementation is based on the assumption clients that require different logins (e.g. username/password) use different JAAS configs, because login properties are included in the JAAS config rather than as separate top-level configs. The OIDC support added in KIP-768 only allows configuration of token endpoint URL as a top-level config. This results in two clients in a JVM configured with different token endpoint URLs to incorrectly share a login.

This PR includes all SASL configs prefixed with sasl. to be included in the key so that logins are only shared if all the sasl configs are identical. 

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Kirk True <kirk@mustardgrain.com>
2023-02-12 19:49:12 +00:00
Chia-Ping Tsai 69f0481342
MINOR: the package of JmxTool is incorrect when running quota_test.py (#13233)
Reviewers: Federico Valeri <fedevaleri@gmail.com>, David Jacot <djacot@confluent.io>
2023-02-13 01:31:55 +08:00
Satish Duggana c576e02849
KAFKA-14480 Move/Rewrite ProducerStateManager to storage module. (#13040)
KAFKA-14480 Move/Rewrite of ProducerStateManager to the storage module.

Replaced `File.listFiles` with `Files.list` in ProducerStateManager.listSnapshotFiles
Used `Path` instead of `File` in ProducerStateManager.isSnapshotFile to check whether the given path is a file or not and has a suffix of '.snapshot'.
2023-02-12 13:00:51 +05:30
Victoria Xia df22a9d0e6
KAFKA-14491: [5/N] Basic operations for RocksDB versioned store (#13188)
Introduces the VersionedKeyValueStore interface proposed in KIP-889, along with the RocksDB-based implementation of the interface. This PR includes fully functional put, get, get-with-timestamp, and delete operations, but does not include the ability to restore records from changelog or surrounding store layers (for metrics or writing to the changelog). Those pieces will come in follow-up PRs.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-02-10 17:30:09 -08:00
Colin Patrick McCabe b5a9b9d67e
MINOR: Remove references to HIGHEST_SUPPORTED_VERSION from ZkMigrationClient (#13226)
Do not use HIGHEST_SUPPORTED_VERSION in ZkMigrationClient because
it will do the wrong thing when more MV options are added in the future.

Reviewers: David Arthur <mumrah@gmail.com>
2023-02-10 14:41:43 -08:00
David Jacot 39962eeeb3
KAFKA-14513; Add broker side PartitionAssignor interface (#13202)
This patch adds the broker side `PartitionAssignor` interface as detailed in KIP-848. The interfaces differs a bit from the KIP in the following ways:
* The POJOs are not defined within the interface because the interface is to heavy like this.
* The interface is kept in the `group-coordinator` module for now. We don't want to have it out there until KIP-848 is ready to be released. We will move it to its final destination later.

Reviewers: Jeff Kim <jeff.kim@confluent.io>, Justine Olshan <jolshan@confluent.io>, Christo Lolov <lolovc@amazon.com>, Guozhang Wang <wangguoz@gmail.com>
2023-02-10 08:26:00 +01:00
Guozhang Wang 083e11a22c
KAFKA-14650: Synchronize access to tasks inside task manager (#13167)
1. The major fix: synchronize access to tasks inside task manager, this is a fix of a regression introduced in #12397
2. Clarify on func names of StreamThread that maybe triggered outside the StreamThread.
3. Minor cleanups.

Reviewers: Lucas Brutschy <lucasbru@users.noreply.github.com>
2023-02-09 10:33:19 -08:00
David Arthur cb4d9d1abf
KAFKA-14668 Avoid unnecessary UMR during ZK migration (#13183)
Only send UMR to ZK brokers if the cluster metadata or topic metadata has changed.

Reviewers: Akhilesh C <akhileshchg@users.noreply.github.com>, Colin P. McCabe <cmccabe@apache.org>
2023-02-09 13:24:02 -05:00
Chris Egerton f93d5af839
KAFKA-15086, KAFKA-9981: Intra-cluster communication for Mirror Maker 2 (#13137)
Reviewers: Daniel Urban <durban@cloudera.com>, Greg Harris <greg.harris@aiven.io>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Mickael Maison <mickael.maison@gmail.com>
2023-02-09 10:50:07 -05:00
Ismael Juma 031d0ff1ba
MINOR: Update build and test dependencies for 3.5 (#13199)
The most recent version that didn't cause compiler or test errors was chosen.

Gradle plugin updates follow, they include minor fixes and support
for newer Java and Gradle versions:

- spotless: 6.10.0 -> 6.13.0
- versions: 0.42.0 -> 0.44.0
- dependencycheck: 7.1.1 -> 8.0.2
- rat: 0.7.1 -> 0.8.0
- spotbugs: 5.0.9 -> 5.0.13
- test-retry: 1.4.0 -> 1.5.1
- scoverage: 7.0.0 -> 7.0.1

Test/benchmark updates:

- jmh: 1.35 -> 1.36
GC profiler and perfasm improvements
https://mail.openjdk.org/pipermail/jmh-dev/2022-November/003553.html

- junit: 5.9.0 -> 5.9.2
Minor fixes
https://junit.org/junit5/docs/current/release-notes/index.html#release-notes-5.9.2

- jqwik: 1.6.5 -> 1.7.2
A number of usability improvements, bug fixes and minor breaking changes
https://jqwik.net/release-notes.html#172

- mockito: 4.6.1 -> 4.9.0
Usability improvements, perf fixes and bug fixes
https://github.com/mockito/mockito/releases/tag/v4.7.0
https://github.com/mockito/mockito/releases/tag/v4.8.0
https://github.com/mockito/mockito/releases/tag/v4.8.1
https://github.com/mockito/mockito/releases/tag/v4.9.0

Reviewers: Stanislav Kozlovski <stanislav_kozlovski@outlook.com>, Luke Chen <showuon@gmail.com>
2023-02-09 15:16:39 +01:00
Divij Vaidya e903f2cd96
KAFKA-7109: Close fetch sessions on close of consumer (#12590)
## Problem
When consumer is closed, fetch sessions associated with the consumer should notify the server about it's intention to close using a Fetch call with epoch = -1 (identified by `FINAL_EPOCH` in `FetchMetadata.java`). However, we are not sending this final fetch request in the current flow which leads to unnecessary fetch sessions on the server which are closed only after timeout.

## Changes
1. Change `close()` in `Fetcher` to add a logic to send the final Fetch request notifying close to the server.
2. Change `close()` in `Consumer` to respect the timeout duration passed to it. Prior to this change, the timeout parameter was being ignored.
3. Change tests to close with `Duration.zero` to reduce the execution time of the tests. Otherwise the tests will wait for default timeout to exit (close() in the tests is expected to be unsuccessful because there is no server to send the request to).
4. Distinguish between the case of "close existing session and create new session" and "close existing session" by renaming the `nextCloseExisting` function to `nextCloseExistingAttemptNew`.

## Testing
Added unit test which validates that the correct close request is sent to the server.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Kirk True <kirk@mustardgrain.com>, Philip Nee <philipnee@gmail.com>, Luke Chen <showuon@gmail.com>, David Jacot <djacot@confluent.io>
2023-02-09 14:53:10 +01:00
Paolo Patierno 2603033e35
MINOR: Fixed typos in KRaft related metrics documentation (#13222)
Signed-off-by: Paolo Patierno <ppatierno@live.com>

Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-02-09 12:07:12 +01:00
David Jacot 3be7f7d611
KAFKA-14391; Add ConsumerGroupHeartbeat API (#12972)
This patch does a few things:
1) It introduces a new flag to the request spec: `latestVersionUnstable`. It signifies that the last version of the API is considered unstable (or still in development). As such, the last API version is not exposed by the server unless specified otherwise with the new internal `unstable.api.versions.enable`. This allows us to commit new APIs which are still in development.
3) It adds the ConsumerGroupHeartbeat API, part of KIP-848, and marks it as unreleased for now.
4) It adds the new error codes required by the new ConsumerGroupHeartbeat API.

Reviewers: Justine Olshan <jolshan@confluent.io>, Jeff Kim <jeff.kim@confluent.io>, Jason Gustafson <jason@confluent.io>
2023-02-09 09:13:31 +01:00
David Jacot 659dd2e49f
KAFKA-14048: Add new `__consumer_offsets` records from KIP-848 (#13203)
This patch adds the new (only the new ones) `__consumer_offsets` records as described in [KIP-848](https://cwiki.apache.org/confluence/display/KAFKA/KIP-848%3A+The+Next+Generation+of+the+Consumer+Rebalance+Protocol#KIP848:TheNextGenerationoftheConsumerRebalanceProtocol-Records).

Reviewers: Christo Lolov <lolovc@amazon.com>, Mickael Maison <mickael.maison@gmail.com>
2023-02-09 09:10:28 +01:00
Alyssa Huang 087a5d8f4f
MINOR: fix hyperlink tags (#13221)
fix hyperlink tags in upgrade doc

Reviewers: Luke Chen <showuon@gmail.com>
2023-02-09 10:19:57 +08:00
Satish Duggana 1d3fb76092
KAFKA-14688 Move package org.apache.kafka.server.log.internals to org.apache.kafka.storage.internals.log (#13213)
Reviewers: Ismael Juma <ismael@juma.me.uk>
2023-02-08 09:22:42 +05:30
Guozhang Wang 788793dee6
KAFKA-10575: Add onRestoreSuspsnded to StateRestoreListener (#13179)
1. Add the new API (default impl is empty) to StateRestoreListener.
2. Update related unit tests

Reviewers: Lucas Brutschy <lucasbru@users.noreply.github.com>, Matthias J. Sax <mjsax@apache.org>
2023-02-07 11:33:09 -08:00
Matthias J. Sax 463bb00b11
MINOR: remove unncessary helper method (#13209)
Reviewers: Christo Lolov (@clolov), Lucas Brutschy <lbrutschy@confluent.io>, Ismael Juma <ismale@confluent.io>
2023-02-07 11:21:58 -08:00
Manikumar Reddy c2aaea3519 MINOR: Add 3.4 notable changes section to upgrade docs 2023-02-08 00:04:06 +05:30
Manikumar Reddy 8cdf9564ab MINOR: Add FeatureZNode ZK node path to ZK root paths 2023-02-07 23:10:18 +05:30
Christo Lolov a0a9b6ffea
MINOR: Remove unnecessary code (#13210)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-02-07 17:37:45 +01:00
Satish Duggana da2e8dce71
KAFKA-14551 Move/Rewrite LeaderEpochFileCache and its dependencies to the storage module. (#13046)
KAFKA-14551 Move/Rewrite LeaderEpochFileCache and its dependencies to the storage module.

For broader context on this change, you may want to look at KAFKA-14470: Move log layer to the storage module

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jun Rao <junrao@gmail.com>, Alexandre Dupriez <alexandre.dupriez@gmail.com>
2023-02-07 15:37:23 +05:30
David Jacot 094e343f18
KAFKA-14678; Move `__consumer_offsets` records from `core` to `group-coordinator` (#13200)
This patch moves the current `__consumer_offsets` records from the `core` module to the new `group-coordinator` module.

Reviewers: Christo Lolov <lolovc@amazon.com>, Mickael Maison <mickael.maison@gmail.com>
2023-02-07 09:06:56 +01:00
Ron Dagostino 6d11261d5d
MINOR: IBP_3_4_IV1 should be IBP_3_5_IV0 because it is not in 3.4 (#13198)
The KIP-405 MetadataVersion changes will be released as part of AK 3.5, but were added as BP_3_4_IV1.
This change fixes them to be IBP_3_5_IV0. There is no incompatibility  because this feature has not yet
been released. Also set didMetadataChange to false because KRaft metadata log records did not change.

Reviewers: Satish Duggana <satishd@apache.org>, Christo Lolov <christo_lolov@yahoo.com>, Colin P. McCabe <cmccabe@apache.org>
2023-02-06 10:37:50 -08:00
Eric Haag 5ec4ccfc9e
MINOR: Set root project name in build.gradle (#13128)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-02-06 12:17:24 +01:00
Yash Mayya 8f00782be7
MINOR: Connect Javadocs improvements (#13120)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-02-06 12:07:53 +01:00
Eric Haag b20e2539b4
MINOR: Remove unnecessary call to asCollection causing eager dependency resolution (#13149)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Nelson Osacky
2023-02-06 11:28:02 +01:00
Chris Egerton 9ab689f7d4
KAFKA-14610: Publish Mirror Maker 2 offset syncs in task commit() method (#13181)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-02-06 10:53:58 +01:00
Victoria Xia 4a7fedd46a
KAFKA-14491: [3/N] Add logical key value segments (#13143)
Part of KIP-889

Reviewers: Matthias J. Sax <matthias@confuent.io>
2023-02-03 17:26:33 -08:00
Yash Mayya 6e2b86597d
MINOR: Update incorrect / misleading comment regarding rebalance exceptions in WorkerSinkTask (#13194)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-02-03 09:00:08 -05:00
Victoria Xia b8e606355b
KAFKA-14491: [4/N] Improvements to segment value format for RocksDB versioned store (#13186)
Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-02-02 21:48:40 -08:00
Shekhar Rajak 3cf13064cc
Replace EasyMock and PowerMock with Mockito - TimeOrderedWindowStoreTest (#12777)
Related to KAFKA-14059 and KAFKA-14132

* Replace EasyMock and PowerMock with Mockito - TimeOrderedWindowStoreTest.java
* Reset removed which was not needed

Reviewers: Divij Vaidya <diviv@amazon.com>, Guozhang Wang <wangguoz@gmail.com>
2023-02-02 16:03:47 -08:00
Yash Mayya a3cf8b54e0
KAFKA-14455: Kafka Connect create and update REST APIs should surface failures while writing to the config topic (#12984)
Reviewers: Greg Harris <greg.harris@aiven.io>, Chris Egerton <chrise@aiven.io>
2023-02-02 11:03:38 -05:00
Federico Valeri 50e0e3c257
KAFKA-14582: Move JmxTool to tools (#13136)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2023-02-02 11:23:26 +01:00
Victoria Xia 65bb819313
KAFKA-14491: [1/N] Add segment value format for RocksDB versioned store (#13126)
Part of KIP-889.

The KIP proposed the introduction of versioned key-value stores, as well as a RocksDB-based implementation. The RocksDB implementation will consist of a "latest value store" for storing the latest record version associated with each key, in addition to multiple "segment stores" to store older record versions. Within a segment store, multiple record versions for the same key will be combined into a single bytes array "value" associated with the key and stored to RocksDB.

This PR introduces the utility class that will be used to manage the value format of these segment stores, i.e., how multiple record versions for the same key will be combined into a single bytes array "value." Follow-up PRs will introduce the versioned store implementation itself (which calls heavily upon this utility class).

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-02-01 13:19:53 -08:00
Colin Patrick McCabe 6625214c52
KAFKA-14658: Do not open broker ports until we are ready to accept traffic (#13169)
When we are listening on fixed ports, we should defer opening ports until we're ready to accept
traffic. If we open the broker port too early, it can confuse monitoring and deployment systems.
This is a particular concern when in KRaft mode, since in that mode, we create the SocketServer
object earlier in the startup process than when in ZK mode.

The approach taken in this PR is to defer opening the acceptor port until Acceptor.start is called.
Note that when we are listening on a random port, we continue to open the port "early," in the
SocketServer constructor. The reason for doing this is that there is no other way to find the
random port number the kernel has selected. Since random port assignment is not used in production
deployments, this should be reasonable.

FutureUtils.java: add chainFuture and tests.

SocketServerTest.scala: add timeouts to cases where we call get() on futures.

Reviewers: David Arthur <mumrah@gmail.com>, Alexandre Dupriez <hangleton@users.noreply.github.com>
2023-02-01 09:42:03 -08:00
Jorge Esteban Quilcate Otoya 7d61d4505a
KAFKA-14409: Clean ProcessorParameters from casting (#12879)
Reviewers: A. Sophie Blee-Goldman <ableegoldman@gmail.com>, John Roesler <vvcephei@apache.org>
2023-01-31 15:55:50 -06:00
Lucas Brutschy eb7f490159
chore: Fix scaladoc warnings (#13164)
Make sure no scaladoc warnings are emitted from the streams-scala project build.
We cannot fully fix all scaladoc warnings due to limitations of the scaladoc tool,
so this is a best-effort attempt at fixing as many warnings as possible. We also
disable one problematic class of scaladoc wornings (link errors) in the gradle build.

The causes of existing warnings are that we link to java members from scaladoc, which
is not possible, or we fail to disambiguate some members.

The broad rule applied in the changes is
 - For links to Java members such as [[StateStore]], we use the fully qualified name in a code tag
   to make manual link resolution via a search engine easy.
 - For some common terms that are also linked to Java members, like [[Serde]], we omit the link.
 - We disambiguate where possible.
 - In the special case of @throws declarations with Java Exceptions, we do not seem to be able
   to avoid the warning altogther.

Reviewers: Matthias J. Sax <mjsax@apache.org>, Guozhang Wang <wangguoz@gmail.com>
2023-01-31 09:00:48 -08:00
Victoria Xia 6c98544a96
KAFKA-14491: [2/N] Refactor RocksDB store open iterator management (#13142)
This PR refactors how the list of open iterators for RocksDB stores is managed. Prior to this PR, the `openIterators` list was passed into the constructor for the iterators themselves, allowing `RocksDbIterator.close()` to remove the iterator from the `openIterators` list. After this PR, the iterators themselves will not know about lists of open iterators. Instead, a generic close callback is exposed, and it's the responsibility of the store that creates a new iterator to set the callback on the iterator, to ensure that closing an iterator removes the iterator from the list of open iterators.

This refactor is desirable because it enables more flexible iterator lifecycle management. Building on top of this, RocksDBStore is updated with an option to allow the user (i.e., the caller of methods such as `range()` and `prefixScan()` which return iterators) to pass a custom `openIterators` list for the new iterator to be stored in. This will allow for a new Segments implementation where multiple Segments can share the same RocksDBStore instance, while having each Segment manage its own open iterators.

Part of KIP-889.

Reviewers: Matthias J. Sax <matthias@confluent.io>
2023-01-31 00:05:43 -08:00
Matthias J. Sax dc01199271
KAFAK-14660: Fix divide-by-zero vulnerability (#13175)
This PR adds a safe-guard for divide-by-zero. While `totalCapacity` can never be zero, an explicit error message is desirable.

Reviewers: Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
2023-01-30 23:39:41 -08:00
David Arthur 89a4735c35
KAFKA-14656: Send UMR first during ZK migration (#13159)
When in migration-from-ZK mode and sending RPCs to ZK-based brokers, the KRaft controller must send
full UpdateMetadataRequests prior to sending full LeaderAndIsrRequests. If the controller sends the
requests in the other order, and the ZK-based broker does not already know about some of the nodes
referenced in the LeaderAndIsrRequest, it will reject the request.

This PR includes an integration test, and a number of other small fixes for dual-write.

Co-authored-by: Akhilesh C <akhileshchg@users.noreply.github.com>
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-01-30 22:31:45 -08:00
Colin Patrick McCabe eb7d5cbf15
MINOR: add startup timeouts to KRaft integration tests (#13153)
When running junit tests, it is not good to block forever on CompletableFuture objects.  When there
are bugs, this can lead to junit tests hanging forever. Jenkins does not deal with this well -- it
often brings down the whole multi-hour test run.  Therefore, when running integration tests in
JUnit, set some reasonable time limits on broker and controller startup time.

Reviewers: Jason Gustafson <jason@confluent.io>
2023-01-30 11:29:30 -08:00
Chris Egerton 17559d581e
KAFKA-14645: Use plugin classloader when retrieving connector plugin config definitions (#13148)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Greg Harris <gharris1727@gmail.com>
2023-01-30 18:06:02 +01:00
Federico Valeri 72cfc994f5
KAFKA-14628: Move CommandLineUtils and CommandDefaultOptions to tools (#13131)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Christo Lolov <christololov@gmail.com>, Sagar Rao <sagarmeansocean@gmail.com>
2023-01-26 20:06:09 +01:00
José Armando García Sancio f9e0d03274
MINOR; Make granting voter immutable (#13154)
Make LeaderState's grantingVoters field explicitly immutable. The set of voters that granted their voter to the current leader was already immutable. This change makes that explicit.

Reviewers: Jason Gustafson <jason@confluent.io>, Mathew Hogan <mathewdhogan@@users.noreply.github.com>
2023-01-25 15:52:01 -08:00
Jason Gustafson 598ba5f2fd
KAFKA-14644: Process should crash after failure in Raft IO thread (#13140)
Unexpected errors caught in the Raft IO thread should cause the process to stop. This is similar to the handling of exceptions in the controller.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-01-25 09:41:38 -08:00
Alyssa Huang 0711375b1e
KRaft brokers and controllesr should fail on Authorizer failure (#13151)
KRaft brokers and controllesr should fail to start if any authorizer fails to start.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-01-24 16:08:33 -08:00