-
Notifications
You must be signed in to change notification settings - Fork 899
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]: Before Update trigger on hypertable make updates fail #6858
Comments
Thanks for the detailed repro script! I'm looking into this, will let you know when I have something. |
Oh, we forgot to mention something: Dumping the data in |
Yeah, I have narrowed down the issue and will be making a PR containing the fix. Thanks for the report! |
That's good news! Thanks @antekresic! Meanwhile you are working on it, can you give some summarised explanation of the root cause and if you have any suggestion of a workaround, if possible. I guess you will include this info on the PR description when you finish, so please link the PR with this issue. Do you have an ETA? and in which release you think the fix can be included? For now, the only we can think is to disable the update trigger and handle the synchronisation of the |
This release contains bug fixes since the 2.15.0 release. We recommend that you upgrade at the next available opportunity. **Bugfixes** * timescale#6540 Segmentation fault when backfilling data with COPY into a compressed chunk * timescale#6858 Before update trigger not working correctly * timescale#6908 Fix gapfill with timezone behaviour around dst switches * timescale#6911 Fix dropped chunk metadata removal in update script * timescale#6940 Fix `pg_upgrade` failure by removing `regprocedure` from catalog table * timescale#6957 Fix segfault in UNION queries with ordering on compressed chunks **Thanks** * @DiAifU, @kiddhombre and @intermittentnrg for reporting issues with gapfill and daylight saving time * @edgarzamora for reporting issue with update triggers * @hongquan for reporting an issue with the update script * @iliastsa and @SystemParadox for reporting an issue with COPY into a compressed chunk
the 2.14.2 release. We recommend that you upgrade at the next available opportunity. **Bugfixes** * timescale#6540 Segmentation fault when backfilling data with COPY into a compressed chunk * timescale#6858 Before update trigger not working correctly * timescale#6908 Fix gapfill with timezone behaviour around dst switches * timescale#6911 Fix dropped chunk metadata removal in update script * timescale#6940 Fix `pg_upgrade` failure by removing `regprocedure` from catalog table * timescale#6957 Fix segfault in UNION queries with ordering on compressed chunks **Thanks** * @DiAifU, @kiddhombre and @intermittentnrg for reporting issues with gapfill and daylight saving time * @edgarzamora for reporting issue with update triggers * @hongquan for reporting an issue with the update script * @iliastsa and @SystemParadox for reporting an issue with COPY into a compressed chunk
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, no changes are required. **Bugfixes** * #6540: Segmentation fault when you backfill data using COPY into a compressed chunk. * #6858: `BEFORE UPDATE` trigger not working correctly. * #6908: Fix `time_bucket_gapfill()` with timezone behaviour around daylight savings time (DST) switches. * #6911: Fix dropped chunk metadata removal in the update script. * #6940: Fix `pg_upgrade` failure by removing `regprocedure` from the catalog table. * #6957: Fix the `segfault` in UNION queries that contain ordering on compressed chunks. **Thanks** * @DiAifU, @kiddhombre and @intermittentnrg for reporting the issues with gapfill and daylight saving time. * @edgarzamora for reporting the issue with update triggers. * @hongquan for reporting the issue with the update script. * @iliastsa and @SystemParadox for reporting the issue with COPY into a compressed chunk.
This release contains bug fixes since the 2.15.0 release. We recommend that you upgrade at the next available opportunity. **Bugfixes** * timescale#6540 Segmentation fault when backfilling data with COPY into a compressed chunk * timescale#6858 Before update trigger not working correctly * timescale#6908 Fix gapfill with timezone behaviour around dst switches * timescale#6911 Fix dropped chunk metadata removal in update script * timescale#6940 Fix `pg_upgrade` failure by removing `regprocedure` from catalog table * timescale#6957 Fix segfault in UNION queries with ordering on compressed chunks **Thanks** * @DiAifU, @kiddhombre and @intermittentnrg for reporting issues with gapfill and daylight saving time * @edgarzamora for reporting issue with update triggers * @hongquan for reporting an issue with the update script * @iliastsa and @SystemParadox for reporting an issue with COPY into a compressed chunk
This release contains bug fixes since the 2.15.0 release. We recommend that you upgrade at the next available opportunity. **Bugfixes** * #6540 Segmentation fault when backfilling data with COPY into a compressed chunk * #6858 Before update trigger not working correctly * #6908 Fix gapfill with timezone behaviour around dst switches * #6911 Fix dropped chunk metadata removal in update script * #6940 Fix `pg_upgrade` failure by removing `regprocedure` from catalog table * #6957 Fix segfault in UNION queries with ordering on compressed chunks **Thanks** * @DiAifU, @kiddhombre and @intermittentnrg for reporting issues with gapfill and daylight saving time * @edgarzamora for reporting issue with update triggers * @hongquan for reporting an issue with the update script * @iliastsa and @SystemParadox for reporting an issue with COPY into a compressed chunk
What type of bug is this?
Crash, Unexpected error
What subsystems and features are affected?
Query executor
What happened?
We are currently in the process of integrating TimescaleDB into our system, and for the most part, everything has been functioning smoothly. However, we have encountered a bug within our hypertable that appears to be triggered by specific data scenarios, and despite our efforts, we have been unable to pinpoint the root cause.
Since we are not sure about the root cause of it, and the problem does not appear always which makes us think that is a data-dependant issue, we provide here a dump of an small example which consistently reproduces the issue. The dump file is in the next zip: dump_file.zip
The issue revolves around a hypertable containing multiple fields, including a crucial column named
effective_date_time
which serves as our partition key. Additionally, we utilise standard columns such as created_at and modified_at, with the latter being updated whenever modifications occur to ensure data accuracy. To achieve this, we implemented abefore_update
trigger on the hypertable, as illustrated below:Just in case, see here the create trigger command:
Unfortunately, we have recently encountered an error message when attempting updates on this table, specifically:
[2024-04-24 11:15:03] [XX000] ERROR: attempted to lock invisible tuple.
For instance, the update query provided below triggers this error:
Our investigations into this error led us to references such as https://postgrespro.com/list/thread-id/1502244, alluding to its resolution in Postgres version 15. Despite performing maintenance tasks such as VACUUM and REINDEX on the
example_table
table, as well as restarting our Postgres instance, we have been unable to resolve the issue.TimescaleDB version affected
2.14.2
PostgreSQL version used
15.6
What operating system did you use?
Redhat 8 and image timescale/timescaledb:2.14.0-pg15
What installation method did you use?
Docker
What platform did you run on?
Amazon Web Services (AWS), Other
Relevant log output and stack trace
How can we reproduce the bug?
Create an empty database and a user with access right on it and load the dump as following: psql --quiet --username USERNAME --database DATABASE < dump.sql
The dump.sql file content is attached above: dump_file.zip
Then try to run the next query:
The text was updated successfully, but these errors were encountered: