Skip to content

[hotfix][Persistence] Use the AMS JVM clock for optimizer heartbeats - #4327

Draft
czy006 wants to merge 2 commits into
apache:masterfrom
czy006:codex/hotfix-optimizer-heartbeat-clock
Draft

[hotfix][Persistence] Use the AMS JVM clock for optimizer heartbeats#4327
czy006 wants to merge 2 commits into
apache:masterfrom
czy006:codex/hotfix-optimizer-heartbeat-clock

Conversation

@czy006

@czy006 czy006 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Brief change log

Pass the AMS JVM time to the optimizer heartbeat mapper instead of relying on the database clock. This makes heartbeat persistence consistent across supported databases.

How was this patch tested?

  • Add mapper test coverage for the persisted heartbeat timestamp.
  • Add screenshots for manual tests if appropriate (not applicable: backend-only change).
  • Run TestOptimizerMapperTouchTime locally with JDK 11 before creating this pull request.

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • no
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • not applicable

@github-actions github-actions Bot added the module:ams-server Ams server module label Aug 17, 2026
…lock

optimizer.touch_time was written with two different clocks: inserts
used the AMS JVM epoch via Long2TsConverter, heartbeats used the DB's
CURRENT_TIMESTAMP. Every consumer compares the value against
System.currentTimeMillis() (keeper expiry math, follower sync and the
leader-failover baseline), so a DB-AMS clock offset expired live
optimizers prematurely (or kept dead ones forever) in distributed
deployments.

updateTouchTime now takes the JVM timestamp and writes it through
Long2TsConverter; touch() passes the just-refreshed optimizer value.

Regression test TestOptimizerMapperTouchTime (red with DB clock: stored
value off by exactly the injected 123456ms offset).
Fix record: docs/fix-records/2026-08-16-fix-18-touch-time-clock-source.md
@czy006
czy006 force-pushed the codex/hotfix-optimizer-heartbeat-clock branch from ae92b60 to 63fe8ec Compare August 18, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ams-server Ams server module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant