kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [kudu] 01/02: [test] fix HybridClockTest.TestWaitUntilAfter_TestCase2
Date Wed, 04 Dec 2019 05:58:36 GMT
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 7ea1f53f8b97226e9edd744add1ea2ae40e96781
Author: Alexey Serbin <alexey@apache.org>
AuthorDate: Tue Dec 3 18:27:29 2019 -0800

    [test] fix HybridClockTest.TestWaitUntilAfter_TestCase2
    In case of slow execution (e.g., a TSAN build) and very low estimated
    clock error (e.g., 0 as in case of 'system_unsync' clock), calling
    HybridClock::WaitUntilAfter() for a fresh past hybrid timestamp returns
    Status::OK() instead of Status::TimedOut() regardless of deadline
    because the supplied timestamp is seen clearly in the past.
    This patch addresses the issue by moving the target timestamp further
    into the future.  Now it's 2 milliseconds in the future, but it was
    2 microseconds in the future prior to this patch.
    Change-Id: I34108359a04b5bd3f2a957faf6d2e9a6dc022eb1
    Reviewed-on: http://gerrit.cloudera.org:8080/14823
    Tested-by: Alexey Serbin <aserbin@cloudera.com>
    Reviewed-by: Adar Dembo <adar@cloudera.com>
 src/kudu/clock/hybrid_clock-test.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kudu/clock/hybrid_clock-test.cc b/src/kudu/clock/hybrid_clock-test.cc
index 09505e7..b4aed17 100644
--- a/src/kudu/clock/hybrid_clock-test.cc
+++ b/src/kudu/clock/hybrid_clock-test.cc
@@ -205,7 +205,7 @@ TEST_F(HybridClockTest, TestWaitUntilAfter_TestCase1) {
 // The normal case for transactions. Obtain a timestamp and then wait until
 // we're sure that tx_latest < now_earliest.
 TEST_F(HybridClockTest, TestWaitUntilAfter_TestCase2) {
-  MonoTime before = MonoTime::Now();
+  const MonoTime before = MonoTime::Now();
   // we do no time adjustment, this event should fall right within the possible
   // error interval
@@ -214,7 +214,7 @@ TEST_F(HybridClockTest, TestWaitUntilAfter_TestCase2) {
   clock_->NowWithError(&past_ts, &past_max_error);
   // Make sure the error is at least a small number of microseconds, to ensure
   // that we always have to wait.
-  past_max_error = std::max(past_max_error, static_cast<uint64_t>(20));
+  past_max_error = std::max(past_max_error, static_cast<uint64_t>(2000));
   Timestamp wait_until = HybridClock::AddPhysicalTimeToTimestamp(

View raw message