Skip to content

Fix panic during merge when FK is dropped and re-added on a branch with a composite PK child table#10680

Merged
elianddb merged 3 commits intomainfrom
elian/10676
Mar 16, 2026
Merged

Fix panic during merge when FK is dropped and re-added on a branch with a composite PK child table#10680
elianddb merged 3 commits intomainfrom
elian/10676

Conversation

@elianddb
Copy link
Copy Markdown
Contributor

Fix #10676
dolt merge could panic with index out of range when one branch dropped and re-added a foreign key (creating a new backing index) while the other branch had new rows in a child table with a composite primary key. This fix limits the FK column type compatibility check to only the columns relevant to the foreign key, ignoring extra primary key columns that are not part of the FK relationship.

@coffeegoddd
Copy link
Copy Markdown
Contributor

coffeegoddd commented Mar 13, 2026

@elianddb DOLT

read_tests from_latency to_latency percent_change
covering_index_scan 0.58 0.56 -3.45
groupby_scan 10.09 10.09 0.0
index_join 1.86 1.86 0.0
index_join_scan 1.39 1.42 2.16
index_scan 21.89 22.28 1.78
oltp_point_select 0.27 0.27 0.0
oltp_read_only 5.28 5.28 0.0
select_random_points 0.53 0.54 1.89
select_random_ranges 0.55 0.56 1.82
table_scan 21.89 21.89 0.0
types_table_scan 66.84 65.65 -1.78
write_tests from_latency to_latency percent_change
oltp_delete_insert 6.32 6.32 0.0
oltp_insert 3.13 3.13 0.0
oltp_read_write 11.45 11.45 0.0
oltp_update_index 3.19 3.19 0.0
oltp_update_non_index 3.13 3.13 0.0
oltp_write_only 6.09 6.09 0.0
types_delete_insert 6.91 6.91 0.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
2674a18 ok 5937471
version total_tests
2674a18 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

coffeegoddd commented Mar 13, 2026

@elianddb DOLT

test_name from_latency_p95 to_latency_p95 percent_change
tpcc-scale-factor-1 61.08 61.08 0.0
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 24e549c 38.17 dolt bda18ff 37.61 -1.47

Copy link
Copy Markdown
Contributor

@angelamayxie angelamayxie left a comment

Choose a reason for hiding this comment

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

looks good except fix the comments

@coffeegoddd
Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
2b376c5 ok 5937471
version total_tests
2b376c5 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

@elianddb DOLT

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

@elianddb elianddb requested a review from jycor March 16, 2026 22:03
Copy link
Copy Markdown
Contributor

@jycor jycor left a comment

Choose a reason for hiding this comment

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

LGTM

@elianddb elianddb merged commit 235cd0a into main Mar 16, 2026
31 of 34 checks passed
@github-actions
Copy link
Copy Markdown

@coffeegoddd DOLT

name add_cnt delete_cnt update_cnt latency
adds_only 60000 0 0 0.65
adds_updates_deletes 60000 60000 60000 3.19
deletes_only 0 60000 0 1.5
updates_only 0 0 60000 1.9

@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.86
blob 1 blob 200000 1 0.9 4.1 4.44
blob 2 blobs 200000 1 0.89 4.54 4.44
blob no blob 200000 1 0.89 2.8 2.74
col type datetime 200000 1 0.84 2.58 2.52
col type varchar 200000 1 0.69 3.59 3.55
config width 2 cols 200000 1 0.81 2.58 2.46
config width 32 cols 200000 1 1.96 3.04 2.59
config width 8 cols 200000 1 0.99 2.75 2.49
pk type float 200000 1 0.89 2.7 2.27
pk type int 200000 1 0.78 2.73 2.58
pk type varchar 200000 1 1.55 1.75 1.58
row count 1.6mm 1600000 1 5.85 2.93 2.73
row count 400k 400000 1 1.48 2.85 2.68
row count 800k 800000 1 2.96 2.88 2.68
secondary index four index 200000 1 3.66 1.3 1.11
secondary index no secondary 200000 1 0.88 2.86 2.77
secondary index one index 200000 1 1.1 2.63 2.34
secondary index two index 200000 1 2.01 1.77 1.72
sorting shuffled 1mm 1000000 0 5.04 2.82 2.65
sorting sorted 1mm 1000000 1 5.11 2.79 2.61

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.

Panic attempting to merge : index out of range [1] with length 1

4 participants