@@ -53,13 +53,13 @@ import org.apache.kafka.metadata.MetadataCache
53
53
import org .apache .kafka .server .common .{DirectoryEventHandler , RequestLocal , StopPartition , TopicOptionalIdPartition }
54
54
import org .apache .kafka .server .metrics .KafkaMetricsGroup
55
55
import org .apache .kafka .server .network .BrokerEndPoint
56
- import org .apache .kafka .server .purgatory .{DelayedDeleteRecords , DelayedOperationPurgatory , DeleteRecordsPartitionStatus , TopicPartitionOperationKey }
56
+ import org .apache .kafka .server .purgatory .{DelayedDeleteRecords , DelayedOperationPurgatory , DelayedRemoteListOffsets , DeleteRecordsPartitionStatus , ListOffsetsPartitionStatus , TopicPartitionOperationKey }
57
57
import org .apache .kafka .server .share .fetch .{DelayedShareFetchKey , DelayedShareFetchPartitionKey }
58
58
import org .apache .kafka .server .storage .log .{FetchParams , FetchPartitionData }
59
59
import org .apache .kafka .server .util .{Scheduler , ShutdownableThread }
60
- import org .apache .kafka .server .{ActionQueue , DelayedActionQueue , ListOffsetsPartitionStatus , common }
60
+ import org .apache .kafka .server .{ActionQueue , DelayedActionQueue , common }
61
61
import org .apache .kafka .storage .internals .checkpoint .{LazyOffsetCheckpoints , OffsetCheckpointFile , OffsetCheckpoints }
62
- import org .apache .kafka .storage .internals .log ._
62
+ import org .apache .kafka .storage .internals .log .{ AppendOrigin , FetchDataInfo , LeaderHwChange , LogAppendInfo , LogConfig , LogDirFailureChannel , LogOffsetMetadata , LogReadInfo , OffsetResultHolder , RecordValidationException , RemoteLogReadResult , RemoteStorageFetchInfo , UnifiedLog , VerificationGuard }
63
63
import org .apache .kafka .storage .log .metrics .BrokerTopicStats
64
64
65
65
import java .io .File
@@ -70,6 +70,7 @@ import java.util.concurrent.atomic.AtomicBoolean
70
70
import java .util .concurrent .locks .Lock
71
71
import java .util .concurrent .{CompletableFuture , Future , RejectedExecutionException , TimeUnit }
72
72
import java .util .{Collections , Optional , OptionalInt , OptionalLong }
73
+ import java .util .function .Consumer
73
74
import scala .collection .{Map , Seq , Set , immutable , mutable }
74
75
import scala .jdk .CollectionConverters ._
75
76
import scala .jdk .OptionConverters .{RichOption , RichOptional }
@@ -841,7 +842,7 @@ class ReplicaManager(val config: KafkaConfig,
841
842
)
842
843
843
844
val retryTimeoutMs = Math .min(config.addPartitionsToTxnConfig.addPartitionsToTxnRetryBackoffMaxMs(), config.requestTimeoutMs)
844
- val addPartitionsRetryBackoffMs = config.addPartitionsToTxnConfig.addPartitionsToTxnRetryBackoffMs
845
+ val addPartitionsRetryBackoffMs = config.addPartitionsToTxnConfig.addPartitionsToTxnRetryBackoffMs()
845
846
val startVerificationTimeMs = time.milliseconds
846
847
def maybeRetryOnConcurrentTransactions (results : (Map [TopicPartition , Errors ], Map [TopicPartition , VerificationGuard ])): Unit = {
847
848
if (time.milliseconds() - startVerificationTimeMs >= retryTimeoutMs) {
@@ -1470,7 +1471,7 @@ class ReplicaManager(val config: KafkaConfig,
1470
1471
correlationId : Int ,
1471
1472
version : Short ,
1472
1473
buildErrorResponse : (Errors , ListOffsetsPartition ) => ListOffsetsPartitionResponse ,
1473
- responseCallback : List [ ListOffsetsTopicResponse ] => Unit ,
1474
+ responseCallback : Consumer [util. Collection [ ListOffsetsTopicResponse ]] ,
1474
1475
timeoutMs : Int = 0 ): Unit = {
1475
1476
val statusByPartition = mutable.Map [TopicPartition , ListOffsetsPartitionStatus ]()
1476
1477
topics.foreach { topic =>
@@ -1569,7 +1570,7 @@ class ReplicaManager(val config: KafkaConfig,
1569
1570
if (delayedRemoteListOffsetsRequired(statusByPartition)) {
1570
1571
val delayMs : Long = if (timeoutMs > 0 ) timeoutMs else config.remoteLogManagerConfig.remoteListOffsetsRequestTimeoutMs()
1571
1572
// create delayed remote list offsets operation
1572
- val delayedRemoteListOffsets = new DelayedRemoteListOffsets (delayMs, version, statusByPartition, this , responseCallback)
1573
+ val delayedRemoteListOffsets = new DelayedRemoteListOffsets (delayMs, version, statusByPartition.asJava, tp => getPartitionOrException(tp) , responseCallback)
1573
1574
// create a list of (topic, partition) pairs to use as keys for this delayed remote list offsets operation
1574
1575
val listOffsetsRequestKeys = statusByPartition.keys.map(new TopicPartitionOperationKey (_)).toList
1575
1576
// try to complete the request immediately, otherwise put it into the purgatory
@@ -1580,7 +1581,7 @@ class ReplicaManager(val config: KafkaConfig,
1580
1581
case (topic, status) =>
1581
1582
new ListOffsetsTopicResponse ().setName(topic).setPartitions(status.values.flatMap(s => Some (s.responseOpt.get())).toList.asJava)
1582
1583
}.toList
1583
- responseCallback(responseTopics)
1584
+ responseCallback.accept (responseTopics.asJava )
1584
1585
}
1585
1586
}
1586
1587
@@ -1899,7 +1900,7 @@ class ReplicaManager(val config: KafkaConfig,
1899
1900
createLogReadResult(highWatermark, leaderLogStartOffset, leaderLogEndOffset,
1900
1901
new OffsetMovedToTieredStorageException (" Given offset" + offset + " is moved to tiered storage" ))
1901
1902
} else {
1902
- val throttleTimeMs = remoteLogManager.get.getFetchThrottleTimeMs()
1903
+ val throttleTimeMs = remoteLogManager.get.getFetchThrottleTimeMs
1903
1904
val fetchDataInfo = if (throttleTimeMs > 0 ) {
1904
1905
// Record the throttle time for the remote log fetches
1905
1906
remoteLogManager.get.fetchThrottleTimeSensor().record(throttleTimeMs, time.milliseconds())
0 commit comments