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

Ensure compression policy has a snapshot #3649

Closed
wants to merge 2 commits into from

Conversation

mkindahl
Copy link
Contributor

@mkindahl mkindahl commented Oct 5, 2021

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 #3656

@codecov
Copy link

codecov bot commented Oct 5, 2021

Codecov Report

Merging #3649 (3fb27a2) into master (98f4cd6) will decrease coverage by 0.02%.
The diff coverage is 97.91%.

❗ Current head 3fb27a2 differs from pull request most recent head 2c4f049. Consider uploading reports for the commit 2c4f049 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3649      +/-   ##
==========================================
- Coverage   90.80%   90.77%   -0.03%     
==========================================
  Files         212      212              
  Lines       36528    36539      +11     
==========================================
+ Hits        33168    33169       +1     
- Misses       3360     3370      +10     
Impacted Files Coverage Δ
src/guc.c 100.00% <ø> (ø)
src/import/allpaths.c 80.99% <ø> (ø)
src/nodes/chunk_dispatch_plan.c 100.00% <ø> (ø)
src/nodes/chunk_insert_state.c 97.76% <ø> (ø)
tsl/src/debug.c 40.21% <ø> (ø)
src/nodes/hypertable_insert.c 96.25% <93.75%> (-0.14%) ⬇️
src/copy.c 90.40% <100.00%> (ø)
src/hypertable.c 88.02% <100.00%> (ø)
src/nodes/chunk_dispatch.c 98.21% <100.00%> (ø)
src/nodes/chunk_dispatch_state.c 93.24% <100.00%> (+0.09%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55840eb...2c4f049. Read the comment docs.

@mkindahl mkindahl self-assigned this Oct 5, 2021
@mkindahl mkindahl changed the title Ensure compression has a snapshot Ensure compression policy has a snapshot Oct 6, 2021
@mkindahl mkindahl force-pushed the compress-job-use-snapshot branch 2 times, most recently from 98ee770 to de8f735 Compare October 6, 2021 13:10
Make sure that the compression job works correctly after inserting data
into a compressed table.
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
@mkindahl mkindahl marked this pull request as ready for review October 6, 2021 13:12
@mkindahl mkindahl requested a review from a team as a code owner October 6, 2021 13:12
@mkindahl mkindahl requested review from berkley, svenklemm, duncan-tsdb and gayyappan and removed request for a team and berkley October 6, 2021 13:12
@mkindahl
Copy link
Contributor Author

Closing in favor of #3667

@mkindahl mkindahl closed this Oct 13, 2021
@mkindahl mkindahl deleted the compress-job-use-snapshot branch October 13, 2021 13:27
@NunoFilipeSantos NunoFilipeSantos added this to the TimescaleDB 2.5 milestone Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compression job running after inserting data fails
2 participants