Commit Graph

9994 Commits

Author SHA1 Message Date
Bruno Cadonna 020ff2fe0e
MINOR: Update release versions for upgrade tests with 3.2.0 release (#12143)
Updates release versions in files that are used for upgrade test with the 3.2.0 release version.  

Reviewer: David Jacot <djacot@confluent.io>
2022-05-10 14:47:46 +02:00
chern eeb1e702eb
KAFKA-13879: Reconnect exponential backoff is ineffective in some cases (#12131)
When a client connects to a SSL listener using PLAINTEXT security protocol, after the TCP connection is setup, the client considers the channel setup is complete. In reality the channel setup is not complete yet. The client then resets reconnect exponential backoff and issues API version request. Since the broker expects SSL handshake, the API version request will cause the connection to disconnect. Client reconnects without exponential backoff since it has been reset.

This commit removes the reset of reconnect exponential backoff when sending API version request. In the good case where the channel setup is complete, reconnect exponential backoff will be reset when the node becomes ready, which is after getting the API version response. Inter-broker clients which do not send API version request and go directly to ready state continue to reset backoff before any  successful requests.

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>
2022-05-10 11:36:42 +01:00
Mickael Maison 989d3ce07f
MINOR: Small cleanups in connect/mirror (#12113)
Reviewers: Luke Chen <showuon@gmail.com>, Divij Vaidya <divijvaidya13@gmail.com>
2022-05-10 14:49:56 +08:00
Jacklee 2a656aea27
MINOR: fix typo for QUORUM_FETCH_TIMEOUT_MS_DOC (#12132)
Reviewers: Luke Chen <showuon@gmail.com>
2022-05-10 10:47:23 +08:00
David Jacot b485f92647
KAFKA-13790; ReplicaManager should be robust to all partition updates from kraft metadata log (#12085)
This patch refactors the `Partition.makeLeader` and `Partition.makeFollower` to be robust to all partition updates from the KRaft metadata log. Particularly, it ensures the following invariants:

- A partition update is accepted if the partition epoch is equal or newer. The partition epoch is updated by the AlterPartition path as well so we accept an update from the metadata log with the same partition epoch in order to fully update the partition state.
- The leader epoch state offset is only updated when the leader epoch is bumped.
- The follower states are only updated when the leader epoch is bumped.
- Fetchers are only restarted when the leader epoch is bumped. This was already the case but this patch adds unit tests to prove/maintain it.

In the mean time, the patch unifies the state change logs to be similar in both ZK and KRaft world.

Reviewers: Jason Gustafson <jason@confluent.io>
2022-05-09 20:47:14 +02:00
RivenSun df507e56e2
KAFKA-13793: Add validators for configs that lack validators (#12010)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Luke Chen <showuon@gmail.com>, Chris Egerton <fearthecellos@gmail.com>, Christo Lolov <lolovc@amazon.com>, Divij Vaidya <divijvaidya13@gmail.com>
2022-05-09 20:29:17 +02:00
Chris Egerton 1278e385c0
KAFKA-13763: Refactor IncrementalCooperativeAssignor for improved unit testing (#11983)
The goals here include:

1. Create an overloaded variant of the IncrementalCooperativeAssignor::performTaskAssignment method that is more testing friendly
2. Simplify the parameter list for the IncrementalCooperativeAssignor::handleLostAssignments method, which in turn simplifies the logic for testing this class
3. Capture repeated Java 8 streams logic in simple, reusable, easily-verifiable utility methods added to the ConnectUtils class

Reviewers: Luke Chen <showuon@gmail.com>
2022-05-09 21:43:47 +08:00
Artem Livshits f7db6031b8
KAFKA-10888: Sticky partition leads to uneven produce msg (#12049)
The design is described in detail in KIP-794
https://cwiki.apache.org/confluence/display/KAFKA/KIP-794%3A+Strictly+Uniform+Sticky+Partitioner.

Implementation notes:

The default partitioning logic is moved to the BuiltInPartitioner class
(there is one object per topic).  The object keeps track of how many
bytes are produced per-partition and once the amount exceeds batch.size,
switches to the next partition (note that partition switch decision is
decoupled from batching).  The object also keeps track of probability
weights that are based on the queue sizes (the larger the queue size
is the less chance for the next partition to be chosen).  The queue
sizes are calculated in the RecordAccumulator in the `ready` method,
the method already enumerates all partitions so we just add some extra
logic into the existing O(N) method.  The partition switch decision may
take O(logN), where N is the number partitions per topic, but it happens
only once per batch.size (and the logic is avoided when all queues are
of equal size).  Produce bytes accounting logic is lock-free.

When partitioner.availability.timeout.ms is non-0, RecordAccumulator
keeps stats on "node latency" which is defined as the difference between
the last time the node had a batch waiting to be send and the last time
the node was ready to take a new batch.  If this difference exceeds
partitioner.availability.timeout.ms we don't switch to that partition
until the node is ready.

Reviewers: Jun Rao <junrao@gmail.com>
2022-05-06 11:31:12 -07:00
John Roesler e3202b9999
MINOR: Fix RecordContext Javadoc (#12130)
A prior commit accidentally changed the javadoc for RecordContext.
In reality, it is not reachable from api.Processor, only Processor.

Reviewers: Guozhang Wang <guozhang@apache.org>
2022-05-06 11:31:51 -05:00
Bruno Cadonna 816d63b908
MINOR: Fix link to old doc in quickstart (#12129)
In Kafka's quickstart a link points to the 2.5 Kafka Streams demo.
This PR fixes this link.
2022-05-06 11:43:30 +02:00
Luke Chen 16324448a2
KAFKA-13804: Output the reason why broker exit unexpectedly during startup (#12028)
Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-05-06 11:25:33 +02:00
Chris Egerton a586c94af1
KAFKA-10000: Add new source connector APIs related to exactly-once support (KIP-618) (#11773)
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Reviewers: Tom Bentley <tbentley@redhat.com>, Hector Geraldino <hgeraldino@bloomberg.net>, Andrew Eugene Choi <andrew.choi@uwaterloo.ca>
2022-05-06 11:13:59 +02:00
Guozhang Wang 3b08deaa76
KAFKA-13785: [8/N][emit final] time-ordered session store (#12127)
Time ordered session store implementation. I introduced AbstractRocksDBTimeOrderedSegmentedBytesStore to make it generic for RocksDBTimeOrderedSessionSegmentedBytesStore and RocksDBTimeOrderedSegmentedBytesStore.

A few minor follow-up changes:

1. Avoid extra byte array allocation for fixed upper/lower range serialization.
2. Rename some class names to be more consistent.

Authored-by: Hao Li <1127478+lihaosky@users.noreply.github.com>
Reviewers: Guozhang Wang <wangguoz@gmail.com.com>, John Roesler <vvcephei@apache.org>
2022-05-05 16:09:16 -07:00
Bruno Cadonna ced5989ff6
KAFKA-10199: Implement adding active tasks to the state updater (#12128)
This PR adds the default implementation of the state updater. The implementation only implements adding active tasks to the state updater.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-05-05 16:00:35 -07:00
Lucas Wang 0a9893cac0
KAFKA-13815: Avoid reinitialization for a replica that is being deleted (#12029)
This PR tries to avoid the reinitialization of the leader epoch cache
and the partition metadata if the corresponding replica is being deleted.
With this change, the asyncDelete method can run more efficiently,
which means a StopReplica request with many partitions to be deleted can be
processed more quickly.

Reviewers: David Jacot <djacot@confluent.io>, Jun Rao <junrao@gmail.com>
2022-05-04 11:41:34 -07:00
Akhilesh Chaganti 430f75ba22
KAFKA-13861; Fix the validateOnly behavior for CreatePartitions requests in KRaft mode (#12106)
The KRaft implementation of the `CreatePartitions` ignores the `validateOnly` flag in the
request and creates the partitions if the validations are successful. Fixed the behavior
not to create partitions upon validation if the `validateOnly` flag is true.

Reviewers: Divij Vaidya <divijvaidya13@gmail.com>, dengziming <dengziming1993@gmail.com>, Jason Gustafson <jason@confluent.io>
2022-05-04 10:31:46 -07:00
Joel Hamill 18b84d0404
MINOR: Fix typos in configuration docs (#11874)
Reviewers: Chris Egerton, Weikang Sun, Andrew Eugene Choi, Luke Chen, Guozhang Wang
2022-05-04 10:27:14 -07:00
Joel Hamill c6d3bcbd16
MINOR: Improve docs about how to provide multiple log.dir (#12119)
Reviewer:  Luke Chen <showuon@gmail.com>
2022-05-04 11:15:29 +08:00
dengziming bf7cd675f8
MINOR: Remove duplicated test cases in MetadataVersionTest (#12116)
These tests belongs to ApiVersionsResponseTest, and accidentally copied them to MetadataVersionTest when working on #12072.

Reviewer: Luke Chen <showuon@gmail.com>
2022-05-04 11:10:39 +08:00
Guozhang Wang cc2aa96ae4
KAFKA-13785: [6/N][Emit final] Copy: Emit final for TimeWindowedKStreamImpl (#12100)
This is a copy PR of #11896, authored by @lihaosky (Hao Li): Initial implementation to emit final for TimeWindowedKStreamImpl. This PR is on top of #12030 

Author: Hao Li
Reviewers: John Roesler <vvcephei@apache.org>
2022-05-03 09:42:23 -07:00
Bruno Cadonna 3d087244d8
MINOR: Note that slf4j-log4j in version 1.7.35+ should be used (#12114)
Adds a note to the upgrade notes to use slf4j-log4j version
1.7.35+ [1] or slf4j-reload4j to avoid possible compatibility issues
originating from the logging framework [2].

[1] https://www.slf4j.org/manual.html#swapping
[2] https://www.slf4j.org/codes.html#no_tlm

Reviewer: Ismael Juma <ismael@juma.me.uk>
2022-05-03 12:24:53 +02:00
Alyssa Huang 8245c9a3d5
KAFKA-13854 Refactor ApiVersion to MetadataVersion (#12072)
Refactoring ApiVersion to MetadataVersion to support both old IBP versioning and new KRaft versioning (feature flags)
for KIP-778.

IBP versions are now encoded as enum constants and explicitly prefixed w/ IBP_ instead of KAFKA_, and having a
LegacyApiVersion vs DefaultApiVersion was not necessary and replaced with appropriate parsing rules for extracting
the correct shortVersions/versions.

Co-authored-by: David Arthur <mumrah@gmail.com>
Reviewers: Ismael Juma <ismael@juma.me.uk>, David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>, Colin P. McCabe <cmccabe@apache.org>
2022-05-02 16:27:52 -07:00
Colin Patrick McCabe 4a6287e832
MINOR: fix ClientQuotasRequestTest (#12107)
Fix ClientQuotasRequestTest.testAlterClientQuotasBadIp so that it uses actually unresolvable hostnames.
The previous choices "ip" and "abc-123" are now resolvable.

Reviewers: David Jacot <djacot@confluent.io>, Andrew Choi <andrew.choi@uwaterloo.ca>, Divij Vaidya <divijvaidya13@gmail.com>
2022-05-02 09:06:16 -07:00
bozhao12 fbcff567d0
KAFKA-13865: Fix ResponseSendTimeMs metric in RequestChannel is removed twice (#12111)
Fix ResponseSendTimeMs metric in RequestChannel is removed twice

Reviewers: Luke Chen <showuon@gmail.com>
2022-05-02 17:02:53 +08:00
Jason Gustafson f0a09ea003
MINOR: Fix event output inconsistencies in TransactionalMessageCopier (#12098)
This patch fixes some strangeness and inconsistency in the messages written by `TransactionalMessageCopier` to stdout. Here is a sample of two messages.

Progress message:
```
{"consumed":33000,"stage":"ProcessLoop","totalProcessed":33000,"progress":"copier-0","time":"2022/04/24 05:40:31:649","remaining":333}
```
The `transactionalId` is set to the value of the `progress` key.

And a shutdown message:
```
{"consumed":33333,"shutdown_complete":"copier-0","totalProcessed":33333,"time":"2022/04/24 05:40:31:937","remaining":0}
```
The `transactionalId` this time is set to the `shutdown_complete` key and there is no `stage` key.

In this patch, we change the following:

1. Use a separate key for the `transactionalId`.
2. Drop the `progress` and `shutdown_complete` keys.
3. Use `stage=ShutdownComplete` in the shutdown message.
4. Modify `transactional_message_copier.py` system test service accordingly.

Reviewers: David Arthur <mumrah@gmail.com>
2022-04-29 10:02:25 -07:00
RivenSun 53ad99309d
MINOR: Improve document description in zero-copy (#12099)
Follow up of #12052 to improve the description.

Reviewer: David Jacot <djacot@confluent.io>
2022-04-29 17:44:39 +02:00
Rajani Karuturi a673f21242
KAFKA-12380 shutdown Executor in Connect's Worker when closed (#11955)
When the worker is stopped, it does not shutdown this executor. This PR fixes the issue.

Reviewers: Luke Chen <showuon@gmail.com>
2022-04-29 13:35:25 +08:00
Ismael Juma c462a657ec
KAFKA-13794: Fix comparator of inflightBatchesBySequence in TransactionsManager (round 3) (#12096)
Conceptually, the ordering is defined by the producer id, producer epoch
and the sequence number. This set should generally only have entries
for the same producer id and epoch, but there is one case where
we can have conflicting `remove` calls and hence we add this as
a temporary safe fix.

We'll follow-up with a fix that ensures the original intended invariant.

Reviewers: Jason Gustafson <jason@confluent.io>, David Jacot <djacot@confluent.io>, Luke Chen <showuon@gmail.com>
2022-04-28 06:13:23 -07:00
David Jacot 4a367577b9
MINOR: Fix minor typos in `PartitionChangeBuilder` (#12101)
Reviewers: Luke Chen <showuon@gmail.com>
2022-04-28 11:19:34 +08:00
Guozhang Wang e026384ffb
HOTFIX: Only measure in nano when producer metadata refresh is required (#12102)
We added the metadata wait time in total blocked time (#11805). But we added it in the critical path of send which is called per-record, whereas metadata refresh only happens rarely. This way the cost of time.nanos becomes unnecessarily significant as we call it twice per record.

This PR moves the call to inside the waitOnMetadata callee and only when we do need to wait for a metadata refresh round-trip (i.e. we are indeed blocking).

Reviewers: Matthias J. Sax <matthias@confluent.io>
2022-04-27 11:27:54 -07:00
Mike Tobola 6d7723f073
MINOR: fix html generation syntax errors (#12094)
The html document generation has some errors in it, specifically related to protocols. The two issues identified and resolved are:

* Missing </tbody> closing tags added
* Invalid usage of a <p> tag as a wrapper element for <table> elements. Changed the <p> tag to be a <div>.

Tested by running ./gradlew siteDocsTar and observing that the output was properly formed.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-04-26 16:51:12 -07:00
Jason Gustafson f2a782a4d7
MINOR: Rename `AlterIsrManager` to `AlterPartitionManager` (#12089)
Since we have changed the `AlterIsr` API to `AlterPartition`, it makes sense to rename `AlterIsrManager` as well and some of the associated classes.

Reviewers: dengziming <dengziming1993@gmail.com>, David Jacot <djacot@confluent.io>
2022-04-26 09:34:18 -07:00
Philip Nee b020819ac4
KAFKA-12841: Remove an additional call of onAcknowledgement (#12064)
The bug was introduced in #11689 that an additional onAcknowledgement was made using the InterceptorCallback class. This is undesirable since onSendError will attempt to call onAcknowledgement once more.

Reviewers: Jun Rao <junrao@gmail.com>
2022-04-25 15:59:45 -07:00
Alyssa Huang 2a7fdd7670
MINOR; enable KRaft in ConfigCommandIntegrationTest (#11732)
Adding KRaft and ZK params to ConfigCommandIntegrationTest wherever appropriate.

Reviewers: Kvicii <42023367+Kvicii@users.noreply.github.com>, dengziming <dengziming1993@gmail.com>, José Armando García Sancio <jsancio@users.noreply.github.com>
2022-04-25 15:11:14 -07:00
David Jacot a5f7c82a86
MINOR: Refactor `kafka.cluster.Replica` (#12081)
This patch refactors kafka.cluster.Replica, it usages and tests. This is part of the work in KAFKA-13790.

Reviewers: Jason Gustafson <jason@confluent.io>
2022-04-25 21:43:32 +01:00
Jason Gustafson 25ee7f147c
MINOR: Change `AlterPartition` validation order in `KafkaController` (#12032)
Currently we validate recovery state before checking leader epoch in `KafkaController`. It seems more intuitive to validate leader epoch first since the leader might be working with stale state, which is what we do in KRaft. This patch fixes this and adds a couple additional validations to make the behavior consistent. 

Reviewers: José Armando García Sancio <jsancio@users.noreply.github.com>
2022-04-25 09:37:03 -07:00
RivenSun 2b64f1a571
MINOR: Using enums for auto.offset.reset configuration (#12077)
Using enums instead of Strings for auto.offset.reset configuration

Reviewers: Divij Vaidya <divijvaidya13@gmail.com>, Luke Chen <showuon@gmail.com
2022-04-24 20:54:44 +08:00
ruanliang e8c675ed56
KAFKA-13834: add test coverage for RecordAccumulatorTest (#12092)
Reviewers: Luke Chen <showuon@gmail.com>
2022-04-24 17:06:19 +08:00
Hongten ff3d42a18c
KAFKA-13852: Kafka Acl documentation bug for wildcard '*' (#12090)
The wildcard * in command without wrapped by single quote will be replaced into the file name under the current folder by bash. So we need to wrap with single quote. Update the doc and command option description.

Reviewers: dengziming <dengziming1993@gmail.com>, Luke Chen <showuon@gmail.com>
2022-04-24 16:50:44 +08:00
David Jacot 7c8c65fc54
MINOR: Rename `ZkVersion` to `PartitionEpoch` (#12071)
This patch does some initial cleanups in the context of KAFKA-13790. Mainly, it renames `ZkVersion` field to `PartitionEpoch` in the `LeaderAndIsrRequest`, the `LeaderAndIsr` and the `Partition`.

Reviewers: Jason Gustafson <jason@confluent.io>, dengziming <dengziming1993@gmail.com>
2022-04-22 20:38:17 +02:00
Colin Patrick McCabe d480c4aa6e
KAFKA-13841: Fix a case where we were unable to place on fenced brokers in KRaft mode (#12075)
This PR fixes a case where we were unable to place on fenced brokers In KRaft mode. Specifically,
if we had a broker registration in the metadata log, but no associated heartbeat, previously the
HeartbeatManager would not track the fenced broker. This PR fixes this by adding this logic to the
metadata log replay path in ClusterControlManager.

Reviewers: David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>
2022-04-21 14:58:02 -07:00
Luke Chen f28a2ee918
MINOR: revert back to 60s session timeout for static membership test (#11881)
Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-04-21 11:51:31 -07:00
José Armando García Sancio 4380eae7ce
MINOR; Fix partition change record noop check (#12073)
When LeaderRecoveryState was added to the PartitionChangeRecord, the
check for being a noop was not updated. This commit fixes that and
improves the associated test to avoid this oversight in the future.

Reviewers: Colin Patrick McCabe <cmccabe@apache.org>
2022-04-21 09:05:46 -07:00
Clay Johnson 32311bf369
MINOR: Improve Gradle Caching and Fix Deprecations (#12003)
* Fix UP-TO-DATE check in `create*VersionFile` tasks

`create*VersionFile` tasks explicitly declared output UP-TO-DATE status
 as being false. This change properly sets the inputs to
`create*VersionFile` tasks to the `commitId` and `version` values and
sets `receiptFile` locally rather than in an extra property.

* Enable output caching for `process*Messages` tasks

`process*Messages` tasks did not have output caching enabled. This
change enables that caching, as well as setting a property name and
RELATIVE path sensitivity.

* Fix existing Gradle deprecations

Replaces `JavaExec#main` with `JavaExec#mainClass`

Replaces `Report#destination` with `Report#outputLocation`

Adds a `generator` configuration to projects that need to resolve
the `generator` project (rather than referencing the runtimeClasspath
of the `generator` project from other project contexts.

Reviewers: Mickael Maison <mickael.maison@gmail.com>
2022-04-21 17:25:20 +02:00
ruanliang 252e09501d
KAFKA-13834: fix drain batch starving issue (#12066)
In drainBatchesForOneNode method, there's possibility causing some partitions in a node will never get picked. Fix this issue by maintaining a drainIndex for each node.

Reviewers: Luke Chen <showuon@gmail.com>, RivenSun <91005273+RivenSun2@users.noreply.github.com>
2022-04-21 19:26:55 +08:00
RivenSun 6b07f42ecd
MINOR: cleanup for postProcessAndValidateIdempotenceConfigs method (#12069)
Reviewers: Luke Chen <showuon@gmail.com>
2022-04-21 14:34:35 +08:00
Matthias J. Sax 25457377e3
HOTFIX: fix broken trunk due to conflicting and overlapping commits (#12074)
Reviewers: Victoria Xia <victoria.xia@confluent.io>, David Arthur <mumrah@gmail.com>
2022-04-20 14:39:15 -07:00
Sayantanu Dey c5077c679c
KAFKA-13588: consolidate `changelogFor` methods to simplify the generation of internal topic names (#11703)
Reviewers: Guozhang Wang <wangguoz@gmail.com>
2022-04-20 11:39:03 -07:00
Hao Li d83fccd65f
KAFKA-13785: [5/N][emit final] cache for time ordered window store (#12030)
A new cache for RocksDBTimeOrderedWindowStore. Need this because RocksDBTimeOrderedWindowStore's key ordering is different from CachingWindowStore which has issues for MergedSortedCacheWindowStoreIterator

Reviewers: Matthias J. Sax <mjsax@apache.org>, Guozhang Wang <wangguoz@gmail.com>
2022-04-20 11:09:13 -07:00
RivenSun fb66b3668b
KAFKA-13799: Improve documentation for Kafka zero-copy (#12052)
Improve documentation for Kafka zero-copy. Kafka combines pagecache and zero-copy to greatly improve message consumption efficiency. But zero-copy only works in PlaintextTransportLayer.

Reviewers: Divij Vaidya <divijvaidya13@gmail.com>, Guozhang Wang <wangguoz@gmail.com>
2022-04-20 10:31:32 -07:00