Skip to content

Fix HLC monotonicity, SigV4 sig comparison, and coordinator redirect timestamp safety#399

Merged
bootjp merged 2 commits intofeature/s3-implfrom
copilot/sub-pr-396
Mar 22, 2026
Merged

Fix HLC monotonicity, SigV4 sig comparison, and coordinator redirect timestamp safety#399
bootjp merged 2 commits intofeature/s3-implfrom
copilot/sub-pr-396

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

Four correctness issues flagged in code review on the S3 adapter + coordinator changes.

HLC monotonicity with caller-provided CommitTS

When a non-zero CommitTS is passed by the caller, ShardedCoordinator.dispatchTxn and txnLogs used it directly without observing it on the HLC. Subsequent clock.Next() calls could then issue timestamps smaller than a previously committed CommitTS, breaking MVCC ordering.

// Before: caller-provided commitTS silently bypassed HLC
if commitTS == 0 {
    commitTS = c.nextTxnTSAfter(startTS)
}

// After: HLC is kept monotonic regardless of timestamp origin
if commitTS == 0 {
    commitTS = c.nextTxnTSAfter(startTS)
} else {
    c.clock.Observe(commitTS)
}

Applied in both dispatchTxn and txnLogs.

SigV4 authorization: compare signature only

Full Authorization header string comparison was brittle — semantically equivalent headers differing in whitespace or parameter ordering would fail. Now extracts and compares just the Signature=<hex> component via a new extractS3Signature helper (with table-driven unit tests).

Coordinator redirect: clear CommitTS when StartTS is absent

In the follower redirect path, a caller-supplied CommitTS with StartTS=0 was forwarded as-is. The leader stamps a fresh StartTS independently but won't override an existing CommitTS in the txn meta, producing CommitTS ≤ StartTS. Fix: zero out CommitTS when StartTS is unset so the leader assigns both consistently.


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Add S3 adapter for elastickv Fix HLC monotonicity, SigV4 sig comparison, and coordinator redirect timestamp safety Mar 22, 2026
Copilot AI requested a review from bootjp March 22, 2026 10:42
@bootjp bootjp marked this pull request as ready for review March 22, 2026 10:44
@bootjp bootjp merged commit 269c231 into feature/s3-impl Mar 22, 2026
4 checks passed
@bootjp bootjp deleted the copilot/sub-pr-396 branch March 22, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants