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 corresponding equivalence member not found #7080

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

svenklemm
Copy link
Member

@svenklemm svenklemm commented Jun 29, 2024

When querying compressed data we determine whether the requested ORDER
can be applied to the underlying query on the compressed data itself.
This happens twice. The first time we decide whether we can push down
the sort and then we do a recheck when we setup the sort metadata.
Unfortunately those two checks did not agree. The initial check concluded
it is possible but the recheck disagreed. This was due to a bug when
checking the query properties we mixed up the attnos and used attnos
from uncompressed chunk and compressed chunk in the same bitmapset.
If a segmentby column with equality constraint was present in the WHERE
clause whose attno was identical to a compressed attno of a different
column that was part of the ORDER BY the recheck would fail.

This patch removes the recheck and relies on the initial assesment
when building sort metadata.

@svenklemm svenklemm requested a review from akuzm June 29, 2024 14:25
@svenklemm svenklemm self-assigned this Jun 29, 2024
@svenklemm svenklemm added the bug label Jun 29, 2024
@svenklemm svenklemm added this to the TimescaleDB 2.15.3 milestone Jun 29, 2024
Copy link

codecov bot commented Jun 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.77%. Comparing base (59f50f2) to head (c3417a4).
Report is 233 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7080      +/-   ##
==========================================
+ Coverage   80.06%   81.77%   +1.70%     
==========================================
  Files         190      200      +10     
  Lines       37181    37349     +168     
  Branches     9450     9743     +293     
==========================================
+ Hits        29770    30541     +771     
+ Misses       2997     2894     -103     
+ Partials     4414     3914     -500     

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

@svenklemm svenklemm force-pushed the corresponding_em branch 2 times, most recently from b3cb046 to 9814491 Compare June 29, 2024 14:39
@svenklemm svenklemm force-pushed the corresponding_em branch 2 times, most recently from d0c9993 to df24164 Compare June 29, 2024 14:42
When querying compressed data we determine whether the requested ORDER
can be applied to the underlying query on the compressed data itself.
This happens twice. The first time we decide whether we can push down
the sort and then we do a recheck when we setup the sort metadata.
Unfortunately those two checks did not agree. The initial check concluded
it is possible but the recheck disagreed.  This was due to a bug when
checking the query properties we mixed up the attnos and used attnos
from uncompressed chunk and compressed chunk in the same bitmapset.
If a segmentby column with equality constraint was present in the WHERE
clause whose attno was identical to a compressed attno of a different
column that was part of the ORDER BY the recheck would fail.

This patch removes the recheck and relies on the initial assesment
when building sort metadata.
@svenklemm svenklemm merged commit 1b7f109 into timescale:main Jul 1, 2024
41 checks passed
pallavisontakke added a commit to pallavisontakke/timescaledb that referenced this pull request Jul 2, 2024
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**
@pallavisontakke pallavisontakke mentioned this pull request Jul 2, 2024
pallavisontakke added a commit to pallavisontakke/timescaledb that referenced this pull request Jul 2, 2024
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.
@pallavisontakke pallavisontakke mentioned this pull request Jul 2, 2024
pallavisontakke added a commit to pallavisontakke/timescaledb that referenced this pull request Jul 2, 2024
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.
pallavisontakke added a commit that referenced this pull request Jul 2, 2024
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.
pallavisontakke added a commit to pallavisontakke/timescaledb that referenced this pull request Jul 2, 2024
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
@pallavisontakke pallavisontakke mentioned this pull request Jul 2, 2024
svenklemm pushed a commit to pallavisontakke/timescaledb that referenced this pull request Jul 2, 2024
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
svenklemm added a commit that referenced this pull request Jul 2, 2024
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>
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.

4 participants