Skip to content

MINOR: Small cleanups in ReplicaManager #19322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions core/src/main/scala/kafka/server/ReplicaManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ class ReplicaManager(val config: KafkaConfig,
* @param recordValidationStatsCallback callback for updating stats on record conversions
* @param requestLocal container for the stateful instances scoped to this request -- this must correspond to the
* thread calling this method
* @param actionQueue the action queue to use. ReplicaManager#defaultActionQueue is used by default.
* @param verificationGuards the mapping from topic partition to verification guards if transaction verification is used
*/
def appendRecords(timeout: Long,
Expand All @@ -698,7 +697,6 @@ class ReplicaManager(val config: KafkaConfig,
delayedProduceLock: Option[Lock] = None,
recordValidationStatsCallback: Map[TopicPartition, RecordValidationStats] => Unit = _ => (),
requestLocal: RequestLocal = RequestLocal.noCaching,
actionQueue: ActionQueue = this.defaultActionQueue,
verificationGuards: Map[TopicPartition, VerificationGuard] = Map.empty): Unit = {
if (!isValidRequiredAcks(requiredAcks)) {
sendInvalidRequiredAcksResponse(entriesPerPartition, responseCallback)
Expand All @@ -711,7 +709,7 @@ class ReplicaManager(val config: KafkaConfig,
origin,
entriesPerPartition,
requestLocal,
actionQueue,
defaultActionQueue,
verificationGuards
)

Expand Down Expand Up @@ -744,7 +742,6 @@ class ReplicaManager(val config: KafkaConfig,
* @param recordValidationStatsCallback callback for updating stats on record conversions
* @param requestLocal container for the stateful instances scoped to this request -- this must correspond to the
* thread calling this method
* @param actionQueue the action queue to use. ReplicaManager#defaultActionQueue is used by default.
* @param transactionSupportedOperation determines the supported Operation based on the client's Request api version
*
* The responseCallback is wrapped so that it is scheduled on a request handler thread. There, it should be called with
Expand All @@ -758,7 +755,6 @@ class ReplicaManager(val config: KafkaConfig,
responseCallback: Map[TopicPartition, PartitionResponse] => Unit,
recordValidationStatsCallback: Map[TopicPartition, RecordValidationStats] => Unit = _ => (),
requestLocal: RequestLocal = RequestLocal.noCaching,
actionQueue: ActionQueue = this.defaultActionQueue,
transactionSupportedOperation: TransactionSupportedOperation): Unit = {

val transactionalProducerInfo = mutable.HashSet[(Long, Short)]()
Expand Down Expand Up @@ -825,7 +821,6 @@ class ReplicaManager(val config: KafkaConfig,
responseCallback = newResponseCallback,
recordValidationStatsCallback = recordValidationStatsCallback,
requestLocal = newRequestLocal,
actionQueue = actionQueue,
verificationGuards = verificationGuards
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import org.apache.kafka.common.protocol.Errors
import org.apache.kafka.common.record.{MemoryRecords, RecordBatch, RecordValidationStats}
import org.apache.kafka.common.requests.ProduceResponse.PartitionResponse
import org.apache.kafka.common.utils.{Time, Utils}
import org.apache.kafka.server.ActionQueue
import org.apache.kafka.server.common.RequestLocal
import org.apache.kafka.server.purgatory.{DelayedOperationPurgatory, TopicPartitionOperationKey}
import org.apache.kafka.server.util.timer.{MockTimer, Timer}
Expand Down Expand Up @@ -220,7 +219,6 @@ object AbstractCoordinatorConcurrencyTest {
delayedProduceLock: Option[Lock] = None,
processingStatsCallback: Map[TopicPartition, RecordValidationStats] => Unit = _ => (),
requestLocal: RequestLocal = RequestLocal.noCaching,
actionQueue: ActionQueue = null,
verificationGuards: Map[TopicPartition, VerificationGuard] = Map.empty): Unit = {

if (entriesPerPartition.isEmpty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ class TransactionStateManagerTest {
any[Option[ReentrantLock]],
any(),
any(),
any(),
any()
)

Expand Down Expand Up @@ -784,7 +783,6 @@ class TransactionStateManagerTest {
any[Option[ReentrantLock]],
any(),
any(),
any(),
any()
)

Expand Down Expand Up @@ -826,7 +824,6 @@ class TransactionStateManagerTest {
any[Option[ReentrantLock]],
any(),
any(),
any(),
any())

assertEquals(Set.empty, listExpirableTransactionalIds())
Expand Down Expand Up @@ -879,7 +876,6 @@ class TransactionStateManagerTest {
any[Option[ReentrantLock]],
any(),
any(),
any(),
any()
)

Expand Down Expand Up @@ -1097,7 +1093,6 @@ class TransactionStateManagerTest {
any[Option[ReentrantLock]],
any(),
any(),
any(),
any()
)).thenAnswer(_ => callbackCapture.getValue.apply(
recordsCapture.getValue.map { case (topicPartition, records) =>
Expand Down Expand Up @@ -1251,7 +1246,6 @@ class TransactionStateManagerTest {
any[Option[ReentrantLock]],
any(),
any(),
any(),
any()
)).thenAnswer(_ => capturedArgument.getValue.apply(
Map(new TopicPartition(TRANSACTION_STATE_TOPIC_NAME, partitionId) ->
Expand Down
8 changes: 0 additions & 8 deletions core/src/test/scala/unit/kafka/server/KafkaApisTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,6 @@ class KafkaApisTest extends Logging {
responseCallback.capture(),
any(),
any(),
any(),
any()
)).thenAnswer(_ => responseCallback.getValue.apply(Map(tp -> new PartitionResponse(Errors.INVALID_PRODUCER_EPOCH))))

Expand Down Expand Up @@ -2150,7 +2149,6 @@ class KafkaApisTest extends Logging {
responseCallback.capture(),
any(),
any(),
any(),
any())
).thenAnswer(_ => responseCallback.getValue.apply(Map(tp -> new PartitionResponse(Errors.NOT_LEADER_OR_FOLLOWER))))

Expand Down Expand Up @@ -2215,7 +2213,6 @@ class KafkaApisTest extends Logging {
responseCallback.capture(),
any(),
any(),
any(),
any())
).thenAnswer(_ => responseCallback.getValue.apply(Map(tp -> new PartitionResponse(Errors.NOT_LEADER_OR_FOLLOWER))))

Expand Down Expand Up @@ -2279,7 +2276,6 @@ class KafkaApisTest extends Logging {
responseCallback.capture(),
any(),
any(),
any(),
any())
).thenAnswer(_ => responseCallback.getValue.apply(Map(tp -> new PartitionResponse(Errors.NOT_LEADER_OR_FOLLOWER))))

Expand Down Expand Up @@ -2347,7 +2343,6 @@ class KafkaApisTest extends Logging {
any(),
any(),
any(),
any(),
any())
} finally {
kafkaApis.close()
Expand Down Expand Up @@ -2492,7 +2487,6 @@ class KafkaApisTest extends Logging {
any(),
any(),
ArgumentMatchers.eq(requestLocal),
any(),
any()
)).thenAnswer(_ => responseCallback.getValue.apply(Map(tp2 -> new PartitionResponse(Errors.NONE))))
kafkaApis = createKafkaApis()
Expand Down Expand Up @@ -2549,7 +2543,6 @@ class KafkaApisTest extends Logging {
any(),
any(),
ArgumentMatchers.eq(requestLocal),
any(),
any())
}

Expand Down Expand Up @@ -2626,7 +2619,6 @@ class KafkaApisTest extends Logging {
any(),
any(),
ArgumentMatchers.eq(RequestLocal.noCaching),
any(),
any()
)).thenAnswer { _ =>
responseCallback.getValue.apply(
Expand Down