dolt
dolt copied to clipboard
Merging in a schema change can bypass constraint checks, causing panics or unrecoverable errors.
Steps to reproduce:
git checkout nicktobey/schemamergeconstraints
go test libraries/doltcore/merge/schema_merge_test.go -run "^\QTestDoltMerge\E$"
New test TestDoltMerge/resolving_a_modified/modified_still_checks_uniqueness_constraint
returns an error:
error storing constraint violation for primary key (( 1 )): another violation already exists
new violation: {"Columns":["b"],"Name":"b"} old violation: ({"Columns":["c"],"Name":"c"})
New test TestDoltMerge/resolving_a_modified/modified_row_still_checks_nullness_constraint panics with:
panic: cannot write NULL to non-NULL field [recovered]
panic: cannot write NULL to non-NULL field
goroutine 8121 [running]:
testing.tRunner.func1.2({0x10350f180, 0x103970720})
/usr/local/go/src/testing/testing.go:1545 +0x1c8
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1548 +0x360
panic({0x10350f180?, 0x103970720?})
/usr/local/go/src/runtime/panic.go:914 +0x218
github.com/dolthub/dolt/go/store/val.(*TupleBuilder).Build(0x103991150?, {0x103983780?, 0x104ca2900?})
/Users/nick/Documents/dolt/go/store/val/tuple_builder.go:79 +0x90
github.com/dolthub/dolt/go/libraries/doltcore/sqle/index.Serialize({0x103991150, 0x14001816000}, {0x103998450, 0x14001b34140}, {0x4?, 0x0?}, {0x0, 0x0})
/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/index/prolly_fields.go:161 +0x1cc
github.com/dolthub/dolt/go/libraries/doltcore/merge.convert({0x103991150, 0x14001816000}, {{0x14002001778, 0x2, 0x4}, {0x1039933d8, 0x106a72220}, {0x14002001788, 0x0, 0x2}}, ...)
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge_prolly_rows.go:1906 +0x1c8
github.com/dolthub/dolt/go/libraries/doltcore/merge.(*valueMerger).processColumn(0x140021a5c00, {0x103991150, 0x14001816000}, 0x0, {0x1400018b13c, 0x6, 0x34}, {0x1400172ff7c, 0x8, 0x84}, ...)
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge_prolly_rows.go:1849 +0x568
github.com/dolthub/dolt/go/libraries/doltcore/merge.(*valueMerger).tryMerge(0x140021a5c00, {0x103991150, 0x14001816000}, {0x1400018b13c, 0x6, 0x34}, {0x1400172ff7c, 0x8, 0x84}, {0x14001f2b780, ...})
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge_prolly_rows.go:1656 +0x240
github.com/dolthub/dolt/go/store/prolly/tree.(*ThreeWayDiffer[...]).Next(0x103a203c0, {0x103991150, 0x14001816000})
/Users/nick/Documents/dolt/go/store/prolly/tree/three_way_differ.go:177 +0x584
github.com/dolthub/dolt/go/libraries/doltcore/merge.mergeProllyTableData(0x103a25708?, 0x14001816460, {0x103a25708, 0x14001f8f020}, 0x14001b1c670, 0x140021a5c00, 0x0, 0x57?)
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge_prolly_rows.go:165 +0x6b8
github.com/dolthub/dolt/go/libraries/doltcore/merge.mergeProllyTable({0x103991150?, 0x14001816000}, 0x14001816460, {0x103a25708, 0x14001f8f020}, 0x0)
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge_prolly_rows.go:84 +0x2c0
github.com/dolthub/dolt/go/libraries/doltcore/merge.(*RootMerger).MergeTable(0x14000d63f60, 0x14001816000?, {0x14002001308, 0x4}, {0x0, {0x0, 0x0}, {0x0, 0x0}}, {0x60?, ...})
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge_rows.go:151 +0x350
github.com/dolthub/dolt/go/libraries/doltcore/merge.MergeRoots(0x14000b2f840?, 0x14000d1f8b0, 0x14000d1f900, 0x14000d1f950, {0x1039830a0, 0x14000b2f580}, {0x1039830a0, 0x14000b2f840}, {0x0, {0x0, ...}, ...}, ...)
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge.go:208 +0x2a0
github.com/dolthub/dolt/go/libraries/doltcore/merge.MergeCommits(0x0?, 0x0?, 0x0?, {0x0, {0x0, 0x0}, {0x0, 0x0}})
/Users/nick/Documents/dolt/go/libraries/doltcore/merge/merge.go:74 +0x100
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.executeMerge(0x103991150?, 0x1400096a7f0?, {0x1400096a7f0, 0x4}, 0xf0?, 0x77?, 0x14000d642a8?, 0x100fd932c?, {0x140020011e8, 0x5}, ...)
/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_merge.go:330 +0x84
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.performMerge(0x1029360c7?, 0x19?, 0x14000b2ebc0, {0x1400096a7f0, 0x4}, 0x140016d2dc0, 0x0, {0x14000936a20, 0x1e})
/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_merge.go:244 +0x4b0
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.doDoltMerge(0x14001816000, {0x14001b1c2d0, 0x1, 0x1})
/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_merge.go:159 +0x564
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dprocedures.doltMerge(0x14000d64658?, {0x14001b1c2d0?, 0x2?, 0x2?})
/Users/nick/Documents/dolt/go/libraries/doltcore/sqle/dprocedures/dolt_merge.go:73 +0x20
reflect.Value.call({0x1035f58e0?, 0x10396a718?, 0x3fffffff?}, {0x1028ef8ca, 0x4}, {0x14000b21680, 0x2, 0x10350f180?})
/usr/local/go/src/reflect/value.go:596 +0x994
reflect.Value.Call({0x1035f58e0?, 0x10396a718?, 0x103a315b0?}, {0x14000b21680?, 0x10350f180?, 0x14001b1c2b0?})
/usr/local/go/src/reflect/value.go:380 +0x94
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildExternalProcedure(0x14000d64fa8?, 0x14001816000, 0x1400085cd20, {0xf5e4?, 0x12e4d4548?, 0x1076b0a68?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/rel.go:617 +0x374
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14000d650f8?, 0x100eef5e4?, {0x1039a3a10?, 0x1400085cd20?}, {0x0?, 0x0, 0x0})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/node_builder.gen.go:135 +0xed0
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildProcedure(...)
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/rel.go:338
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14001b1c130?, 0x1400200121e?, {0x1039a3ec0?, 0x14000dbbba0?}, {0x0?, 0x0, 0x0})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/node_builder.gen.go:223 +0x19a4
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildCall(0x14001b1c220?, 0x14001b1c210?, 0x14001f8e3c0, {0x0, 0x0, 0x0})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/proc.go:187 +0x1e8
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14000d65558?, 0x10173f690?, {0x1039a42d0?, 0x14001f8e3c0?}, {0x0?, 0x18?, 0x18?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/node_builder.gen.go:85 +0x8a4
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).Build(...)
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/builder.go:33
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildTransactionCommittingNode(0x14002209998?, 0x0?, 0x14000d655d8?, {0x0?, 0x18?, 0x103760600?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/transaction.go:305 +0x44
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14000d65878?, 0x101b1730c?, {0x1039a1530?, 0x14001b1c260?}, {0x0?, 0xb?, 0xc?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/node_builder.gen.go:37 +0x114
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).Build(...)
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/builder.go:33
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildQueryProcess(0x1028fdbfe?, 0xa?, 0x14002209998, {0x0?, 0x0?, 0x0?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/other.go:358 +0x48
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).buildNodeExec(0x14002064000?, 0x0?, {0x1039a0d60?, 0x14002209998?}, {0x0?, 0x103967ca8?, 0x14000d65928?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/node_builder.gen.go:47 +0x204
github.com/dolthub/go-mysql-server/sql/rowexec.(*BaseBuilder).Build(0x1400085ca10?, 0x1039a0d60?, {0x1039a0d60?, 0x14002209998?}, {0x0?, 0x14001f8e240?, 0x1dde32ad?})
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/sql/rowexec/builder.go:33 +0x28
github.com/dolthub/go-mysql-server.(*Engine).QueryWithBindings(0x1400208c060, 0x14001816000, {0x10293294f, 0x19}, {0x0, 0x0}, 0x0)
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/engine.go:522 +0xa20
github.com/dolthub/go-mysql-server/enginetest.TestQueryWithContext(0x14001b41a00, 0x140018e6320, {0x1039ab2d0, 0x1400208c060}, {0x103991118, 0x1400161dc20}, {0x10293294f, 0x19}, {0x1063c8c80, 0x1, ...}, ...)
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/enginetest/evaluation.go:334 +0x180
github.com/dolthub/go-mysql-server/enginetest.TestScriptWithEngine.func1.1(0x14001b41a00)
/Users/nick/go/pkg/mod/github.com/dolthub/[email protected]/enginetest/evaluation.go:135 +0x218
testing.tRunner(0x14001b41a00, 0x14000b2f040)
/usr/local/go/src/testing/testing.go:1595 +0xe8
created by testing.(*T).Run in goroutine 7201
/usr/local/go/src/testing/testing.go:1648 +0x33c