[clock] add exponential backoff in HybridClock::Init()

This patch introduces exponential back-off when polling the
synchronisation status of the underlying time service (i.e. calling
TimeService::WalltimeWithError()) during HybridClock::Init().  Now,
the polling interval starts with 1 millisecond and exponentially grows
up to 1 second.

Prior to this patch, the polling interval was one second, and in case
if time source synchronized faster than in one second,
HybridClock::Init() would incur extra latency (e.g., in case of tests
running with the built-in NTP client synchronized against MiniChronyd).

I verified that with the new approach ExternalMiniCluster-based tests
run faster:

  before
    [       OK ] AllTypesItest/9.TestTimestampPadding (6794 ms)

  after
    [       OK ] AllTypesItest/9.TestTimestampPadding (2730 ms)

Change-Id: I75924f1fdcf6a32684cda29bbfa959b00172b50e
Reviewed-on: http://gerrit.cloudera.org:8080/14472
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins
1 file changed