Commit Graph

3325 Commits

Author SHA1 Message Date
Stig Døssing a407cc3a31
KAFKA-17575 Remove unnecessary file.deleteOnExit call (#17226)
TestUtils.tempDirectory already registers a shutdown hook for deleting the temp directory. There's no reason to also call File.deleteOnExit, since that just registers another hook to do the same thing.

Reviewers: TengYao Chi <kitingiao@gmail.com>, Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-23 20:28:08 +08:00
Chia-Chuan Yu 8c2a0619e2
KAFKA-17528 Remove whitelist/blacklist from JMXReporter (#17179)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-23 11:17:01 +08:00
xijiu e90b246002
KAFKA-17555 uncomment all checks of testCommonNameLoggingTrustManagerMixValidAndInvalidCertificates (#17220)
Reviewers: TengYao Chi <kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-20 00:00:36 +08:00
Ivan Yurchenko d0f4d691b5
KAFKA-17322: Document required header versions in Protocol Guide (#16867)
Reviewers: Josep Prat <josep.prat@aiven.io>
2024-09-16 14:19:47 +02:00
Lianet Magrans 6744a718c2
KAFKA-17066 new consumer updateFetchPositions all in background thread (#16885)
Fix for the known issue that the logic for updating fetch positions in the new consumer was being performed partly in the app thread, party in the background thread, potentially leading to race conditions on the subscription state.

This PR moves the logic for updateFetchPositions to the background thread as a single event (instead of triggering separate events to validate, fetchOffsets, listOffsets). A new UpdateFetchPositionsEvent is triggered from the app thread and processed in the background, where it performs those same operations and updates the subscription state accordingly, without blocking the background thread.

This PR maintains the existing logic for keeping a pendingOffsetFetchRequest that does not complete within the lifetime of the updateFetchPositions attempt, and may be used on the next call to updateFetchPositions.

Reviewers: Andrew Schofield <aschofield@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-16 01:43:45 +08:00
TengYao Chi c95865437b
KAFKA-16027: Refactor testUpdatePartitionLeadership (#17083)
Reviewers: David Arthur <mumrah@gmail.com>
2024-09-15 09:38:26 -04:00
PoAn Yang 4692aeb671
KAFKA-17036 KIP-919 supports for createAcls, deleteAcls, describeAcls (#16493)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-14 03:40:32 +08:00
ShivsundarR 3a79fabacf
KAFKA-17502: Modified commitSync() and close() handling in clients (#17136)
Currently the code in ShareConsumeRequestManager works on the basis that there can only be one commitSync()/close() at a time. But there is a chance these calls timeout on the application thread, but are still sent later on the background thread. This will mean the incoming commitSync()/close() will not be processed, resulting in possible loss of acknowledgements.

To cover this case, we will now have a list of AcknowledgeRequestStates to store the commitSyncs() and a separate requestState to store the close(). This queue will be processed one by one until its empty. For close(), we are still assuming there can only be one active close() at a time.

eviewers:  Andrew Schofield <aschofield@confluent.io>, Manikumar Reddy <manikumar.reddy@gmail.com>
2024-09-13 16:54:05 +05:30
TengYao Chi 241b6e6c6f
KAFKA-17410: Disable testPollThrowsInterruptExceptionIfInterrupted for AsyncConsumer (#17172)
Reviewers: Lianet Magrans <lmagrans@confluent.io>
2024-09-12 12:41:05 +02:00
PoAn Yang 3f4c25fe1d
KAFKA-17448: New consumer seek should update positions in background thread (#17075)
Reviewers: Lianet Magrans <lmagrans@confluent.io>, Kirk True <ktrue@confluent.io>
2024-09-11 20:08:33 +02:00
Andrew Schofield 0c4ffc682c
KAFKA-17231 Add missing node latency metrics (#17137)
This is the equivalent of #16755 for the share group consumer.

The node request-latency-max and request-latency-avg were not being recorded and thus reported as NaN for the share group consumer.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-12 01:56:41 +08:00
Vikas Singh b4e1deb43a MINOR: Few cleanups
Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2024-09-11 15:12:53 +05:30
Ken Huang e311716beb
KAFKA-17492 skip features with minVersion of 0 instead of replacing 0 with 1 when BrokerRegistrationRequest < 4 (#17128)
The 3.8 controller assumes the unknown features have min version = 0, but KAFKA-17011 replace the min=0 by min=1 when BrokerRegistrationRequest < 4. Hence, to support upgrading from 3.8.0 to 3.9, this PR changes the implementation of ApiVersionsResponse (<4) and BrokerRegistrationRequest (<4) to skip features with supported minVersion of 0 instead of replacing 0 with 1

Reviewers: Jun Rao <junrao@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-11 01:16:59 +08:00
Frederik Rouleau cd7670d884
KAFKA-17478 Fix NPE with bad metric.reporters config (#17086)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-10 22:22:06 +08:00
Chung, Ming-Yen e0bf580185
KAFKA-17311 Add groupProtocol parameter to testClientInstanceId, testClientInstanceIdInvalidTimeout, and testClientInstanceIdNoTelemetryReporterRegistered (#17135)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-10 22:09:32 +08:00
Sushant Mahajan 821c10157d
KAFKA-17367: Introduce share coordinator [2/N] (#17011)
Introduces the share coordinator. This coordinator is built on the new coordinator runtime framework. It 
is responsible for persistence of share-group state in a new internal topic named "__share_group_state".
The responsibility for being a share coordinator is distributed across the brokers in a cluster. 

Reviewers: David Arthur <mumrah@gmail.com>, Andrew Schofield <aschofield@confluent.io>, Apoorv Mittal <apoorvmittal10@gmail.com>
2024-09-09 20:01:24 -04:00
TengYao Chi 92672d1df8
KAFKA-17470: CommitRequestManager should record failed request only once even if multiple errors in response (#17109)
Reviewers: Lianet Magrans <lmagrans@confluent.io>
2024-09-09 21:52:32 +02:00
xijiu f325bf53e8
MINOR: Simplify the test for `ListOffsetsRequestTest#testListOffsetsRequestOldestVersion` (#17100)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-09 00:49:49 +08:00
Ivan Yurchenko a9f3ea2dd3
KAFKA-17323 Document UINT16 and COMPACT_RECORDS in Protocol Guide (#16868)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-08 13:15:23 +08:00
Kuan-Po Tseng 190df07ace
KAFKA-17265 Fix flaky MemoryRecordsBuilderTest#testBuffersDereferencedOnClose (#17092)
Reviewers: TaiJuWu <tjwu1217@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-05 19:47:16 +08:00
Luke Chen eb9cfb06c0
KAFKA-17412: add doc for `unclean.leader.election.enable` in KRaft (#17051)
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2024-09-03 16:11:46 -07:00
TengYao Chi 2f9b236259
KAFKA-17294 Handle retriable errors when fetching offsets in new consumer (#16833)
The original behavior was implemented to maintain the behavior of the Classic consumer, where the ConsumerCoordinator would do the same when handling the OffsetFetchResponse. This behavior is being updated for the legacy coordinator as part of KAFKA-17279, to retry on all retriable errors.

We should review and update the CommitRequestManager to align with this, and retry on all retriable errors, which seems sensible when fetching offsets.

The corresponding PR for classic consumer is #16826

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-03 19:05:29 +08:00
ShivsundarR 743e185c8b
KAFKA-17450 Reduced the handlers for handling ShareAcknowledgeResponse (#17061)
Currently there are 4 handler functions present for handling ShareAcknowledge responses. ShareConsumeRequestManager had an interface and the respective handlers would implement it. Instead of having 4 different handlers for this, now using AcknowledgeRequestType, we could merge the code and have only 2 handler functions, one for ShareAcknowledge success and one for ShareAcknowledge failure, eliminating the need for the interface.

This PR also fixes a bug - We were not using the time at which the response was received while handling the ShareAcknowledge response, we were using an outdated time. Now the bug is fixed.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Andrew Schofield <aschofield@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2024-09-03 11:31:49 +08:00
TengYao Chi 6a2789cf70
KAFKA-17293: New consumer HeartbeatRequestManager should rediscover disconnected coordinator (#16844)
Reviewers: Lianet Magrans <lianetmr@gmail.com>, TaiJuWu <tjwu1217@gmail.com>
2024-09-01 09:59:21 -04:00
TaiJuWu dc650fbd73
MINOR: add UT for consumer.poll (#17047)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-09-01 10:09:18 +08:00
PoAn Yang 4a2577b801
KAFKA-17395 Flaky test testMissingOffsetNoResetPolicy for new consumer (#17056)
In AsyncKafkaConsumer, FindCoordinatorRequest is sent by background thread. In MockClient#prepareResponseFrom, it only matches the response to a future request. If there is some race condition, FindCoordinatorResponse may not match to a FindCoordinatorRequest. It's better to put MockClient#prepareResponseFrom before the request to avoid flaky test.

Reviewers: TaiJuWu <tjwu1217@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-31 23:57:19 +08:00
Eric Chang a6062d0868
KAFKA-17137 Feat admin client it acl configs (#16648)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-31 12:29:39 +08:00
PoAn Yang 70dd577286
KAFKA-15909 Throw error when consumer configured with empty/whitespace-only group.id for LegacyKafkaConsumer (#16933)
Per KIP-289, the use of an empty value for group.id configuration was deprecated back in 2.2.0.

In 3.7, the AsyncKafkaConsumer implementation will throw an error (see KAFKA-14438).

This task is to update the LegacyKafkaConsumer implementation to throw an error in 4.0.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-30 23:24:36 +08:00
PoAn Yang 2b495945a2
KAFKA-17377: Consider using defaultApiTimeoutMs in AsyncKafkaConsumer#unsubscribe (#17030)
Reviewers: Kirk True <ktrue@confluent.io>, Lianet Magrans <lianetmr@gmail.com>
2024-08-29 20:24:25 -04:00
PoAn Yang 8db80d1f07
KAFKA-17064: New consumer assign should update assignment in background thread (#16673)
Reviewers: Kirk True <ktrue@confluent.io>, Lianet Magrans <lianetmr@gmail.com>
2024-08-29 23:01:36 +02:00
Ken Huang 28e2e8631f
KAFKA-17170: Add test to ensure new consumer acks reconciled assignment even if first HB with ack lost (#16694)
Reviewers: Kirk True <ktrue@confluent.io>, Lianet Magrans <lianetmr@gmail.com>
2024-08-29 13:26:40 +02:00
Kirk True dd7d7c3145
KAFKA-17335 Lack of default for URL encoding configuration for OAuth causes NPE (#16990)
AccessTokenRetrieverFactory uses the value of sasl.oauthbearer.header.urlencode provided by the user, or null if no value was provided for that configuration. When the HttpAccessTokenRetriever is created the JVM attempts to unbox the value into a boolean, a NullPointerException is thrown.

The fix is to explicitly check the Boolean, and if it's null, use Boolean.FALSE.

Reviewers: bachmanity1 <81428651+bachmanity1@users.noreply.github.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-28 23:11:41 +08:00
Lianet Magrans f9e30289d9
KAFKA-17403 Generate HB to leave on pollOnClose if needed (#16974)
Fix to ensure that the HB request to leave the group is generated when closing the HBRequestManager if the state is LEAVING. This is needed because we could end up closing the network thread without giving a chance to the HBManager to generate the request. This flow on consumer.close with short timeout:

1. app thread triggers releaseAssignmentAndLeaveGroup
2. background thread transitions to LEAVING
    2.1 the next run of the background thread should poll the HB manager and generate a request
3. app thread releaseAssignmentAndLeaveGroup times out and moves on to close the network thread (stops polling managers. Calls pollOnClose to gather the final requests and send them along with the unsent)

If 3 happens in the app thread before 2.1 happens in the background, the HB manager won't have a chance to generate the request to leave. This PR implements the pollOnClose to generate the final request if needed.


Reviewers: Kirk True <kirk@kirktrue.pro>, TaiJuWu <tjwu1217@gmail.com>, TengYao Chi <kitingiao@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-28 09:04:25 +08:00
DL1231 006af8b939
KAFKA-17327; Add support of group in kafka-configs.sh (#16887)
The patch adds support of alter/describe configs for group in kafka-configs.sh.

Reviewers: Andrew Schofield <aschofield@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>, David Jacot <djacot@confluent.io>
2024-08-27 02:16:46 -07:00
Kuan-Po Tseng 5557720246
KAFKA-17038 KIP-919 supports for `alterPartitionReassignments` and `listPartitionReassignments` (#16644)
This is a follow-up after KIP-919, extending support for BOOTSTRAP_CONTROLLERS_CONFIG to both Admin#alterPartitionReassignments and Admin#listPartitionReassignments.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-27 17:12:16 +08:00
Andrew Schofield ccd24f2cf6
KAFKA-17341 Refactor consumer heartbeat request managers (#16963)
Refactor the heartbeat request managers for consumer groups and share groups. Almost all of the code can be shared which is definitely good.

Reviewers: Lianet Magrans <lianetmr@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-27 16:37:37 +08:00
xijiu a39037e55c
KAFKA-17399 Apply LambdaValidator to code base (#16980)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-26 21:53:49 +08:00
TengYao Chi d67c18b4ae
KAFKA-17331 Set correct version for EarliestLocalSpec and LatestTieredSpec (#16876)
Add the version check to client side when building ListOffsetRequest for the specific timestamp:
1) the version must be >=8 if timestamp=-4L (EARLIEST_LOCAL_TIMESTAMP)
2) the version must be >=9 if timestamp=-5L (LATEST_TIERED_TIMESTAMP)

Reviewers: PoAn Yang <payang@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-25 17:39:28 +08:00
xijiu e750f44cf8
KAFKA-17409 Remove deprecated constructor of org.apache.kafka.clients.producer.RecordMetadata (#16979)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-25 06:02:42 +08:00
Andrew Schofield ffc865c432
KAFKA-17291: Add integration test for share group list and describe (#16920)
Add an integration test for share group list and describe admin operations.

Reviewers: Omnia Ibrahim <o.g.h.ibrahim@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
2024-08-23 16:31:04 +05:30
xijiu 246b165456
KAFKA-17359 Add tests and enhance the docs of `Admin#describeConfigs` for the case of nonexistent resource (#16947)
- The different behavior of nonexistent resource. For example: nonexistent broker will cause timeout; nonexistent topic will produce UnknownTopicOrPartitionException; nonexistent group will return static/default configs; client_metrics will return empty configs
- The resources (topic and broker resource types are currently supported) this description is out-of-date
- Add some junit test

Reviewers: Andrew Schofield <aschofield@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-23 03:23:34 +08:00
Andrew Schofield 94f5039350
KAFKA-17378 Fixes for performance testing (#16942)
Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-22 06:53:21 +08:00
Sean Quah c207438823
KAFKA-17279: Handle retriable errors from offset fetches (#16826)
Handle retriable errors from offset fetches in ConsumerCoordinator.

Reviewers: Lianet Magrans <lianetmr@gmail.com>, David Jacot <djacot@confluent.io>
2024-08-20 06:13:25 -07:00
ShivsundarR 932e84096a
KAFKA-17325: Updated result handling in ShareConsumeRequestManager::commitAsync(). (#16903)
Currently we were not updating the result count when we merged commitAsync() requests into one batch in ShareConsumeRequestManager, so this led to lesser acknowledgements sent to the application thread (ShareConsumerImpl) than expected.
Fix : Now if the acknowledge response came from a commitAsync, then we do not wait for other requests to complete, we always prepare a background event to be sent.

This PR also fixes a bug in ShareConsumeRequestManager, where during the final ShareAcknowledge sent during close(), we also pick up any piggybacked acknowledgements which were waiting to be sent along with ShareFetch.

 Reviewers:  Andrew Schofield <aschofield@confluent.io>,  Manikumar Reddy <manikumar.reddy@gmail.com>
2024-08-20 16:44:53 +05:30
David Schlosnagle 050edfaf00
KAFKA-14336: MetadataResponse#convertToNodeArray uses iteration (#12782)
Avoids stream allocation on hot code path in Admin#listOffsets

This patch avoids allocating the stream reference pipeline & spliterator for this case by explicitly allocating the pre-sized Node[] and using a for loop with int induction over the specified IDs List argument.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Kirk True <kirk@kirktrue.pro>, David Arthur <mumrah@gmail.com>
2024-08-19 19:46:51 -04:00
PoAn Yang 2f0ae82d4a
KAFKA-12989 MockClient should respect the request matcher passed to prepareUnsupportedVersionResponse (#16849)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 23:19:01 +08:00
lushilin 5f02ef952e
KAFKA-17340 correct the docs of allow.auto.create.topics (#16880)
Reviewers: Guozhang Wang <wangguoz@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-19 03:56:25 +08:00
xijiu 21dd5cd421
KAFKA-16818 Move event processing-related tests from ConsumerNetworkThreadTest to ApplicationEventProcessorTest (#16875)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-16 02:27:52 +08:00
Andrew Schofield 7031855570
KAFKA-17318 ConsumerRecord.deliveryCount and remove deprecations (#16872)
Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2024-08-16 00:11:08 +08:00
Ken Huang b767c65527
KAFKA-17326 The LIST_OFFSET request is removed from the "Api Keys" page (#16870)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2024-08-15 18:59:38 +08:00