Mike Percy has posted comments on this change. Change subject: KUDU-2033 (part 1). Add write and stop/start in a loop to TestLeaderFailover ......................................................................
Patch Set 7: (1 comment) http://gerrit.cloudera.org:8080/#/c/7456/7/java/kudu-client/src/test/java/org/apache/kudu/util/AssertHelpers.java File java/kudu-client/src/test/java/org/apache/kudu/util/AssertHelpers.java: PS7, Line 30: long start = System.nanoTime(); : boolean success = expression.get(); : : while (!success && System.nanoTime() < start + timeoutMillis*1000) { : Thread.sleep(timeoutMillis / 10); : success = expression.get(); : } How about using a do-while loop so you only have to call .get() once in the code. Also, there is a problem with the nanos vs millis math. Consider naming the variables according to their granularity and doing something like: long deadlineNanos = System.nanoTime() + timeoutMillis * 1000000; boolean success; do { success = expression.get(); if (success) break; Thread.sleep(50); // Sleep for 50ns. } while (system.nanoTime() < deadlineNanos); Also I think the choice of timeoutMillis / 10 isn't great in the case that you have a long timeout (i.e. 30 sec) so maybe 50ms is a reasonable backoff period for most tests. -- To view, visit http://gerrit.cloudera.org:8080/7456 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie93a15084a4c4c0748dc74c005b8313f443a5ba9 Gerrit-PatchSet: 7 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Edward Fancher <[email protected]> Gerrit-Reviewer: Edward Fancher <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Mike Percy <[email protected]> Gerrit-Reviewer: Todd Lipcon <[email protected]> Gerrit-HasComments: Yes
