Commit Graph

11383 Commits

Author SHA1 Message Date
Proven Provenzano 586f89cb1c
KAFKA-15114: Update StorageTool help for creating SCRAM credentials to specify name instead of user. (#13904)
The choice of using name vs. user as a parameter is because internally the record uses name, all
tests using the StorageTool use name as a parameter, KafkaPrincipals are created with name and
because creating SCRAM credentials is done with --entity-name

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-06-29 11:11:12 -07:00
Yash Mayya 30b087ead9
KAFKA-14930: Document the new PATCH and DELETE offsets REST APIs for Connect (#13915)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-29 11:23:23 -04:00
Walker Carlson 12be344fdd
KAFKA-14936: Add Grace period logic to Stream Table Join (2/N) (#13855)
This PR adds the interface for grace period to the Joined object as well as uses the buffer. The majority of it is tests and moving some of the existing join logic.

Reviewers: Victoria Xia <victoria.xia@confluent.io>, Bruno Cadonna <cadonna@apache.org>
2023-06-29 14:14:04 +02:00
Bo Gao 005416879e
KAFKA-15053: Use case insensitive validator for security.protocol config (#13831)
Fixed a regression described in KAFKA-15053 that security.protocol only allows uppercase values like PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL. With this fix, both lower case and upper case values will be supported (e.g. PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL, plaintext, ssl, sasl_plaintext, sasl_ssl)

Reviewers: Chris Egerton <chrise@aiven.io>, Divij Vaidya <diviv@amazon.com>
2023-06-29 10:13:21 +02:00
David Jacot 482299c4e2
KAFKA-14462; [19/N] Add CoordinatorLoader implementation (#13880)
This patch adds a coordinator loader implementation.

Reviewers: Jeff Kim <jeff.kim@confluent.io>, Justine Olshan <jolshan@confluent.io>
2023-06-29 08:12:53 +02:00
José Armando García Sancio ee88a3d1b9
MINOR; Failed atomic file move should be logged at WARN (#13917)
When Kafka fails to perform an atomic file move the error is getting swallowed. Kafka should log these cases at least at WARN level.

Reviewers: Ron Dagostino <rndgstn@gmail.com>, Kirk True <kirk@kirktrue.pro>
2023-06-28 15:55:50 -07:00
José Armando García Sancio 3a246b1aba
KAFKA-15078; KRaft leader replys with snapshot for offset 0 (#13845)
If the follower has an empty log, fetches with offset 0, it is more
efficient for the leader to reply with a snapshot id (redirect to
FETCH_SNAPSHOT) than for the follower to continue fetching from the log
segments.

Reviewers: David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>
2023-06-28 14:21:11 -07:00
Justine Olshan 2f71708955
KAFKA-15028: AddPartitionsToTxnManager metrics (#13798)
Adding the following metrics as per kip-890:

VerificationTimeMs – number of milliseconds from adding partition info to the manager to the time the response is sent. This will include the round trip to the transaction coordinator if it is called. This will also account for verifications that fail before the coordinator is called.

VerificationFailureRate – rate of verifications that returned in failure either from the AddPartitionsToTxn response or through errors in the manager.

AddPartitionsToTxnVerification metrics – separating the verification request metrics from the typical add partitions ones similar to how fetch replication and fetch consumer metrics are separated.

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-28 09:00:37 -07:00
prasanthV 58fc264410
MINOR: Fix ToolsTestUtils by removing incorrect closure of Std Stream (#13922)
Reviewers: Lucas Bradstreet <lucas@confluent.io>, Divij Vaidya <diviv@amazon.com>
2023-06-28 17:46:22 +02:00
minjian.cai e71f68d6c9
MINOR: fix typos for client (#13884)
Reviewers: Luke Chen <showuon@gmail.com>, Divij Vaidya <diviv@amazon.com>, Kirk True <ktrue@confluent.io>
2023-06-28 16:47:42 +02:00
Chia-Ping Tsai 12005484af
MINOR: fix flaky ZkMigrationIntegrationTest.testNewAndChangedTopicsInDualWrite (#13902)
Reviewers: David Arthur <mumrah@gmail.com>
2023-06-28 22:45:26 +08:00
Manyanda Chitimbo f32ebeab17
MINOR: Bump requests (python package) from 2.24.0 to 2.31.0 in /tests (#13903)
Update "requests" lib used in system tests to version "2.31.0" to fix CVE-2023-32681: Unintended leak of Proxy-Authorization header in requests

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-27 21:17:22 +02:00
David Arthur fc7d912e8b
KAFKA-15109 Ensure the leader epoch bump occurs for older MetadataVersions (#13910)
This fixes a regression introduced by the previous KAFKA-15109 commit (d0457f7360 on trunk).

Reviewers: Colin P. McCabe <cmccabe@apache.org>, José Armando García Sancio <jsancio@apache.org>
2023-06-27 11:49:20 -04:00
Manyanda Chitimbo c5889fcedd
MINOR: Split ConsumerCoordinator#testCommitOffsetMetadata onto two test cases testing commitSync and commitAsync (#13665)
Split ConsumerCoordinator#testCommitOffsetMetadata onto two test cases testing commitSync and commitAsync 

Reviewers:  Luke Chen <showuon@gmail.com>
2023-06-24 12:32:21 +08:00
Greg Harris 3978684126
MINOR: Silence error logs for faulty plugins in integration tests (#13912)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-23 14:10:18 -04:00
Yash Mayya 6e72986949
KAFKA-14784: Connect offset reset REST API (#13818)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-23 13:27:46 -04:00
Jeff Kim 1dbcb7da9e
KAFKA-14694: RPCProducerIdManager should not wait on new block (#13267)
RPCProducerIdManager initiates an async request to the controller to grab a block of producer IDs and then blocks waiting for a response from the controller.

This is done in the request handler threads while holding a global lock. This means that if many producers are requesting producer IDs and the controller is slow to respond, many threads can get stuck waiting for the lock.

This patch aims to:
* resolve the deadlock scenario mentioned above by not waiting for a new block and returning an error immediately
* remove synchronization usages in RpcProducerIdManager.generateProducerId()
* handle errors returned from generateProducerId() so that KafkaApis does not log unexpected errors
* confirm producers backoff before retrying
* introduce backoff if manager fails to process AllocateProducerIdsResponse

Reviewers: Artem Livshits <alivshits@confluent.io>, Jason Gustafson <jason@confluent.io>
2023-06-22 10:19:39 -07:00
Ismael Juma 9c8aaa2c35
MINOR: Fix lossy conversions flagged by Java 20 (#13582)
An example of the warning:
> warning: [lossy-conversions] implicit cast from long to int in compound assignment is possibly lossy

There should be no change in behavior as part of these changes - runtime logic ensured
we didn't run into issues due to the lossy conversions.

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-22 08:05:55 -07:00
David Arthur 1bf7039999
KAFKA-15098 Allow authorizers to be configured in ZK migration (#13895)
Reviewers: Ron Dagostino <rdagostino@confluent.io>
2023-06-22 09:34:49 -04:00
David Jacot a81486e4f8
KAFKA-14462; [18/N] Add GroupCoordinatorService (#13812)
This patch introduces the GroupCoordinatorService. This is the new (incomplete) implementation of the group coordinator based on the coordinator runtime introduced in https://github.com/apache/kafka/pull/13795.

Reviewers: Divij Vaidya <diviv@amazon.com>, Justine Olshan <jolshan@confluent.io>
2023-06-22 09:06:10 +02:00
Mickael Maison 3c059133d3
MINOR: Fix generated client ids for Connect (#13896)
Reviewers: Chris Egerton <fearthecellos@gmail.com>
2023-06-21 21:44:14 +02:00
Greg Harris 3b72b0abb1
MINOR: Optimize runtime of MM2 integration tests by batching transactions (#13816)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-21 14:51:54 -04:00
David Arthur d0457f7360
KAFKA-15109 Don't skip leader epoch bump while in migration mode (#13890)
While in migration mode, the KRaft controller must always bump the leader epoch when shrinking an ISR. 
This is required to maintain compatibility with the ZK brokers. Without the epoch bump, the ZK brokers
will ignore the partition state change present in the LeaderAndIsrRequest since it would not contain a new
leader epoch.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2023-06-21 13:09:05 -04:00
Divij Vaidya 88e784f7c6
KAFKA-15084: Remove lock contention from RemoteIndexCache (#13850)
Use thread safe Caffeine to cache indexes fetched from RemoteTier locally. This PR removes a lock contention that led to higher fetch latencies as the IO threads spent time unnecessarily waiting on global cache lock while a single thread fetches the index from remote tier. See PR #13850 for details and rejected alternatives.

Reviewers: Luke Chen <showuon@gmail.com>, Satish Duggana <satishd@apache.org>
2023-06-21 18:22:49 +02:00
hudeqi d5dafe22fe
MINOR:Fill missing parameter annotations for LogCleaner methods (#13839)
Reviewers: Josep Prat <josep.prat@aiven.io>
---------

Co-authored-by: Deqi Hu <deqi.hu@shopee.com>
2023-06-21 15:54:32 +02:00
David Arthur 16bb8cbb8c
MINOR: Increase Github API operations for stale PR check (#13894)
Reviewers: Josep Prat <josep.prat@aiven.io>
2023-06-21 09:52:49 -04:00
minjian.cai ba5e1acdfb
MINOR: fix typos for metadata (#13889)
Reviewers: Divij Vaidya <diviv@amazon.com>, Deqi Hu <deqi.hu@shopee.com>
2023-06-21 15:09:15 +02:00
hudeqi 9b383a1e9e
MINOR: Fix documentation for ConsumeBench metrics in Trogdor (#13877)
Co-authored-by: Deqi Hu <deqi.hu@shopee.com>

Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-21 14:49:13 +02:00
Joseph (Ting-Chou) Lin 72503904e8
MINOR: Log lastCaughtUpTime on ISR shrinkage (#13187)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-21 10:15:50 +02:00
minjian.cai 49c1697ab0
MINOR: fix typos for doc (#13883)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-21 09:57:43 +02:00
Divij Vaidya dd25753aa2
MINOR: Close ReplicaManager correctly in ReplicaManagerTest (#13868)
Fixes thread leaks by closing the ReplicaManager using try/finally at the end of each test. The leaks were leading to flaky test failures in ReplicaManagerTest.

Reviewers: Justine Olshan <jolshan@confluent.io>, David Jacot <djacot@confluent.io>
2023-06-21 09:55:03 +02:00
minjian.cai 474053d297
MINOR: fix typos for streams (#13888)
Reviewers: Divij Vaidya <diviv@amazon.com>, Manyanda Chitimbo <manyanda.chitimbo@gmail.com>
2023-06-20 23:03:42 +02:00
minjian.cai 39a47c8999
MINOR: fix typos for group coordinator (#13886)
Reviewers: Manyanda Chitimbo <manyanda.chitimbo@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-06-20 22:57:26 +02:00
minjian.cai af678a563d
MINOR: fix typos for server common (#13887)
Reviewers: Manyanda Chitimbo <manyanda.chitimbo@gmail.com>, Divij Vaidya <diviv@amazon.com>
2023-06-20 22:56:01 +02:00
minjian.cai 3d97743c67
MINOR: Fix some typos for core (#13882)
Reviewers:  Divij Vaidya <diviv@amazon.com>
2023-06-20 22:52:39 +02:00
minjian.cai d751c13950
MINOR: Fix typos for connect (#13885)
Reviewers: Chris Egerton <chrise@aiven.io>
2023-06-20 16:16:16 -04:00
Ismael Juma dfaae317b8
MINOR: Upgrade Scala for Java 20/21 support (#13840)
Upgrade to Scala 2.13.11 and Scala 2.12.18. A minor test change was required
to fix compilation with Scala 2.13.11.

Scala 2.13 release notes:
* https://github.com/scala/scala/releases/tag/v2.13.11

Scala 2.12 release notes:
* https://github.com/scala/scala/releases/tag/v2.12.16
* https://github.com/scala/scala/releases/tag/v2.12.17
* https://github.com/scala/scala/releases/tag/v2.12.18

Reviewers: Justine Olshan <jolshan@confluent.io>, Josep Prat <josep.prat@aiven.io>
2023-06-20 10:29:23 -07:00
Dimitar Dimitrov b100f1efac
KAFKA-15087 Move/rewrite InterBrokerSendThread to server-commons (#13856)
The Java rewrite is kept relatively close to the Scala original
to minimize potential newly introduced bugs and to make reviewing
simpler. The following details might be of note:
- The `Logging` trait moved to InterBrokerSendThread with the
rewrite of ShutdownableThread has been similarly moved to any
subclasses that currently use it. InterBrokerSendThread's own
logging has been made to use ShutdownableThread's logger which
mimics the prefix/log identifier that the trait provided.
- The case RequestAndCompletionHandler class has been made a
separate POJO class and the internal-use UnsentRequests class
has been kept as a static nested class.
- The relatively commonly used but internal (not part of the
public API) clients classes that InterBrokerSendThread relies on
have been allowlisted in the server-common import control.
- The accompanying test class has also been moved and rewritten
with one new test added and most of the pre-existing tests made
stricter.

Reviewers: David Jacot <djacot@confluent.io>
2023-06-20 16:50:46 +02:00
Shekhar Rajak 0e8c436c7d
KAFKA-7438: Migrate to Mockito in TimeOrderedCachingPersistentWindowStoreTest (#12739)
Replaces EasyMock and PowerMock with Mockito in TimeOrderedCachingPersistentWindowStoreTest.

Reviewers: Divij Vaidya <diviv@amazon.com>, Guozhang Wang <wangguoz@gmail.com>, Bruno Cadonna <cadonna@apache.org>
2023-06-20 13:51:56 +02:00
Colin P. McCabe cd3c0ab1a3 KAFKA-15060: fix the ApiVersionManager interface
This PR expands the scope of ApiVersionManager a bit to include returning the current
MetadataVersion and features that are in effect. This is useful in general because that information
needs to be returned in an ApiVersionsResponse. It also allows us to fix the ApiVersionManager
interface so that all subclasses implement all methods of the interface. Having subclasses that
don't implement some methods is dangerous because they could cause exceptions at runtime in
unexpected scenarios.

On the KRaft controller, we were previously performing a read operation in the QuorumController
thread to get the current metadata version and features. With this PR, we now read a volatile
variable maintained by a separate MetadataVersionContextPublisher object. This will improve
performance and simplify the code. It should not change the guarantees we are providing; in both
the old and new scenarios, we need to be robust against version skew scenarios during updates.

Add a Features class which just has a 3-tuple of metadata version, features, and feature epoch.
Remove MetadataCache.FinalizedFeaturesAndEpoch, since it just duplicates the Features class.
(There are some additional feature-related classes that can be consolidated in in a follow-on PR.)

Create a java class, EndpointReadyFutures, for managing the futures associated with individual
authorizer endpoints. This avoids code duplication between ControllerServer and BrokerServer and
makes this code unit-testable.

Reviewers: David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>, Luke Chen <showuon@gmail.com>
2023-06-19 16:46:44 -07:00
Mickael Maison 190e6de809
MINOR: Close code tag in Producer configs (#13875)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-19 16:58:55 +02:00
Joobi S B f4981790c4
KAFKA-15085: Make Timer.java implement AutoCloseable (#13872)
Change Timer.java to implement AutoCloseable because automatic bug finders will flag a warning if an object of a class is marked as AutoCloseable but is not closed properly in the code.

Reviewers:  Divij Vaidya <diviv@amazon.com>
2023-06-19 15:50:30 +02:00
Daniel Scanteianu 6f7682d2f4
MINOR: add comment that timestamp unit is milliseconds (#13341)
Reviewers:  Divij Vaidya <diviv@amazon.com>
2023-06-19 13:22:09 +02:00
Alexandre Garnier 546b912b83
MINOR: Add and use new method TestUtils.tempPropertiesFile() (#12976)
Reviewers:  Divij Vaidya <diviv@amazon.com>
2023-06-19 13:09:10 +02:00
Manyanda Chitimbo 9b7f7e0fa0
MINOR: update LogCleaner.scala javadoc with a link to OffsetMap to help with code navigation in IDE (#13866)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-06-19 11:05:07 +02:00
Manyanda Chitimbo 958b41b27a
KAFKA-15096: Update snappy-java to 1.1.10.1 (#13865)
The release notes are available at https://github.com/xerial/snappy-java/releases/tag/v1.1.10.1

Reviewers:  Divij Vaidya <diviv@amazon.com>, Josep Prat <josep.prat@aiven.io>
2023-06-19 10:35:49 +02:00
Iblis Lin 41a8e55634
MINOR: fix doc typo of StreamsBuilder.addGlobalStore (#13871)
Reviewers: Manyanda Chitimbo <manyanda.chitimbo@gmail.com>
2023-06-19 10:33:44 +02:00
David Jacot ce7758f3f3
MINOR: Fix testRackAwareRangeAssignor, second try (#13863)
This test still fails regularly with the following error:

```
Error
java.util.concurrent.ExecutionException: org.opentest4j.AssertionFailedError: Timed out while awaiting expected assignment Set(topicWithAllPartitionsOnAllRacks-0, topicWithSingleRackPartitions-0). The current assignment is []
Stacktrace
java.util.concurrent.ExecutionException: org.opentest4j.AssertionFailedError: Timed out while awaiting expected assignment Set(topicWithAllPartitionsOnAllRacks-0, topicWithSingleRackPartitions-0). The current assignment is []
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
	at integration.kafka.server.FetchFromFollowerIntegrationTest.$anonfun$testRackAwareRangeAssignor$9(FetchFromFollowerIntegrationTest.scala:211)
	at integration.kafka.server.FetchFromFollowerIntegrationTest.$anonfun$testRackAwareRangeAssignor$9$adapted(FetchFromFollowerIntegrationTest.scala:211)
	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
```

I propose to increase the timeouts to 30 secs to mitigate it. The test already uses 30 secs timeouts in many places. This patch uses 30 secs everywhere. This solution is not optimal but this is better than having a flaky test.

Reviewers: Justine Olshan <jolshan@confluent.io>
2023-06-19 08:43:42 +02:00
David Jacot 48903c0a9f
MINOR: Make offsets topic creation more reliable in tests (zk mode) (#13848)
I have seen failures like the following one in a few builds:

```
Build / JDK 11 and Scala 2.13 / testDescribeSimpleConsumerGroup() – kafka.admin.DescribeConsumerGroupTest
org.apache.kafka.common.errors.TopicExistsException: Topic '__consumer_offsets' already exists.
```

Many tests still use `TestUtils.createOffsetsTopic(zkClient, servers)` to create the offsets topic. This method does not handle the case where the topic exists (e.g. in the case of a retry). This patch adds this logic.

Reviewers: Divij Vaidya <diviv@amazon.com>, Justine Olshan <jolshan@confluent.io>
2023-06-19 08:38:45 +02:00
hudeqi 09e8adb330
MINOR:Optimize the use of metrics in ReplicaManager and remove checks (#13705)
Co-authored-by: Deqi Hu <deqi.hu@shopee.com>

Reviewers: Divij Vaidya <diviv@amazon.com>, Manyanda Chitimbo <manyanda.chitimbo@gmail.com>, Kirk True <ktrue@confluent.io>
2023-06-17 10:44:56 +02:00