This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 588d107ec2c KAFKA-19101 Remove
ControllerMutationQuotaManager#throttleTimeMs unused parameter (#19410)
588d107ec2c is described below
commit 588d107ec2ce2e2fab9b3fe80047ad9646a0d508
Author: Ken Huang <[email protected]>
AuthorDate: Fri Apr 11 11:31:08 2025 +0800
KAFKA-19101 Remove ControllerMutationQuotaManager#throttleTimeMs unused
parameter (#19410)
It seems `timeMs` this parameter never used in Kafka project, the method
init commit is
https://github.com/apache/kafka/commit/b5f90daf13b4945305951ca0eecdb454a4dcafc2
Reviewers: Jhen-Yung Hsu <[email protected]>, PoAn Yang
<[email protected]>, TengYao Chi <[email protected]>, Chia-Ping Tsai
<[email protected]>
---
.../main/scala/kafka/server/ControllerMutationQuotaManager.scala | 8 ++++----
.../unit/kafka/server/ControllerMutationQuotaManagerTest.scala | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git
a/core/src/main/scala/kafka/server/ControllerMutationQuotaManager.scala
b/core/src/main/scala/kafka/server/ControllerMutationQuotaManager.scala
index bfb9feedbf7..138151a7ba5 100644
--- a/core/src/main/scala/kafka/server/ControllerMutationQuotaManager.scala
+++ b/core/src/main/scala/kafka/server/ControllerMutationQuotaManager.scala
@@ -61,10 +61,10 @@ object UnboundedControllerMutationQuota extends
ControllerMutationQuota {
*/
abstract class AbstractControllerMutationQuota(private val time: Time) extends
ControllerMutationQuota {
protected var lastThrottleTimeMs = 0L
- protected var lastRecordedTimeMs = 0L
+ private var lastRecordedTimeMs = 0L
protected def updateThrottleTime(e: QuotaViolationException, timeMs: Long):
Unit = {
- lastThrottleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e,
timeMs)
+ lastThrottleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e)
lastRecordedTimeMs = timeMs
}
@@ -142,7 +142,7 @@ object ControllerMutationQuotaManager {
* Basically, if a value < 0 is observed, the time required to bring it to
zero is
* -value / refill rate (quota bound) * 1000.
*/
- def throttleTimeMs(e: QuotaViolationException, timeMs: Long): Long = {
+ def throttleTimeMs(e: QuotaViolationException): Long = {
e.metric().measurable() match {
case _: TokenBucket =>
Math.round(-e.value() / e.bound() * 1000)
@@ -216,7 +216,7 @@ class ControllerMutationQuotaManager(private val config:
ClientQuotaManagerConfi
0
} catch {
case e: QuotaViolationException =>
- val throttleTimeMs = ControllerMutationQuotaManager.throttleTimeMs(e,
timeMs).toInt
+ val throttleTimeMs =
ControllerMutationQuotaManager.throttleTimeMs(e).toInt
debug(s"Quota violated for sensor (${quotaSensor.name}). Delay time:
($throttleTimeMs)")
throttleTimeMs
}
diff --git
a/core/src/test/scala/unit/kafka/server/ControllerMutationQuotaManagerTest.scala
b/core/src/test/scala/unit/kafka/server/ControllerMutationQuotaManagerTest.scala
index 2a7cfe35a85..c3b8b425d45 100644
---
a/core/src/test/scala/unit/kafka/server/ControllerMutationQuotaManagerTest.scala
+++
b/core/src/test/scala/unit/kafka/server/ControllerMutationQuotaManagerTest.scala
@@ -137,9 +137,9 @@ class ControllerMutationQuotaManagerTest extends
BaseClientQuotaManagerTest {
sensor.add(metricName, new TokenBucket)
val metric = metrics.metric(metricName)
- assertEquals(0, throttleTimeMs(new QuotaViolationException(metric, 0, 10),
time.milliseconds()))
- assertEquals(500, throttleTimeMs(new QuotaViolationException(metric, -5,
10), time.milliseconds()))
- assertEquals(1000, throttleTimeMs(new QuotaViolationException(metric, -10,
10), time.milliseconds()))
+ assertEquals(0, throttleTimeMs(new QuotaViolationException(metric, 0, 10)))
+ assertEquals(500, throttleTimeMs(new QuotaViolationException(metric, -5,
10)))
+ assertEquals(1000, throttleTimeMs(new QuotaViolationException(metric, -10,
10)))
}
@Test