Skip to content

Replace ARTConflictType::TRANSACTION with fatal exception - #23193

Merged
Mytherin merged 4 commits into
duckdb:v1.5-variegatafrom
artjomPlaunov:write-write
Jun 11, 2026
Merged

Mytherin merged 4 commits into
duckdb:v1.5-variegatafrom
artjomPlaunov:write-write

Conversation

@artjomPlaunov

Copy link
Copy Markdown
Member

There is a possible scenario where we can have duplicates in unique ART indexes: if we do a delete + insert on the same key, this turns into the reverse during commit: insert into the main index (creates temporary duplicate state) -> then delete the old rowid (restores back to non-duplicate state).

However, in ARTOperator::Insert It shouldn't be possible to reach this temporary gated duplicate state due to transaction + wal locks, i.e. this should now be unreachable, unless the ART is corrupted and hence we now throw a fatal exception at this point.

Note that VerifyLeaf could still hit the duplicate leaves unique index scenario, so the logic there remains.

@lnkuiper

Copy link
Copy Markdown
Member

Hey, looks good - just checking: is ARTConflictType::TRANSACTION unused now?

@artjomPlaunov

Copy link
Copy Markdown
Member Author

@lnkuiper ah yea, I thought this was the only location, but there is still a D_ASSERT, as well as a test I forgot to modify that checks for it (although AFAIK, it wasn't actually hitting that case anymore). Let me double check these and will ping you again for review.

@artjomPlaunov

Copy link
Copy Markdown
Member Author

@lnkuiper but yes I think ARTConflictType::TRANSACTION should be unused now, so I also have to update the enum, etc., let me handle that now :-)

@lnkuiper

Copy link
Copy Markdown
Member

Great, feel free to mark as ready to merge once you've done that :)

@artjomPlaunov
artjomPlaunov marked this pull request as draft June 10, 2026 12:00
@artjomPlaunov
artjomPlaunov marked this pull request as ready for review June 10, 2026 12:00
@Mytherin
Mytherin merged commit e36f5ab into duckdb:v1.5-variegata Jun 11, 2026
85 checks passed
@Mytherin

Copy link
Copy Markdown
Collaborator

Thanks!

@artjomPlaunov
artjomPlaunov deleted the write-write branch June 11, 2026 14:01
krlmlr pushed a commit to krlmlr/duckdb that referenced this pull request Jun 21, 2026
Conflict-free merge of the clean commits between resolutions:
  - Replace ARTConflictType::TRANSACTION with fatal exception (duckdb#23193)
  - [Dev] Fix variant shredding analysis logic discrepancy with shredded writing (duckdb#23194)
  - Initialize all `BaseStatistics` members and zero `stats_union` (duckdb#23202)
  - Initialize `TransactionContext::invalidation_policy` and `auto_rollback` (duckdb#23203)
krlmlr pushed a commit to krlmlr/duckdb that referenced this pull request Jun 21, 2026
There is a possible scenario where we can have duplicates in unique ART
indexes: if we do a delete + insert on the same key, this turns into the
reverse during commit: insert into the main index (creates temporary
duplicate state) -> then delete the old rowid (restores back to
non-duplicate state).

However, in ARTOperator::Insert It shouldn't be possible to reach this
temporary gated duplicate state due to transaction + wal locks, i.e.
this should now be unreachable, unless the ART is corrupted and hence we
now throw a fatal exception at this point.

Note that VerifyLeaf could still hit the duplicate leaves unique index
scenario, so the logic there remains.
krlmlr pushed a commit to krlmlr/duckdb that referenced this pull request Jun 21, 2026
Conflict-free merge of the clean commits between resolutions:
  - Replace ARTConflictType::TRANSACTION with fatal exception (duckdb#23193)
  - [Dev] Fix variant shredding analysis logic discrepancy with shredded writing (duckdb#23194)
  - Initialize all `BaseStatistics` members and zero `stats_union` (duckdb#23202)
  - Initialize `TransactionContext::invalidation_policy` and `auto_rollback` (duckdb#23203)
krlmlr pushed a commit to krlmlr/duckdb that referenced this pull request Jun 21, 2026
Brings these v1.5-variegata commits; they do not overlap with the main/v2.0
line, so they merge with no conflicts:

- Replace ARTConflictType::TRANSACTION with fatal exception (duckdb#23193)
- [Dev] Fix variant shredding analysis logic discrepancy with shredded writing (duckdb#23194)
- Initialize all `BaseStatistics` members and zero `stats_union` (duckdb#23202)
- Initialize `TransactionContext::invalidation_policy` and `auto_rollback` (duckdb#23203)
krlmlr pushed a commit to krlmlr/duckdb that referenced this pull request Jun 21, 2026
Brings these v1.5-variegata commits; they do not overlap with the main/v2.0
line, so they merge with no conflicts:

- Replace ARTConflictType::TRANSACTION with fatal exception (duckdb#23193)
- [Dev] Fix variant shredding analysis logic discrepancy with shredded writing (duckdb#23194)
- Initialize all `BaseStatistics` members and zero `stats_union` (duckdb#23202)
- Initialize `TransactionContext::invalidation_policy` and `auto_rollback` (duckdb#23203)
kaka11chen pushed a commit to kaka11chen/astrovela_vane that referenced this pull request Aug 14, 2026
…kdb#23193)

There is a possible scenario where we can have duplicates in unique ART
indexes: if we do a delete + insert on the same key, this turns into the
reverse during commit: insert into the main index (creates temporary
duplicate state) -> then delete the old rowid (restores back to
non-duplicate state).

However, in ARTOperator::Insert It shouldn't be possible to reach this
temporary gated duplicate state due to transaction + wal locks, i.e.
this should now be unreachable, unless the ART is corrupted and hence we
now throw a fatal exception at this point.

Note that VerifyLeaf could still hit the duplicate leaves unique index
scenario, so the logic there remains.

Upstream-Commit: duckdb/duckdb@e36f5ab
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.

3 participants