-
Notifications
You must be signed in to change notification settings - Fork 879
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 handling for multiple unique index in compressed INSERT #7061
Fix handling for multiple unique index in compressed INSERT #7061
Conversation
99aa76b
to
2c59e76
Compare
tsl/src/compression/compression.c
Outdated
} | ||
index_close(indexDesc, AccessShareLock); | ||
|
||
if (first_iteration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (first_iteration) | |
if (!shared_attrs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that wouldnt handle the case when we have non-intersecting indexes resetting shared_atts
2c59e76
to
5bf3a41
Compare
* | ||
* This is based on RelationGetIndexAttrBitmap from postgres with changes | ||
* to also track unique expression indexes. | ||
* In case of multiple unique indexes we have to return the shared columns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to understand this better: we only use one index for decompression, so it means we have to decompress all batches that match by shared columns, and we can't add a filter on the other columns, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is columns we can safely use for filtering the batches in INSERT to satisfy the UNIQUE checks. The check is based on the unique indexes defined on the uncompressed chunk. These columns might be indexed on the compressed because they are segmentby or have metadata and we can filter on them even if we dont have corresponding compressed index.
1698911
to
76f8912
Compare
adac3fb
to
e575c4c
Compare
Adjust compressed_insert_key_columns to correctly handle multiple unique indexes. This patch changes the function to no longer combine the columns from multiple indexes but instead only return intersecting columns from all the unique indexes. This patch also fixes a couple comments in that function.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7061 +/- ##
==========================================
+ Coverage 80.06% 81.75% +1.68%
==========================================
Files 190 200 +10
Lines 37181 37298 +117
Branches 9450 9725 +275
==========================================
+ Hits 29770 30493 +723
+ Misses 2997 2897 -100
+ Partials 4414 3908 -506 ☔ View full report in Codecov by Sentry. |
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT **Thanks**
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT **Thanks**
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT * timescale#7080 Fix `corresponding equivalence member not found` error **Thanks**
This release contains bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Migrating from self-hosted TimescaleDB v2.14.x and earlier** After you run `ALTER EXTENSION`, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull request [timescale#6797](timescale#6797). If you are migrating from TimescaleDB v2.15.0, v2.15.1 or v2.15.2, no changes are required. **Bugfixes** * timescale#7061: Fix handling of multiple unique indexes in compressed INSERT. * timescale#7080: Fix `corresponding equivalence member not found` error.
This release contains bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Migrating from self-hosted TimescaleDB v2.14.x and earlier** After you run `ALTER EXTENSION`, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull request [timescale#6797](timescale#6797). If you are migrating from TimescaleDB v2.15.0, v2.15.1 or v2.15.2, no changes are required. **Bugfixes** * timescale#7061: Fix handling of multiple unique indexes in compressed INSERT. * timescale#7080: Fix `corresponding equivalence member not found` error.
This release contains bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Migrating from self-hosted TimescaleDB v2.14.x and earlier** After you run `ALTER EXTENSION`, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull request [#6797](#6797). If you are migrating from TimescaleDB v2.15.0, v2.15.1 or v2.15.2, no changes are required. **Bugfixes** * #7061: Fix the handling of multiple unique indexes in a compressed INSERT. * #7080: Fix the `corresponding equivalence member not found` error. * #7088: Fix the leaks in the DML functions. * #7035: Fix the error when acquiring a tuple lock on the OSM chunks on the replica. **Thanks** * @Kazmirchuk for reporting the issue about leaks with the functions in DML.
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT * timescale#7080 Fix `corresponding equivalence member not found` error * timescale#7088 Fix leaks with functions in DML **Thanks** * @Kazmirchuk for reporting this
This release contains performance improvements and bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Features** **Bugfixes** * timescale#7061 Fix handling of multiple unique indexes in compressed INSERT * timescale#7080 Fix `corresponding equivalence member not found` error * timescale#7088 Fix leaks with functions in DML **Thanks** * @Kazmirchuk for reporting this
This release contains bug fixes since the 2.15.2 release. Best practice is to upgrade at the next available opportunity. **Migrating from self-hosted TimescaleDB v2.14.x and earlier** After you run `ALTER EXTENSION`, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull request [#6797](#6797). If you are migrating from TimescaleDB v2.15.0, v2.15.1 or v2.15.2, no changes are required. **Bugfixes** * #7061: Fix the handling of multiple unique indexes in a compressed INSERT. * #7080: Fix the `corresponding equivalence member not found` error. * #7088: Fix the leaks in the DML functions. * #7035: Fix the error when acquiring a tuple lock on the OSM chunks on the replica. * #7091: Fix ORDER BY/GROUP BY expression not found in targetlist on PG16 **Thanks** * @Kazmirchuk for reporting the issue about leaks with the functions in DML. --------- Signed-off-by: Sven Klemm <31455525+svenklemm@users.noreply.github.com> Co-authored-by: Sven Klemm <31455525+svenklemm@users.noreply.github.com>
Adjust compressed_insert_key_columns to correctly handle multiple
unique indexes. This patch changes the function to no longer combine
the columns from multiple indexes but instead only return intersecting
columns from all the unique indexes.
This patch also fixes a couple comments in that function.
Disable-check: commit-count