Skip to content

storage/dolt: migrate remaining in-tx DOLT_ADD/DOLT_COMMIT sites to post-tx ordering (lost-update hazard) #5752

Description

@steveyegge

Summary

CALL DOLT_ADD / CALL DOLT_COMMIT executed inside a still-open SQL transaction can materialize a Dolt commit from the session's pre-merge transaction snapshot. Under concurrent writers on one branch this can silently write concurrently-committed rows back to their BEGIN-time values (lost updates). The mechanism is documented Dolt behavior history — dolthub/dolt#5205 and the dolthub/dolt#5608#5621 staged-root-merge family — and PR #5740 reports reproducing the revert in production server mode and fixes the main issue-mutation path (runIssueOperationTxWithMessage) by moving the Dolt commit strictly after the SQL COMMIT.

This issue tracks the remaining in-tx surface, so the migration list lives somewhere that can't rot in a code comment.

Remaining in-tx DOLT_ADD/DOLT_COMMIT sites (as of current main)

  • doltAddAndCommitInTx itself (internal/storage/dolt/ephemeral_routing.go) and its callers:
    • wisp promote / demote (ephemeral_routing.go)
    • legacy write paths in issues.go — UpdateIssue, UpdateIssueChecked, ClaimIssue, ClaimReadyIssue, UnclaimIssue, UnclaimIssueIfAssignee, ReclaimExpiredLeases, CloseIssue*, DeleteIssue*, MergeMetadata (several reachable from live CLI paths: bd edit/note/priority/defer/unclaim, linear sync)
    • slots.go (SlotClear)
    • RunInIssueLifecycleTransaction (transaction.go)
    • deleter.go stages via inline CALL DOLT_ADD in-tx as well
  • Contrast: creates, comments, labels, and dependencies already use the post-tx doltAddAndCommit — the safe ordering this issue asks the remaining sites to adopt.

Acceptance

Every mutating path stages and Dolt-commits after its SQL transaction commits (post-merge working set), or documents a specific reason it cannot. doltAddAndCommitInTx is deleted or reduced to callers with a written justification. Sequence-contract tests in the style of PR #5740's dolt_commit_ordering_test.go pin the ordering for the migrated paths.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions