Skip to content

lease-read: revisit CLOCK_MONOTONIC_RAW (deferred from #549) #551

@bootjp

Description

@bootjp

Background

Lease-read PR #549 uses Go's time.Now() for the lease wall-clock. This carries Linux CLOCK_MONOTONIC (rate-adjusted by NTP slew at up to 500 ppm = 0.05%). Worst-case slew error at the 700 ms lease window is ~0.35 ms — three orders of magnitude below the 300 ms leaseSafetyMargin.

Decision (deferred)

TiKV uses CLOCK_MONOTONIC_RAW (NTP-slew-immune). Adopting the same in elastickv would require dropping the time.Time API on the lease path and calling golang.org/x/sys/unix.ClockGettime(unix.CLOCK_MONOTONIC_RAW, &ts). Not worth the API churn at the current margin.

Re-open trigger

  • Safety margin tightened below ~5 ms.
  • Jepsen-style clock-strobe testing reveals lease violations attributable to NTP rate adjustment.

References: PR #549, docs/lease_read_design.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions