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

Fix DELETE on compressed chunk with non-btree operators #7645

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

svenklemm
Copy link
Member

@svenklemm svenklemm commented Feb 1, 2025

When deleting from compressed chunk the direct delete optimization
would ignore constraints that were not using btree operators
leading to constraints of the DELETE not being applied to the
direct delete on the compressed chunk, potentially leading to
data corruption. This patch disables the direct delete optimization
when any of the constraints can not be applied.

Fixes #7644

Copy link

github-actions bot commented Feb 1, 2025

@gayyappan, @fabriziomello: please review this pull request.

Powered by pull-review

@svenklemm svenklemm added this to the v2.18.1 milestone Feb 1, 2025
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 76.19048% with 5 lines in your changes missing coverage. Please review.

Project coverage is 81.30%. Comparing base (59f50f2) to head (b1177af).
Report is 725 commits behind head on main.

Files with missing lines Patch % Lines
tsl/src/compression/compression_scankey.c 82.35% 2 Missing and 1 partial ⚠️
tsl/src/compression/compression_dml.c 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7645      +/-   ##
==========================================
+ Coverage   80.06%   81.30%   +1.23%     
==========================================
  Files         190      241      +51     
  Lines       37181    44730    +7549     
  Branches     9450    11165    +1715     
==========================================
+ Hits        29770    36368    +6598     
- Misses       2997     3974     +977     
+ Partials     4414     4388      -26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@svenklemm svenklemm force-pushed the compressed_delete_non_btree branch from c2f040f to fb7f931 Compare February 1, 2025 14:01
Copy link
Contributor

@fabriziomello fabriziomello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@svenklemm svenklemm requested review from antekresic and akuzm February 1, 2025 20:07
@svenklemm svenklemm force-pushed the compressed_delete_non_btree branch 5 times, most recently from 1055bbf to 986bac7 Compare February 3, 2025 09:55
@svenklemm svenklemm force-pushed the compressed_delete_non_btree branch 2 times, most recently from 9dbf5d4 to 6302c45 Compare February 3, 2025 10:52
When deleting from compressed chunk the direct delete optimization
would ignore constraints that were not using btree operators
leading to constraints of the DELETE not being applied to the
direct delete on the compressed chunk, potentially leading to
data corruption. This patch disables the direct delete optimization
when any of the constraints can not be applied.

Fixes timescale#7644
@svenklemm svenklemm force-pushed the compressed_delete_non_btree branch from 6302c45 to b1177af Compare February 3, 2025 11:51
@svenklemm svenklemm merged commit 253a7cb into timescale:main Feb 3, 2025
44 of 47 checks passed
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* timescale#7656 Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* timescale#6884 Match the Postgres NaN comparison behavior in WHERE clause over compressed tables.
* timescale#7600 Fix lock order when dropping index
* timescale#7637 Allow EXPLAIN in read-only mode
* timescale#7645 Fix DELETE on compressed chunk with non-btree operators
* timescale#7649 Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* timescale#7653 Push down orderby scankeys to Hypercore TAM
* timescale#7665 Block merging of frozen chunks
* timescale#7673 Don't abort additional INSERTs when hitting first conflict

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* @jakehedlund for reporting the incompatible NaN behavior in WHERE clause over compressed tables.
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
@svenklemm svenklemm mentioned this pull request Feb 10, 2025
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* timescale#7656 Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* timescale#6884 Match the Postgres NaN comparison behavior in WHERE clause over compressed tables.
* timescale#7600 Fix lock order when dropping index
* timescale#7637 Allow EXPLAIN in read-only mode
* timescale#7645 Fix DELETE on compressed chunk with non-btree operators
* timescale#7649 Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* timescale#7653 Push down orderby scankeys to Hypercore TAM
* timescale#7665 Block merging of frozen chunks
* timescale#7673 Don't abort additional INSERTs when hitting first conflict

**GUCs**
* enable_hypercore_scankey_pushdown: Push down qualifiers as scankeys when using Hypercore TAM

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* @jakehedlund for reporting the incompatible NaN behavior in WHERE clause over compressed tables.
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* timescale#7656 Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* timescale#7600 Fix lock order when dropping index
* timescale#7637 Allow EXPLAIN in read-only mode
* timescale#7645 Fix DELETE on compressed chunk with non-btree operators
* timescale#7649 Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* timescale#7653 Push down orderby scankeys to Hypercore TAM
* timescale#7665 Block merging of frozen chunks
* timescale#7673 Don't abort additional INSERTs when hitting first conflict

**GUCs**
* enable_hypercore_scankey_pushdown: Push down qualifiers as scankeys when using Hypercore TAM

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
svenklemm added a commit that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* #7656 Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* #7600 Fix lock order when dropping index
* #7637 Allow EXPLAIN in read-only mode
* #7645 Fix DELETE on compressed chunk with non-btree operators
* #7649 Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* #7653 Push down orderby scankeys to Hypercore TAM
* #7665 Block merging of frozen chunks
* #7673 Don't abort additional INSERTs when hitting first conflict

**GUCs**
* enable_hypercore_scankey_pushdown: Push down qualifiers as scankeys when using Hypercore TAM

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* [timescale#7656](timescale#7656) Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* [timescale#7600](timescale#7600) Fix lock order when dropping index
* [timescale#7637](timescale#7637) Allow EXPLAIN in read-only mode
* [timescale#7645](timescale#7645) Fix DELETE on compressed chunk with non-btree operators
* [timescale#7649](timescale#7649) Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* [timescale#7653](timescale#7653) Push down orderby scankeys to Hypercore TAM
* [timescale#7665](timescale#7665) Block merging of frozen chunks
* [timescale#7673](timescale#7673) Don't abort additional INSERTs when hitting first conflict

**GUCs**
* `enable_hypercore_scankey_pushdown`: Push down qualifiers as scankeys when using Hypercore TAM introduced with [timescale#7653](timescale#7653)

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
@svenklemm svenklemm mentioned this pull request Feb 10, 2025
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* [timescale#7656](timescale#7656) Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* [timescale#7600](timescale#7600) Fix lock order when dropping index
* [timescale#7637](timescale#7637) Allow EXPLAIN in read-only mode
* [timescale#7645](timescale#7645) Fix DELETE on compressed chunk with non-btree operators
* [timescale#7649](timescale#7649) Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* [timescale#7653](timescale#7653) Push down orderby scankeys to Hypercore TAM
* [timescale#7665](timescale#7665) Block merging of frozen chunks
* [timescale#7673](timescale#7673) Don't abort additional INSERTs when hitting first conflict

**GUCs**
* `enable_hypercore_scankey_pushdown`: Push down qualifiers as scankeys when using Hypercore TAM introduced with [timescale#7653](timescale#7653)

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* [timescale#7656](timescale#7656) Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* [timescale#7600](timescale#7600) Fix lock order when dropping index
* [timescale#7637](timescale#7637) Allow EXPLAIN in read-only mode
* [timescale#7645](timescale#7645) Fix DELETE on compressed chunk with non-btree operators
* [timescale#7649](timescale#7649) Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* [timescale#7653](timescale#7653) Push down orderby scankeys to Hypercore TAM
* [timescale#7665](timescale#7665) Block merging of frozen chunks
* [timescale#7673](timescale#7673) Don't abort additional INSERTs when hitting first conflict

**GUCs**
* `enable_hypercore_scankey_pushdown`: Push down qualifiers as scankeys when using Hypercore TAM introduced with [timescale#7653](timescale#7653)

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Feb 10, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* [timescale#7656](timescale#7656) Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* [timescale#7600](timescale#7600) Fix lock order when dropping index
* [timescale#7637](timescale#7637) Allow EXPLAIN in read-only mode
* [timescale#7645](timescale#7645) Fix DELETE on compressed chunk with non-btree operators
* [timescale#7649](timescale#7649) Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* [timescale#7653](timescale#7653) Push down orderby scankeys to Hypercore TAM
* [timescale#7665](timescale#7665) Block merging of frozen chunks
* [timescale#7673](timescale#7673) Don't abort additional INSERTs when hitting first conflict

**GUCs**
* `enable_hypercore_scankey_pushdown`: Push down qualifiers as scankeys when using Hypercore TAM introduced with [timescale#7653](timescale#7653)

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
svenklemm added a commit that referenced this pull request Feb 11, 2025
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* [#7656](#7656) Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* [#7600](#7600) Fix lock order when dropping index
* [#7637](#7637) Allow EXPLAIN in read-only mode
* [#7645](#7645) Fix DELETE on compressed chunk with non-btree operators
* [#7649](#7649) Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* [#7653](#7653) Push down orderby scankeys to Hypercore TAM
* [#7665](#7665) Block merging of frozen chunks
* [#7673](#7673) Don't abort additional INSERTs when hitting first conflict

**GUCs**
* `enable_hypercore_scankey_pushdown`: Push down qualifiers as scankeys when using Hypercore TAM introduced with [#7653](#7653)

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
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.

[Bug]: DELETE from compressed chunks does not apply query constraints
4 participants