-
Notifications
You must be signed in to change notification settings - Fork 869
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
[Bug]: Upgrade to tsdb 2.15.1 caused selects by partitioned column to return only data after upgrade #6976
Comments
If I try to trick optimizer it works, but does not use index in compressed rows
|
This is a workaround:
|
Hi there, Do you get different query results using your workaround and without it? Just asking because its not clear that you are just by looking at query plans. Space partitioning on host should in theory reduce the amount of chunks you need to query based on the partitioning column filter (host in your case). Can you confirm this? Thanks! |
Yes. Query without workaround returns only data after the timescale upgrade happened. The query without workaround returns all matched data |
Hi again, I've tried reproducing the issue with the data you have provided but had no luck. Would you mind sharing the contents of your dimension, dimension_slice and chunk_constraint catalog tables? It would go a long way into debugging this issue. You can get those like this:
Thanks! |
Output for this table: |
One question here: did you update from 2.14.x to 2.15.1 directly or did you first update to 2.15.0? We had an issue with one of the update scripts for 2.15.0 which might be the culprit here. |
2.15.1 directly
…On Tue, Jun 4, 2024, at 11:05, Ante Kresic wrote:
One question here: did you update from 2.14.x to 2.15.1 directly or did you first update to 2.15.0?
We had an issue with one of the update scripts for 2.15.0 which might be the culprit here.
—
Reply to this email directly, view it on GitHub <#6976 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAASLIMZI5XGPPFCJJ23A4DZFVYLLAVCNFSM6AAAAABIQZXA7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBWHA3TENJTGE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Looks like you have hit a catalog corruption bug in the upgrade process. There is a PR out to fix it but we need to also restore the catalog for your instance in order to get the database in a working order. I'm working on a script to fix the problem and will post it here once it's done. Question: can you run it as a superuser on your environment? That will probably be necessary in order to fix the catalog. |
Yes, I have superuser access |
OK, so I have a couple of queries I would like you to run before we attempt fixing the catalog. This one will show all the chunks that are broken:
And this one will show the catalog entries that need to be inserted:
Can you share the outputs of these queries? Thanks, |
|
|
I'm so sorry, I didn't use your hypertable name. Can we try them again? I've updated the ht names: |
|
|
This release contains performance improvements and bug fixes since the 2.15.0 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 or v2.15.1, no changes are required. **Bugfixes** * timescale#6975: Fix sort pushdown for partially compressed chunks. * timescale#6976: Fix removal of metadata function and update script. * timescale#6978: Fix segfault in compress_chunk with primary space partition. * timescale#6993: Disallow hash partitioning on primary column. **Thanks** * @gugu for reporting the issue with catalog corruption due to update. * @srieding for reporting an issue with partially compressed chunks and ordering on joined columns.
This release contains performance improvements and bug fixes since the 2.15.0 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 or v2.15.1, no changes are required. **Bugfixes** * timescale#6975: Fix sort pushdown for partially compressed chunks. * timescale#6976: Fix removal of metadata function and update script. * timescale#6978: Fix segfault in compress_chunk with primary space partition. * timescale#6993: Disallow hash partitioning on primary column. **Thanks** * @gugu for reporting the issue with catalog corruption due to update. * @srieding for reporting an issue with partially compressed chunks and ordering on joined columns.
This release contains performance improvements and bug fixes since the 2.15.1 release. Best practice is to upgrade at the next available opportunity. **Bugfixes** * timescale#6975: Fix sort pushdown for partially compressed chunks. * timescale#6976: Fix removal of metadata function and the update script. * timescale#6978: Fix segfault in compress_chunk with primary space partition. * timescale#6993: Disallow hash partitioning on the primary column. **Thanks** * @gugu for reporting the issue with catalog corruption due to update. * @srieding for reporting the issue with partially compressed chunks and ordering on joined columns.
This release contains bug fixes since the 2.15.1 release. Best practice is to upgrade at the next available opportunity. **Bugfixes** * #6975: Fix sort pushdown for partially compressed chunks. * #6976: Fix removal of metadata function and the update script. * #6978: Fix segfault in `compress_chunk` with primary space partition. * #6993: Disallow hash partitioning on the primary column. **Thanks** * @gugu for reporting the issue with catalog corruption due to update. * @srieding for reporting the issue with partially compressed chunks and ordering on joined columns.
I see a problem in the second query, I have made a minor tweak. Can we give this a try?
|
|
So it seems like we have a winner. That query should restore your corrupt catalog. You can attempt to fix it by running the following query. BE ADVISED: keeping a fresh backup of the database would be ideal so you can revert back to it if the catalog is still corrupt after the attempted fix. With that said, here is the query which should insert 213 catalog tuples exactly:
Please let me know does it help. Thanks! |
This release contains performance improvements and bug fixes since the 2.15.0 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 or v2.15.1, no changes are required. **Bugfixes** * timescale#6975: Fix sort pushdown for partially compressed chunks. * timescale#6976: Fix removal of metadata function and update script. * timescale#6978: Fix segfault in compress_chunk with primary space partition. * timescale#6993: Disallow hash partitioning on primary column. **Thanks** * @gugu for reporting the issue with catalog corruption due to update. * @srieding for reporting an issue with partially compressed chunks and ordering on joined columns.
This release contains performance improvements and bug fixes since the 2.15.0 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 or v2.15.1, no changes are required. **Bugfixes** * #6975: Fix sort pushdown for partially compressed chunks. * #6976: Fix removal of metadata function and update script. * #6978: Fix segfault in compress_chunk with primary space partition. * #6993: Disallow hash partitioning on primary column. **Thanks** * @gugu for reporting the issue with catalog corruption due to update. * @srieding for reporting an issue with partially compressed chunks and ordering on joined columns.
What type of bug is this?
Incorrect result
What subsystems and features are affected?
Query planner
What happened?
After upgrade timescaledb 2.14 => 2.15.1 it recreated chunks for partitioned table and does not use old chunks if I run a query with filter by partitioned column.
Example:
Table structure:
List of latest chunks:
Dimensions:
TimescaleDB version affected
2.15.1
PostgreSQL version used
14.12
What operating system did you use?
(Ubuntu 14.12-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
What installation method did you use?
Docker
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
How can we reproduce the bug?
The text was updated successfully, but these errors were encountered: