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
Compression job running after inserting data fails #3656
Comments
The error is reported from inside
Inside the procedure
So, we pop the active snapshot, potentially leaving no snapshot at all, and then commit the transaction and start a new one. I wonder if we should have a |
Attaching a debugger to
|
When compression is running, `init_toast_snapshot` require an active snapshot to work. This function is, among other locations, called from `heap_prepare_insert` and `heap_update` when it is necessary to toast the tuple. Starting a new transaction without a snapshot will fail with the error "cannot fetch toast data without an active snapshot". This commit avoids the problem by pushing an active snapshot after starting a transaction in the compress and recompress policy routines. Fixes timescale#3656
When compression is running, `init_toast_snapshot` require an active snapshot to work. This function is, among other locations, called from `heap_prepare_insert` and `heap_update` when it is necessary to toast the tuple. Starting a new transaction without a snapshot will fail with the error "cannot fetch toast data without an active snapshot". This commit avoids the problem by pushing an active snapshot after starting a transaction in the compress and recompress policy routines. Fixes timescale#3656
This PR removes the C code that executes the compression policy. Instead we use a PL/pgSQL procedure to execute the policy. PG13.4 and PG12.8 introduced some changes that require PortalContexts while executing transactions. The compression policy procedure compresses chunks in multiple transactions. We have seen some issues with snapshots and portal management in the policy code (due to the PG13.4 code changes). SPI API has transaction-portal management code. However, the compression policy code does not use SPI interfaces. But it is fairly easy to just convert this into a PL/pgSQL procedure (which calls SPI) rather than replicating portal managment code in C to manage multiple txns in the compression policy. This PR also disallows decompress_chunk, compress_chunk and recompress_chunk in txn read only mode. Fixes timescale#3656
This PR removes the C code that executes the compression policy. Instead we use a PL/pgSQL procedure to execute the policy. PG13.4 and PG12.8 introduced some changes that require PortalContexts while executing transactions. The compression policy procedure compresses chunks in multiple transactions. We have seen some issues with snapshots and portal management in the policy code (due to the PG13.4 code changes). SPI API has transaction-portal management code. However, the compression policy code does not use SPI interfaces. But it is fairly easy to just convert this into a PL/pgSQL procedure (which calls SPI) rather than replicating portal managment code in C to manage multiple txns in the compression policy. This PR also disallows decompress_chunk, compress_chunk and recompress_chunk in txn read only mode. Fixes timescale#3656
This PR removes the C code that executes the compression policy. Instead we use a PL/pgSQL procedure to execute the policy. PG13.4 and PG12.8 introduced some changes that require PortalContexts while executing transactions. The compression policy procedure compresses chunks in multiple transactions. We have seen some issues with snapshots and portal management in the policy code (due to the PG13.4 code changes). SPI API has transaction-portal management code. However, the compression policy code does not use SPI interfaces. But it is fairly easy to just convert this into a PL/pgSQL procedure (which calls SPI) rather than replicating portal managment code in C to manage multiple txns in the compression policy. This PR also disallows decompress_chunk, compress_chunk and recompress_chunk in txn read only mode. Fixes timescale#3656
Adding here for completeness, a segfault also occurs on CALL run_job in some cases: For example, after some drop_chunk, reinsert into compressed chunk and logging out and logging again, the test service was segfaulting (not necessary that this order has to be followed) , and here's the backtrace:
|
Relevant system information:
OS: [e.g. Ubuntu 16.04, Windows 10 x64, etc]: Docker / timescale/timescaledb:2.4.2-pg13
PostgreSQL version (output of postgres --version): 13.4
TimescaleDB version (output of \dx in psql): 2.4.2
Installation method: [e.g., "using Docker", "apt install", "source"] : "Using Docker"
Describe the bug
Calling run_job(compression_job_id) fails with the error "ERROR: cannot fetch toast data without an active snapshot"
if there were inserts into the compressed chunks.
To Reproduce
Expected behavior
The job should run and compress the chunks.
Actual behavior
The job fails to run if called manually using 'CALL run_job'.
The text was updated successfully, but these errors were encountered: