Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions kv/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ func (c *Coordinate) Dispatch(ctx context.Context, reqs *OperationGroup[OP]) (*C

if reqs.IsTxn && reqs.StartTS == 0 {
// Leader-only timestamp issuance to avoid divergence across shards.
// When the leader assigns StartTS, also clear any caller-provided
// CommitTS so dispatchTxn generates both timestamps consistently.
// A caller-supplied CommitTS without a matching StartTS could produce
// CommitTS <= StartTS (an invalid transaction).
reqs.StartTS = c.nextStartTS()
reqs.CommitTS = 0
}

if reqs.IsTxn {
Expand Down
5 changes: 5 additions & 0 deletions kv/sharded_coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func (c *ShardedCoordinator) Dispatch(ctx context.Context, reqs *OperationGroup[
return nil, err
}
reqs.StartTS = startTS
// When the coordinator assigns StartTS, also clear any caller-provided
// CommitTS so dispatchTxn generates both timestamps consistently.
// A caller-supplied CommitTS without a matching StartTS could produce
// CommitTS <= StartTS (an invalid transaction).
reqs.CommitTS = 0
}

if reqs.IsTxn {
Expand Down
Loading