pg_lake_table: fix vacuum compaction summary logging under autovacuum#437
Open
darshil929 wants to merge 1 commit into
Open
pg_lake_table: fix vacuum compaction summary logging under autovacuum#437darshil929 wants to merge 1 commit into
darshil929 wants to merge 1 commit into
Conversation
Signed-off-by: darshil929 <darshilt.work29@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The compaction summary introduced in #350 runs after the compaction loop has already rotated into a fresh transaction, so no snapshot is active at that point. A backend running manual VACUUM gets away with it because the portal snapshot carries the SPI read, but the autovacuum worker has neither a portal nor an active snapshot, so the catalog query behind the summary fails:
The error only gets caught at the top of the worker loop, so any autovacuum cycle that compacts something loses the summary and duration log lines and skips the remaining vacuum stages and tables for that cycle.
This PR pushes a snapshot around the catalog read so the summary works on both paths. Since the summary line previously reported only the remaining size in bytes, the same catalog query now also returns the number of files and live rows left in the table, completing the totals requested in #40:
Tests: extended the existing summary test with the new totals, and added an autovacuum path test that reads the server log and verifies the summary appears from the worker without the snapshot error.
closes: #40