Skip to content

Commit 588d107

Browse files
authored
KAFKA-19101 Remove ControllerMutationQuotaManager#throttleTimeMs unused parameter (#19410)
It seems `timeMs` this parameter never used in Kafka project, the method init commit is b5f90da Reviewers: Jhen-Yung Hsu <[email protected]>, PoAn Yang <[email protected]>, TengYao Chi <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent 90e7b53 commit 588d107

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

core/src/main/scala/kafka/server/ControllerMutationQuotaManager.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ object UnboundedControllerMutationQuota extends ControllerMutationQuota {
6161
*/
6262
abstract class AbstractControllerMutationQuota(private val time: Time) extends ControllerMutationQuota {
6363
protected var lastThrottleTimeMs = 0L
64-
protected var lastRecordedTimeMs = 0L
64+
private var lastRecordedTimeMs = 0L
6565

6666
protected def updateThrottleTime(e: QuotaViolationException, timeMs: Long): Unit = {
67-
lastThrottleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e, timeMs)
67+
lastThrottleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e)
6868
lastRecordedTimeMs = timeMs
6969
}
7070

@@ -142,7 +142,7 @@ object ControllerMutationQuotaManager {
142142
* Basically, if a value < 0 is observed, the time required to bring it to zero is
143143
* -value / refill rate (quota bound) * 1000.
144144
*/
145-
def throttleTimeMs(e: QuotaViolationException, timeMs: Long): Long = {
145+
def throttleTimeMs(e: QuotaViolationException): Long = {
146146
e.metric().measurable() match {
147147
case _: TokenBucket =>
148148
Math.round(-e.value() / e.bound() * 1000)
@@ -216,7 +216,7 @@ class ControllerMutationQuotaManager(private val config: ClientQuotaManagerConfi
216216
0
217217
} catch {
218218
case e: QuotaViolationException =>
219-
val throttleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e, timeMs).toInt
219+
val throttleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e).toInt
220220
debug(s"Quota violated for sensor (${quotaSensor.name}). Delay time: ($throttleTimeMs)")
221221
throttleTimeMs
222222
}

core/src/test/scala/unit/kafka/server/ControllerMutationQuotaManagerTest.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ class ControllerMutationQuotaManagerTest extends BaseClientQuotaManagerTest {
137137
sensor.add(metricName, new TokenBucket)
138138
val metric = metrics.metric(metricName)
139139

140-
assertEquals(0, throttleTimeMs(new QuotaViolationException(metric, 0, 10), time.milliseconds()))
141-
assertEquals(500, throttleTimeMs(new QuotaViolationException(metric, -5, 10), time.milliseconds()))
142-
assertEquals(1000, throttleTimeMs(new QuotaViolationException(metric, -10, 10), time.milliseconds()))
140+
assertEquals(0, throttleTimeMs(new QuotaViolationException(metric, 0, 10)))
141+
assertEquals(500, throttleTimeMs(new QuotaViolationException(metric, -5, 10)))
142+
assertEquals(1000, throttleTimeMs(new QuotaViolationException(metric, -10, 10)))
143143
}
144144

145145
@Test

0 commit comments

Comments
 (0)