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

Duplicate rowIDs generated on INSERT to ACID transactional tables #8452

Closed
losipiuk opened this issue Jul 1, 2021 · 0 comments · Fixed by #8480
Closed

Duplicate rowIDs generated on INSERT to ACID transactional tables #8452

losipiuk opened this issue Jul 1, 2021 · 0 comments · Fixed by #8480
Labels
bug Something isn't working correctness

Comments

@losipiuk
Copy link
Member

losipiuk commented Jul 1, 2021

When we INSERT data into transactional table rowId counter is reset on each input page. As a result for any INSERT which processes significant number of rows we will end up with duplicate rowIDs in created file.

Noticed by @electrum here: #8268 (comment)

REPRO:

trino:default> CREATE TABLE lineitem WITH(transactional=true) AS select * from tpch.sf1.lineitem limit 1;
CREATE TABLE: 1 row

-- insert significant amount of rows
trino:default> INSERT INTO lineitem select * from tpch.sf1.lineitem;
INSERT: 6001215 rows

-- verify total number of rows
trino:default> select count(*) from lineitem;
  _col0
---------
 6001216
(1 row)

-- select single row for deletion
trino:default> select count(*) from lineitem where orderkey=5942403 and partkey=80946 and suppkey=947 and linenumber=4;
 _col0
-------
     1
(1 row)

-- delete the row
trino:default> delete from lineitem where orderkey=5942403 and partkey=80946 and suppkey=947 and linenumber=4;
DELETE: 1 row

-- verify row count after delete
trino:default> select count(*) from lineitem;
  _col0
---------
 5999480
(1 row)

SHOULD BE 6001215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness
Development

Successfully merging a pull request may close this issue.

1 participant