You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2018/10/31 13:47:30 UTC

[kafka] branch trunk updated: MINOR: Improve ReplicationQuotasTest#shouldThrottleOldSegments resiliency (#5849)

This is an automated email from the ASF dual-hosted git repository.

ijuma 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 fc1eea1  MINOR: Improve ReplicationQuotasTest#shouldThrottleOldSegments resiliency (#5849)
fc1eea1 is described below

commit fc1eea127a6aec66284f917cc8fd776b196adf6c
Author: Stanislav Kozlovski <st...@outlook.com>
AuthorDate: Wed Oct 31 15:47:19 2018 +0200

    MINOR: Improve ReplicationQuotasTest#shouldThrottleOldSegments resiliency (#5849)
    
    I've seen this test fail with
    
    ```
    java.lang.AssertionError: Throttled replication of 6352ms should be < 6000ms
    ```
    
    A contributing factor is that it starts counting the time it took for replication
    before the replication itself has started. `createServer()` initializes ZK and
    other systems before it starts up the replication thread.
    
    I ran the test 25 times locally both ways.
    
    Average `throttledTook` before the change: 5341.75
    Mean `throttledTook` after the change: 5256.92
    
    Note that those are the results from `./gradlew core:test --tests kafka.server.ReplicationQuotasTest.shouldThrottleOldSegments`. I've noticed that if
    I run the whole test class `ReplicationQuotasTest`, the `throttledTook` is close
    ~4100.
    
    Reviewers: Ismael Juma <is...@juma.me.uk>
---
 core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala b/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala
index 78300c9..45c21d2 100644
--- a/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala
@@ -194,11 +194,11 @@ class ReplicationQuotasTest extends ZooKeeperTestHarness {
     //Add data
     addData(msgCount, msg)
 
-    val start = System.currentTimeMillis()
-
     //Start the new broker (and hence start replicating)
     debug("Starting new broker")
     brokers = brokers :+ createServer(fromProps(createBrokerConfig(101, zkConnect)))
+    val start = System.currentTimeMillis()
+
     waitForOffsetsToMatch(msgCount, 0, 101)
 
     val throttledTook = System.currentTimeMillis() - start