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

Columnar: fix wraparound bug. #5962

Merged
merged 1 commit into from
May 25, 2022
Merged

Columnar: fix wraparound bug. #5962

merged 1 commit into from
May 25, 2022

Conversation

jeff-davis
Copy link
Contributor

@jeff-davis jeff-davis commented May 20, 2022

columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

DESCRIPTION: Fix columnar freezing/wraparound bug.

@jeff-davis jeff-davis force-pushed the columnar-fix-wraparound branch 2 times, most recently from 1fb9e72 to c15c8a2 Compare May 20, 2022 22:07
@jeff-davis jeff-davis requested a review from thanodnl May 20, 2022 22:09
@codecov
Copy link

codecov bot commented May 20, 2022

Codecov Report

Merging #5962 (bc528ee) into master (86781ec) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head bc528ee differs from pull request most recent head a2a947c. Consider uploading reports for the commit a2a947c to get more accurate results

@@            Coverage Diff             @@
##           master    #5962      +/-   ##
==========================================
- Coverage   92.58%   92.58%   -0.01%     
==========================================
  Files         237      237              
  Lines       48102    48108       +6     
==========================================
+ Hits        44536    44540       +4     
- Misses       3566     3568       +2     

@jeff-davis jeff-davis force-pushed the columnar-fix-wraparound branch from c15c8a2 to fb22e91 Compare May 20, 2022 22:30
Comment on lines 1101 to 1104
vac_open_indexes(rel, RowExclusiveLock, &nindexes, &indrels);
vac_close_indexes(nindexes, indrels, NoLock);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do someting with indRels ? Since this code currently just opens and closes those indexes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vac_open_indexes seems() to be skipping invalid indexes, so might be nice to add a test where we vacuum a relation that has an invalid index ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to use RelationGetIndexList() instead, which is lighter-weight.

It doesn't look like it's skipping indexes where !indisvalid... the comment over vac_open_indexes() says:

 * We consider an index vacuumable if it is marked insertable (indisready).                                                
 * If it isn't, probably a CREATE INDEX CONCURRENTLY command failed early in                                               
 * execution, and what we have is too corrupt to be processable.  We will                                                  
 * vacuum even if the index isn't indisvalid; this is important because in a                                               
 * unique index, uniqueness checks will be performed anyway and had better not                                             
 * hit dangling index pointers.                                                                                            

If you mean try to test the case where !indisready, that seems like overkill, unless there's a case I'm missing.

vac_update_relstats(rel, new_rel_pages, new_live_tuples,
new_rel_allvisible, nindexes > 0,
newRelFrozenXid, newRelminMxid, false);
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we call pgstat_report_vacuum at some point ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done.

We could also improve the logging/instrumentation output, but I'll leave that for another PR.

@jeff-davis jeff-davis force-pushed the columnar-fix-wraparound branch from fb22e91 to bc528ee Compare May 23, 2022 22:51
@jeff-davis jeff-davis requested a review from onurctirtir May 23, 2022 22:51
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
@jeff-davis jeff-davis force-pushed the columnar-fix-wraparound branch from bc528ee to a2a947c Compare May 25, 2022 14:41
@jeff-davis jeff-davis merged commit 74ce210 into master May 25, 2022
@jeff-davis jeff-davis deleted the columnar-fix-wraparound branch May 25, 2022 14:50
jeff-davis added a commit that referenced this pull request May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this pull request May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this pull request May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this pull request May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this pull request May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this pull request May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
@metdos metdos added this to the 11.0 Release milestone May 30, 2022
jeff-davis added a commit that referenced this pull request May 31, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this pull request May 31, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Columnar: vacuum freeze does not advance relfrozenxid
3 participants