Todd Lipcon has submitted this change and it was merged.

Change subject: KUDU-1345. Fix case in which hybrid clock can run backwards
......................................................................


KUDU-1345. Fix case in which hybrid clock can run backwards

This fixes a bug with the following sequence of updates:

- the clock is at time (phys=1000, logical=0)
- we get an update from the future: (phys=1100, logical=0)
- we generate clock reads locally thousands of times, which causes the
  logical value to wrap into the physical value (phys=1105, logical=0)
- our physical clock advances to (phys=1101, logical=0)

Previously, we would incorrectly move the clock backwards to (1101, 0)
because the physical value was higher than the last external update.
This is obviously incorrect.

The fix simplifies the logic in the hybrid clock to just maintain a single
timestamp, rather than separately tracking the last logical and physical
time.

Change-Id: I9b4a04cb8b7b5eb879d017375714b3183be0c601
Reviewed-on: http://gerrit.cloudera.org:8080/2266
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <[email protected]>
Reviewed-by: David Ribeiro Alves <[email protected]>
---
M src/kudu/server/hybrid_clock-test.cc
M src/kudu/server/hybrid_clock.cc
M src/kudu/server/hybrid_clock.h
3 files changed, 70 insertions(+), 29 deletions(-)

Approvals:
  David Ribeiro Alves: Looks good to me, approved
  Adar Dembo: Looks good to me, approved
  Kudu Jenkins: Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/2266
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9b4a04cb8b7b5eb879d017375714b3183be0c601
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <[email protected]>

Reply via email to