pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix undercounting in VACUUM VERBOSE output. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix undercounting in VACUUM VERBOSE output. @ 2020-05-01 16:51 Peter Geoghegan <pg@bowt.ie> 0 siblings, 0 replies; 3+ messages in thread From: Peter Geoghegan @ 2020-05-01 16:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix undercounting in VACUUM VERBOSE output. The logic for determining how many nbtree pages in an index are deleted pages sometimes undercounted pages. Pages that were deleted by the current VACUUM operation (as opposed to some previous VACUUM operation whose deleted pages have yet to be reused) were sometimes overlooked. The final count is exposed to users through VACUUM VERBOSE's "%u index pages have been deleted" output. btvacuumpage() avoided double-counting when _bt_pagedel() deleted more than one page by assuming that only one page was deleted, and that the additional deleted pages would get picked up during a future call to btvacuumpage() by the same VACUUM operation. _bt_pagedel() can legitimately delete pages that the btvacuumscan() scan will not visit again, though, so that assumption was slightly faulty. Fix the accounting by teaching _bt_pagedel() about its caller's requirements. It now only reports on pages that it knows btvacuumscan() won't visit again (including the current btvacuumpage() page), so everything works out in the end. This bug has been around forever. Only backpatch to v11, though, to keep _bt_pagedel() is sync on the branches that have today's bugfix commit b0229f26da. Note that this commit changes the signature of _bt_pagedel(), just like commit b0229f26da. Author: Peter Geoghegan Reviewed-By: Masahiko Sawada Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com Backpatch: 11- Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/73a076b03f1cf0761329ace55ec3601d47f04075 Modified Files -------------- src/backend/access/nbtree/nbtpage.c | 40 +++++++++++++++++++++++++++---------- src/backend/access/nbtree/nbtree.c | 12 +++++------ src/include/access/nbtree.h | 4 ++-- 3 files changed, 38 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix undercounting in VACUUM VERBOSE output. @ 2020-05-01 16:51 Peter Geoghegan <pg@bowt.ie> 0 siblings, 0 replies; 3+ messages in thread From: Peter Geoghegan @ 2020-05-01 16:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix undercounting in VACUUM VERBOSE output. The logic for determining how many nbtree pages in an index are deleted pages sometimes undercounted pages. Pages that were deleted by the current VACUUM operation (as opposed to some previous VACUUM operation whose deleted pages have yet to be reused) were sometimes overlooked. The final count is exposed to users through VACUUM VERBOSE's "%u index pages have been deleted" output. btvacuumpage() avoided double-counting when _bt_pagedel() deleted more than one page by assuming that only one page was deleted, and that the additional deleted pages would get picked up during a future call to btvacuumpage() by the same VACUUM operation. _bt_pagedel() can legitimately delete pages that the btvacuumscan() scan will not visit again, though, so that assumption was slightly faulty. Fix the accounting by teaching _bt_pagedel() about its caller's requirements. It now only reports on pages that it knows btvacuumscan() won't visit again (including the current btvacuumpage() page), so everything works out in the end. This bug has been around forever. Only backpatch to v11, though, to keep _bt_pagedel() is sync on the branches that have today's bugfix commit b0229f26da. Note that this commit changes the signature of _bt_pagedel(), just like commit b0229f26da. Author: Peter Geoghegan Reviewed-By: Masahiko Sawada Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com Backpatch: 11- Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/40708eaaf3fd8536c245e1131e892ddbd9029218 Modified Files -------------- src/backend/access/nbtree/nbtpage.c | 40 +++++++++++++++++++++++++++---------- src/backend/access/nbtree/nbtree.c | 12 +++++------ src/include/access/nbtree.h | 4 ++-- 3 files changed, 38 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix undercounting in VACUUM VERBOSE output. @ 2020-05-01 16:51 Peter Geoghegan <pg@bowt.ie> 0 siblings, 0 replies; 3+ messages in thread From: Peter Geoghegan @ 2020-05-01 16:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix undercounting in VACUUM VERBOSE output. The logic for determining how many nbtree pages in an index are deleted pages sometimes undercounted pages. Pages that were deleted by the current VACUUM operation (as opposed to some previous VACUUM operation whose deleted pages have yet to be reused) were sometimes overlooked. The final count is exposed to users through VACUUM VERBOSE's "%u index pages have been deleted" output. btvacuumpage() avoided double-counting when _bt_pagedel() deleted more than one page by assuming that only one page was deleted, and that the additional deleted pages would get picked up during a future call to btvacuumpage() by the same VACUUM operation. _bt_pagedel() can legitimately delete pages that the btvacuumscan() scan will not visit again, though, so that assumption was slightly faulty. Fix the accounting by teaching _bt_pagedel() about its caller's requirements. It now only reports on pages that it knows btvacuumscan() won't visit again (including the current btvacuumpage() page), so everything works out in the end. This bug has been around forever. Only backpatch to v11, though, to keep _bt_pagedel() is sync on the branches that have today's bugfix commit b0229f26da. Note that this commit changes the signature of _bt_pagedel(), just like commit b0229f26da. Author: Peter Geoghegan Reviewed-By: Masahiko Sawada Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com Backpatch: 11- Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d3944c364f32e0087088328145c6421cf24e7905 Modified Files -------------- src/backend/access/nbtree/nbtpage.c | 39 +++++++++++++++++++++++++++---------- src/backend/access/nbtree/nbtree.c | 12 ++++++------ src/include/access/nbtree.h | 4 ++-- 3 files changed, 37 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-05-01 16:51 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-05-01 16:51 pgsql: Fix undercounting in VACUUM VERBOSE output. Peter Geoghegan <pg@bowt.ie> 2020-05-01 16:51 pgsql: Fix undercounting in VACUUM VERBOSE output. Peter Geoghegan <pg@bowt.ie> 2020-05-01 16:51 pgsql: Fix undercounting in VACUUM VERBOSE output. Peter Geoghegan <pg@bowt.ie>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox