Skip to content
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
a8bdc7b
KAFKA-14274 [6, 7]: Introduction of fetch request manager
kirktrue Sep 19, 2023
7ab56f2
Reverted change to make FetchCollector.collectFetch() not take a Dese…
kirktrue Sep 19, 2023
772ff2e
KAFKA-14274 [6, 7]: Introduction of fetch request manager
kirktrue Sep 19, 2023
a30ac4e
Reverted change to make FetchCollector.collectFetch() not take a Dese…
kirktrue Sep 19, 2023
72b6b27
Post-rebase clean up
kirktrue Sep 22, 2023
ba9f0ff
Merge branch 'KAFKA-14274-3-introduce-fetch-request-manager-take-2' o…
kirktrue Sep 22, 2023
7c8b945
Update NetworkClientDelegate.java
kirktrue Sep 22, 2023
59d0daf
Minor clean up and refactoring based on first pass of reviews
kirktrue Sep 23, 2023
5eef0f7
Medium-sized refactor of the queue processing
kirktrue Sep 26, 2023
0457117
Merge branch 'trunk' into KAFKA-14274-3-introduce-fetch-request-manag…
kirktrue Sep 26, 2023
1e18f98
Changes to PrototypeAsyncConsumer.close()
kirktrue Sep 26, 2023
4a9cdd0
Updates to the fetch results/buffering process
kirktrue Sep 26, 2023
c873463
Updates for background event handler
kirktrue Sep 26, 2023
e8b990f
Minor refactoring for the event processor callbacks
kirktrue Sep 26, 2023
731e716
Added comment to explain a case in DefaultBackgroundThread.wakeup()
kirktrue Sep 26, 2023
3f92079
Closing the fetch sessions
kirktrue Sep 28, 2023
e08d01a
Minor logic change for assignFromUserNoId
kirktrue Oct 3, 2023
d7c4d0c
Minor logic change for assignFromUserNoId (from FetchRequestManagerTest)
kirktrue Oct 3, 2023
6ffb7ec
Removed unnecessary references to "this" in fetcher tests
kirktrue Oct 3, 2023
81c0c7e
Renamed FetchRequestManagerTest's consumerClient to networkClientDele…
kirktrue Oct 3, 2023
7674304
Removed FetchRequestManagerTest's oldConsumerClient
kirktrue Oct 3, 2023
0cbb8d2
Updated comment placement in old and new fetcher tests
kirktrue Oct 3, 2023
9c7b4c4
Added documentation to RequestManager methods and referenced from Fet…
kirktrue Oct 3, 2023
65197a1
Refactored AbstractFetch to make fetch request maps more succinct
kirktrue Oct 3, 2023
5387b7f
Removed unnecessary "this" references.
kirktrue Oct 4, 2023
8490681
Minor formatting change in beginningOrEndOffset
kirktrue Oct 4, 2023
4e463d2
Revised usage of Timer in DefaultBackgroundThread.runAtClose()
kirktrue Oct 4, 2023
d3e920d
Got fed up and changed DefaultBackgroundThread to ConsumerNetworkThread
kirktrue Oct 4, 2023
60470ed
Asserting ConsumerNetworkThread is not closed on each call to runOnce()
kirktrue Oct 4, 2023
6c1004f
Clean up of outdated comments for BackgroundEventProcessor.process()
kirktrue Oct 4, 2023
8497558
Clean up of logging, but a lot of other refactoring to reduce boilerp…
kirktrue Oct 4, 2023
6338733
Removed now unneeded BackgroundEventHandler from FetchRequestManager
kirktrue Oct 4, 2023
634e15b
Turned down the logging level in a couple of places
kirktrue Oct 5, 2023
5f9aa58
Removed comment about wakeups from poll() (filed KAFKA-15555 to handle)
kirktrue Oct 5, 2023
193af82
Fixed comment in assign() method
kirktrue Oct 5, 2023
cda5741
Made FetchBuffer thread safe so that it can be shared by application …
kirktrue Oct 6, 2023
0d56cac
Minor: removed unnecessarily qualified reference to object from withi…
kirktrue Oct 7, 2023
f4fac21
Merge remote-tracking branch 'upstream/trunk' into KAFKA-14274-3-intr…
kirktrue Oct 9, 2023
17458c4
Resolving merge conflicts with changes to trunk
kirktrue Oct 9, 2023
281f28c
Removed assertion from ConsumerNetworkThread.runOnce to avoid logging
kirktrue Oct 9, 2023
15738bd
Updated the fetch response handler method names for clarity
kirktrue Oct 10, 2023
24e014f
ApplicationEventProcessor will now NOT throw errors on event processi…
kirktrue Oct 10, 2023
2eaca7e
Removed redundant tests from ConsumerNetworkThreadTest
kirktrue Oct 10, 2023
d2ab01e
Now issuing both the poll() and pollOnClose() network I/O on the Cons…
kirktrue Oct 10, 2023
19327fa
Fixed minor whitespace checkstyle violation in ConsumerNetworkThreadTest
kirktrue Oct 10, 2023
621fc7d
Fixed typo in RequestManager comment
kirktrue Oct 10, 2023
bc3102f
Merge remote-tracking branch 'upstream/trunk' into KAFKA-14274-3-intr…
kirktrue Oct 13, 2023
5a80371
Comments change to remove close() method in testFetcherCloseClosesFet…
kirktrue Oct 13, 2023
2ba9e85
Removed superfluous poll() from testFetcherCloseClosesFetchSessionsIn…
kirktrue Oct 13, 2023
627624c
Updated method names in FetcherTest and FetchRequestManagerTest
kirktrue Oct 13, 2023
6ebd657
Changed locally-scoped "records" to "testRecords" to avoid naming col…
kirktrue Oct 13, 2023
e971901
Grammar fixes for comments in fetch tests
kirktrue Oct 13, 2023
97d833e
Removed unnecessary fetchRecords call from testPartialFetchWithPaused…
kirktrue Oct 13, 2023
5629d2c
Refactoring to use parameterized test for different fetch response er…
kirktrue Oct 13, 2023
913fc8b
Added check for no pending requests in testEpochSetInFetchRequest
kirktrue Oct 13, 2023
e4c416c
Added clarifying comments to testFetchedRecordsAfterSeek
kirktrue Oct 13, 2023
dd95661
Updated fetch tests to use fetchRecordsInto utility method to reduce …
kirktrue Oct 13, 2023
b752bf8
Fixed typo in comments
kirktrue Oct 13, 2023
8458f2c
Renamed and swapped 'expected' vs. 'actual' comparison in testMultipl…
kirktrue Oct 13, 2023
7e39a74
Changed testReturnAbortedTransactionsinUncommittedMode() to testRetur…
kirktrue Oct 13, 2023
2bd3635
Grammar/typo fix
kirktrue Oct 13, 2023
cd0e9ae
Moved comment in testPreferredReadReplicaOffsetError closer to applic…
kirktrue Oct 13, 2023
b18720f
Removed FetchEvent and added wakeup() method to ApplicationEventHandler
kirktrue Oct 14, 2023
f6093d6
Updates to change references to method namews
kirktrue Oct 16, 2023
589bcc8
Removed outdated comment in testUnauthorizedTopic()
kirktrue Oct 16, 2023
e9d2bef
Test method name changed for clarity
kirktrue Oct 16, 2023
44e7789
Removed unnecessarily comment from FetchRequestManagerTest.testFetche…
kirktrue Oct 19, 2023
1eaad84
Updated variable name in FetchRequestManagerTest.testFetcherCloseClos…
kirktrue Oct 19, 2023
9483363
On close, make the application thread wait for the network thread to …
kirktrue Oct 19, 2023
99a65ec
Handle previously cached errors from getOffsetResetTimestamp
kirktrue Oct 20, 2023
8372505
Updated wakeup() to be invoked only after receiving a non-empty Fetch
kirktrue Oct 20, 2023
fb4d1c2
Fixed misleading comment in FetcherTest/FetchRequestManagerTest testF…
kirktrue Oct 20, 2023
f40d4d2
Making NetworkClientDelegate constructor call another to eliminate re…
kirktrue Oct 20, 2023
56d0b40
Merge branch 'trunk' into KAFKA-14274-3-introduce-fetch-request-manag…
kirktrue Oct 20, 2023
13cb3b6
Ensure wakeupNetworkThread() is called even on empty Fetch results
kirktrue Oct 20, 2023
9525fca
Changed OffsetFetcherUtils.offsetResetStrategyTimestamp to throw a No…
kirktrue Oct 20, 2023
c5d5fc6
Renamed refreshCommittedOffsetsIfNeeded to initWithCommittedOffsetsIf…
kirktrue Oct 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions checkstyle/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@

<subpackage name="consumer">
<allow pkg="org.apache.kafka.clients.consumer" />

Comment thread
kirktrue marked this conversation as resolved.
<subpackage name="internals">
<allow pkg="org.apache.kafka.clients" />
</subpackage>
</subpackage>

<subpackage name="producer">
Expand Down
12 changes: 7 additions & 5 deletions checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@
files="AbstractRequest.java"/>
<suppress checks="ClassFanOutComplexity"
files="AbstractResponse.java"/>
<suppress checks="ClassFanOutComplexity"
files="PrototypeAsyncConsumer.java"/>

<suppress checks="MethodLength"
files="(KerberosLogin|RequestResponseTest|ConnectMetricsRegistry|KafkaConsumer|AbstractStickyAssignor).java"/>

<suppress checks="ParameterNumber"
files="(NetworkClient|FieldSpec|KafkaRaftClient).java"/>
<suppress checks="ParameterNumber"
files="(KafkaConsumer|ConsumerCoordinator).java"/>
files="(KafkaConsumer|PrototypeAsyncConsumer|ConsumerCoordinator).java"/>
<suppress checks="ParameterNumber"
files="(RecordAccumulator|Sender).java"/>
<suppress checks="ParameterNumber"
Expand All @@ -79,7 +81,7 @@
files="MemoryRecordsBuilder.java"/>

<suppress checks="ClassDataAbstractionCoupling"
files="(KafkaConsumer|ConsumerCoordinator|AbstractFetch|KafkaProducer|AbstractRequest|AbstractResponse|TransactionManager|Admin|KafkaAdminClient|MockAdminClient|KafkaRaftClient|KafkaRaftClientTest).java"/>
files="(KafkaConsumer|PrototypeAsyncConsumer|ConsumerCoordinator|AbstractFetch|KafkaProducer|AbstractRequest|AbstractResponse|TransactionManager|Admin|KafkaAdminClient|MockAdminClient|KafkaRaftClient|KafkaRaftClientTest).java"/>
<suppress checks="ClassDataAbstractionCoupling"
files="(Errors|SaslAuthenticatorTest|AgentTest|CoordinatorTest).java"/>

Expand Down Expand Up @@ -108,10 +110,10 @@

<!-- Clients tests -->
<suppress checks="ClassDataAbstractionCoupling"
files="(Sender|Fetcher|OffsetFetcher|KafkaConsumer|Metrics|RequestResponse|TransactionManager|KafkaAdminClient|Message|KafkaProducer)Test.java"/>
files="(Sender|Fetcher|FetchRequestManager|OffsetFetcher|KafkaConsumer|PrototypeAsyncConsumer|Metrics|RequestResponse|TransactionManager|KafkaAdminClient|Message|KafkaProducer)Test.java"/>

<suppress checks="ClassFanOutComplexity"
files="(ConsumerCoordinator|KafkaConsumer|RequestResponse|Fetcher|KafkaAdminClient|Message|KafkaProducer)Test.java"/>
files="(ConsumerCoordinator|KafkaConsumer|RequestResponse|Fetcher|FetchRequestManager|KafkaAdminClient|Message|KafkaProducer)Test.java"/>

<suppress checks="ClassFanOutComplexity"
files="MockAdminClient.java"/>
Expand All @@ -120,7 +122,7 @@
files="(OffsetFetcher|RequestResponse)Test.java"/>

<suppress checks="JavaNCSS"
files="RequestResponseTest.java|FetcherTest.java|KafkaAdminClientTest.java"/>
files="RequestResponseTest.java|FetcherTest.java|FetchRequestManagerTest.java|KafkaAdminClientTest.java"/>

<suppress checks="NPathComplexity"
files="MemoryRecordsTest|MetricsTest|RequestResponseTest|TestSslUtils|AclAuthorizerBenchmark"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@

import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.CONSUMER_JMX_PREFIX;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.CONSUMER_METRIC_GROUP_PREFIX;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.DEFAULT_CLOSE_TIMEOUT_MS;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.createConsumerNetworkClient;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.createFetchConfig;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.createFetchMetricsManager;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.createLogContext;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.createMetrics;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.createSubscriptionState;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.configuredConsumerInterceptors;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.configuredIsolationLevel;
import static org.apache.kafka.common.utils.Utils.closeQuietly;
import static org.apache.kafka.common.utils.Utils.isBlank;
import static org.apache.kafka.common.utils.Utils.join;
Expand Down Expand Up @@ -569,7 +568,6 @@
public class KafkaConsumer<K, V> implements Consumer<K, V> {

private static final long NO_CURRENT_THREAD = -1L;
static final long DEFAULT_CLOSE_TIMEOUT_MS = 30 * 1000;
static final String DEFAULT_REASON = "rebalance enforced by user";

// Visible for testing
Expand Down Expand Up @@ -714,7 +712,8 @@ public KafkaConsumer(Map<String, Object> configs,
this.metadata.bootstrap(addresses);

FetchMetricsManager fetchMetricsManager = createFetchMetricsManager(metrics);
this.isolationLevel = configuredIsolationLevel(config);
FetchConfig fetchConfig = new FetchConfig(config);
this.isolationLevel = fetchConfig.isolationLevel;

ApiVersions apiVersions = new ApiVersions();
this.client = createConsumerNetworkClient(config,
Expand Down Expand Up @@ -752,13 +751,13 @@ public KafkaConsumer(Map<String, Object> configs,
config.getBoolean(ConsumerConfig.THROW_ON_FETCH_STABLE_OFFSET_UNSUPPORTED),
config.getString(ConsumerConfig.CLIENT_RACK_CONFIG));
}
FetchConfig<K, V> fetchConfig = createFetchConfig(config, this.deserializers);
this.fetcher = new Fetcher<>(
logContext,
this.client,
this.metadata,
this.subscriptions,
fetchConfig,
this.deserializers,
fetchMetricsManager,
this.time);
this.offsetFetcher = new OffsetFetcher(logContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.stream.Collectors;

import static java.util.Collections.singleton;
import static org.apache.kafka.clients.consumer.KafkaConsumer.DEFAULT_CLOSE_TIMEOUT_MS;
import static org.apache.kafka.clients.consumer.internals.ConsumerUtils.DEFAULT_CLOSE_TIMEOUT_MS;


/**
Expand Down
Loading