You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KAFKA-14915: Allow reading from remote storage for multiple partitions in one fetchRequest (apache#20045)
This PR enables reading remote storage for multiple partitions in one
fetchRequest. The main changes are:
1. In `DelayedRemoteFetch`, we accept multiple remoteFetchTasks and
other metadata now.
2. In `DelayedRemoteFetch`, we'll wait until all remoteFetch done,
either succeeded or failed.
3. In `ReplicaManager#fetchMessage`, we'll create one
`DelayedRemoteFetch` and pass multiple remoteFetch metadata to it, and
watch all of them.
4. Added tests
Reviewers: Kamal Chandraprakash<kamal.chandraprakash@gmail.com>, Federico Valeri <fedevaleri@gmail.com>, Satish Duggana <satishd@apache.org>
Copy file name to clipboardExpand all lines: clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerConfig.java
+2-6Lines changed: 2 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -197,9 +197,7 @@ public class ConsumerConfig extends AbstractConfig {
197
197
"this value, the record batch will still be returned to ensure that the consumer can make progress. As such, this is not a absolute maximum. " +
198
198
"The maximum record batch size accepted by the broker is defined via <code>message.max.bytes</code> (broker config) or " +
199
199
"<code>max.message.bytes</code> (topic config). A fetch request consists of many partitions, and there is another setting that controls how much " +
200
-
"data is returned for each partition in a fetch request - see <code>max.partition.fetch.bytes</code>. Note that there is a current limitation when " +
201
-
"performing remote reads from tiered storage (KIP-405) - only one partition out of the fetch request is fetched from the remote store (KAFKA-14915). " +
202
-
"Note also that the consumer performs multiple fetches in parallel.";
200
+
"data is returned for each partition in a fetch request - see <code>max.partition.fetch.bytes</code>. Note that the consumer performs multiple fetches in parallel.";
@@ -56,7 +57,7 @@ class DelayedRemoteFetch(remoteFetchTask: Future[Void],
56
57
*
57
58
* Case a: This broker is no longer the leader of the partition it tries to fetch
58
59
* Case b: This broker does not know the partition it tries to fetch
59
-
* Case c: The remote storage read request completed (succeeded or failed)
60
+
* Case c: All the remote storage read request completed (succeeded or failed)
60
61
* Case d: The partition is in an offline log directory on this broker
61
62
*
62
63
* Upon completion, should return whatever data is available for each valid partition
@@ -81,7 +82,8 @@ class DelayedRemoteFetch(remoteFetchTask: Future[Void],
81
82
return forceComplete()
82
83
}
83
84
}
84
-
if (remoteFetchResult.isDone) // Case c
85
+
// Case c
86
+
if (remoteFetchResults.values().stream().allMatch(taskResult => taskResult.isDone))
85
87
forceComplete()
86
88
else
87
89
false
@@ -90,8 +92,13 @@ class DelayedRemoteFetch(remoteFetchTask: Future[Void],
90
92
overridedefonExpiration():Unit= {
91
93
// cancel the remote storage read task, if it has not been executed yet and
92
94
// avoid interrupting the task if it is already running as it may force closing opened/cached resources as transaction index.
93
-
valcancelled= remoteFetchTask.cancel(false)
94
-
if (!cancelled) debug(s"Remote fetch task for RemoteStorageFetchInfo: $remoteFetchInfo could not be cancelled and its isDone value is ${remoteFetchTask.isDone}")
0 commit comments