Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when querying dolt_diff after updating a text field #735

Open
fulghum opened this issue Sep 23, 2024 · 0 comments
Open

Panic when querying dolt_diff after updating a text field #735

fulghum opened this issue Sep 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@fulghum
Copy link
Contributor

fulghum commented Sep 23, 2024

When a text field in a row has been updated, Doltgres panics when querying the diff.

create table employees(id int8, first_name text, last_name text, primary key(id));
insert into employees values(1, 'John', 'Smith');
call dolt_commit('-Am', 'creating table on main');
call dolt_checkout('-b', 'branch1');
update employees set first_name='' where id=1;
select * from dolt_diff('main', 'WORKING', 'employees');

The steps above cause a panic with this stack trace:

panic: runtime error: slice bounds out of range [:203855527] with capacity 92

goroutine 434 [running]:
github.com/dolthub/doltgresql/utils.UnsafeAdvanceReader(...)
        /Users/jason/Projects/doltgresql/utils/reader.go:364
github.com/dolthub/doltgresql/server/types.serializedStringCompare({0x140029eb7a4?, 0x140029eb7a4?, 0x2c?}, {0x14001febfa4?, 0x14001febfa4?, 0x2c?})
        /Users/jason/Projects/doltgresql/server/types/text.go:267 +0x140
github.com/dolthub/doltgresql/server/types.TextType.SerializedCompare({}, {0x140029eb7a4?, 0x10389aa6c?, 0x1064ba918?}, {0x14001febfa4?, 0x1400360d4a0?, 0x1400360d500?})
        /Users/jason/Projects/doltgresql/server/types/text.go:181 +0x70
github.com/dolthub/dolt/go/store/val.ExtendedTupleComparator.CompareValues({{0x1064c4020, 0x1096f5820}, {0x140035e77c0, 0x2, 0x2}}, 0x106243280?, {0x140029eb7a4?, 0x94?, 0x14004580c98?}, {0x14001febfa4?, ...}, ...)
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/store/val/extended_comparator.go:52 +0xb4
github.com/dolthub/dolt/go/store/val.ExtendedTupleComparator.Compare({{0x1064c4020, 0x1096f5820}, {0x140035e77c0, 0x2, 0x2}}, {0x140029eb7a4, 0x2c, 0x5c}, {0x14001febfa4, 0x2c, ...}, ...)
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/store/val/extended_comparator.go:40 +0x28c
github.com/dolthub/dolt/go/store/val.TupleDesc.Compare({{0x14004607688, 0x2, 0x4}, {0x140035e77c0, 0x2, 0x2}, {0x1064c4060, 0x1400124cdb0}, {0x14004607698, 0x0, ...}}, ...)
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/store/val/tuple_descriptor.go:160 +0x98
github.com/dolthub/dolt/go/store/prolly.DiffMaps.makeDiffCallBack.func1({0x1064ba918, 0x14003417040}, {{0x140029eb7dc, 0xa, 0x24}, {0x140029eb7a4, 0x2c, 0x5c}, {0x14001febfa4, 0x2c, ...}, ...})
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/store/prolly/tuple_map.go:162 +0xc0
github.com/dolthub/dolt/go/store/prolly/tree.DiffOrderedTrees[...]({_, _}, {{{0x88, 0xa, 0x80, 0x4, 0x0}, {0x50, 0x2c, 0x48, ...}, ...}, ...}, ...)
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/store/prolly/tree/map.go:60 +0x280
github.com/dolthub/dolt/go/store/prolly.DiffMaps({_, _}, {{{{0x88, 0xa, 0x80, 0x4, 0x0}, {0x50, 0x2c, 0x48, ...}, ...}, ...}, ...}, ...)
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/store/prolly/tuple_map.go:115 +0x11c
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables.prollyDiffIter.queueRows({{{{{...}, {...}, 0x1, 0x0, 0x0, {...}}, {0x1064cb970, 0x14001dc0000}, {{...}, {...}, ...}}, ...}, ...}, ...)
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/libraries/doltcore/sqle/dtables/diff_iter.go:337 +0x88
github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables.newProllyDiffIter.func1()
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/libraries/doltcore/sqle/dtables/diff_iter.go:309 +0x48
created by github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtables.newProllyDiffIter in goroutine 383
        /Users/jason/go/pkg/mod/github.com/dolthub/dolt/go@v0.40.5-0.20240919183209-28badac50053/libraries/doltcore/sqle/dtables/diff_iter.go:308
@fulghum fulghum added the bug Something isn't working label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant