Skip to content

[Fix] Correctly reset the gate status during ART merging#19204

Merged
Mytherin merged 1 commit into
duckdb:v1.4-andiumfrom
taniabogatsch:art-merge-fix
Oct 1, 2025
Merged

[Fix] Correctly reset the gate status during ART merging#19204
Mytherin merged 1 commit into
duckdb:v1.4-andiumfrom
taniabogatsch:art-merge-fix

Conversation

@taniabogatsch
Copy link
Copy Markdown
Member

Fix #19190.

I really tried to generate the data to reproduce this... The bug happens for four row IDs, if they have the same value. Two each have to be inside a gate in different row groups, so that we create two ARTs in different sinks. The gate also has to start with a prefix that has the GATE_SET status. However, I could not figure out what else is missing for the ARTMerger to hit this code path...

Here's my attempt:

# Create a table that spans two row groups to trigger parallelism.

statement ok
CREATE TABLE tbl (id UBIGINT);

statement ok
INSERT INTO tbl SELECT range FROM range(38_330);

# Insert the same value for row IDs 38_330 and 38_331.

statement ok
INSERT INTO tbl VALUES (38_330), (38_330);

# Fill up until row ID 418_986.
# 418_986 - 2 - 38_330 = 380_654.

statement ok
INSERT INTO tbl SELECT range + 2 + 38_330 FROM range (380_654);

# Insert the same value for row IDs 418_986 and 418_987.
statement ok
INSERT INTO tbl VALUES (38_330), (38_330);

query I
SELECT rowid FROM tbl WHERE id = 38_330 ORDER BY rowid;
----
38330
38331
418986
418987

statement ok
CREATE INDEX idx ON tbl(id);

query I
SELECT COUNT(id) FROM tbl WHERE id = 38_330;
----
4

See also my comment here on how we could maybe allow testing on the original files: https://github.com/duckdblabs/duckdb-internal/issues/6083

@Mytherin Mytherin merged commit c01b4b5 into duckdb:v1.4-andium Oct 1, 2025
50 of 51 checks passed
@Mytherin
Copy link
Copy Markdown
Collaborator

Mytherin commented Oct 1, 2025

Thanks!

github-actions Bot pushed a commit to duckdb/duckdb-r that referenced this pull request Oct 2, 2025
[Fix] Correctly reset the gate status during ART merging (duckdb/duckdb#19204)
Simple no default region return 301 response (duckdb/duckdb#19087)
[chore] Attempt at restoring workflow for MinGW Static libs  (duckdb/duckdb#19205)
https://duckdb-blobs.s3.amazonaws.com -> https://blobs.duckdb.org (duckdb/duckdb#19206)
github-actions Bot added a commit to duckdb/duckdb-r that referenced this pull request Oct 2, 2025
[Fix] Correctly reset the gate status during ART merging (duckdb/duckdb#19204)
Simple no default region return 301 response (duckdb/duckdb#19087)
[chore] Attempt at restoring workflow for MinGW Static libs  (duckdb/duckdb#19205)
https://duckdb-blobs.s3.amazonaws.com -> https://blobs.duckdb.org (duckdb/duckdb#19206)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
@taniabogatsch taniabogatsch deleted the art-merge-fix branch October 2, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants