Skip to content

Fail amend commits when branch head has moved - #11344

Merged
elianddb merged 5 commits into
mainfrom
elian/dolt-ac41dfb8
Jul 27, 2026
Merged

Fail amend commits when branch head has moved#11344
elianddb merged 5 commits into
mainfrom
elian/dolt-ac41dfb8

Conversation

@elianddb

@elianddb elianddb commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

When a SQL transaction ran CALL DOLT_COMMIT('--amend') after another connection had added a commit or merged a branch, the amend silently replaced the transaction HEAD commit up to the new HEAD commit. The data from the erased commits survived, but the commit itself, including merge records we're gone.

  • datas.CommitOptions.Amend is replaced with AmendedCommit (hash.Hash), the address of the commit an amend replaces.
  • datas.BuildNewCommit rejects an amend unless AmendedCommit is still the dataset HEAD, relying on the CAS in CommitWithWorkingSet` for atomic comparison.
  • dsess.doCommit runs validateAmendedHead before the working set merge to specify the head conflict over a row conflict.
  • Amend is refused mid merge, cherry-pick, in parity with git and revert, a Dolt-specific addition because it follows the same merge state.
  • The admin createchunk command's HEAD check bypass moves from the Amend flag to a new explicit CommitOptions.Force field.
    Fix Potential concurrency Issue with call dolt_commit('--amend') #9072

@elianddb elianddb changed the title go/libraries/doltcore/sqle/enginetest: add stale amend and in progres… Fail amend commits when branch head has moved Jul 23, 2026
@coffeegoddd

coffeegoddd commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@elianddb DOLT

read_tests from_latency to_latency percent_change
covering_index_scan 2.3 2.3 0.0
groupby_scan 144.97 142.39 -1.78
index_join 1.96 1.93 -1.53
index_join_scan 1.32 1.32 0.0
index_scan 219.36 219.36 0.0
oltp_point_select 0.26 0.26 0.0
oltp_read_only 5.0 5.0 0.0
select_random_points 0.51 0.51 0.0
select_random_ranges 0.65 0.64 -1.54
table_scan 207.82 204.11 -1.79
types_table_scan 475.79 475.79 0.0
write_tests from_latency to_latency percent_change
oltp_delete_insert 6.21 6.21 0.0
oltp_insert 3.13 3.13 0.0
oltp_read_write 11.24 11.24 0.0
oltp_update_index 3.3 3.3 0.0
oltp_update_non_index 3.02 3.02 0.0
oltp_write_only 6.32 6.32 0.0
types_delete_insert 6.91 6.79 -1.74

@coffeegoddd

coffeegoddd commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@elianddb DOLT

test_name from_latency_p95 to_latency_p95 percent_change
tpcc-scale-factor-1 45.79 46.63 1.83
test_name from_server_name from_server_version from_tps to_server_name to_server_version to_tps percent_change
tpcc-scale-factor-1 dolt c855de1 52.41 dolt 6396adb 52.49 0.15

@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
2711275 ok 5937471
version total_tests
2711275 5937471
correctness_percentage
100.0

@fulghum fulghum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a couple small comments to check out. I think testing with ignored tables would be helpful and documenting the expected behavior for ignored files in the code when we do the HEAD check.

Comment thread go/libraries/doltcore/sqle/dprocedures/dolt_commit.go
Comment thread go/libraries/doltcore/sqle/dsess/transactions.go
@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
6396adb ok 5937471
version total_tests
6396adb 5937471
correctness_percentage
100.0

@elianddb
elianddb merged commit 16fd54b into main Jul 27, 2026
26 of 27 checks passed
@github-actions

Copy link
Copy Markdown

@coffeegoddd DOLT

name add_cnt delete_cnt update_cnt latency
adds_only 60000 0 0 0.6
adds_updates_deletes 60000 60000 60000 2.91
deletes_only 0 60000 0 1.46
updates_only 0 0 60000 1.7

@github-actions

Copy link
Copy Markdown

@coffeegoddd DOLT

test_name detail row_cnt sorted mysql_time sql_mult cli_mult
batching LOAD DATA 10000 1 0.06 1.67
batching batch sql 10000 1 0.07 1.71
batching by line sql 10000 1 0.07 1.71
blob 1 blob 200000 1 0.89 2.76 2.53
blob 2 blobs 200000 1 0.91 2.67 2.45
blob no blob 200000 1 0.88 2.8 2.55
col type datetime 200000 1 0.84 2.62 2.42
col type varchar 200000 1 0.69 3.52 3.25
config width 2 cols 200000 1 0.81 2.62 2.36
config width 32 cols 200000 1 1.92 3.03 2.94
config width 8 cols 200000 1 0.98 2.78 2.63
pk type float 200000 1 0.89 2.39 2.19
pk type int 200000 1 0.81 2.63 2.37
pk type varchar 200000 1 1.51 1.72 1.52
row count 1.6mm 1600000 1 5.8 2.96 2.67
row count 400k 400000 1 1.5 2.83 2.57
row count 800k 800000 1 2.92 2.93 2.65
secondary index four index 200000 1 3.74 1.27 1.07
secondary index no secondary 200000 1 0.9 2.73 2.5
secondary index one index 200000 1 1.14 2.55 2.31
secondary index two index 200000 1 2.04 1.73 1.48
sorting shuffled 1mm 1000000 0 5.04 2.77 2.49
sorting sorted 1mm 1000000 1 5.04 2.78 2.48

@github-actions

Copy link
Copy Markdown

@coffeegoddd DOLT

name detail mean_mult
dolt_blame_basic system table 1.29
dolt_blame_commit_filter system table 1.22
dolt_commit_ancestors_commit_filter system table 0.69
dolt_commits_commit_filter system table 1.16
dolt_diff_log_join_from_commit system table 3.13
dolt_diff_log_join_to_commit system table 3.14
dolt_diff_table_from_commit_filter system table 1.18
dolt_diff_table_to_commit_filter system table 1.16
dolt_diffs_commit_filter system table 1.19
dolt_history_commit_filter system table 1.46
dolt_log_commit_filter system table 1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential concurrency Issue with call dolt_commit('--amend')

3 participants