mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Don't clear btpo_cycleid during _bt_vacuum_one_page.
When "vacuuming" a single btree page by removing LP_DEAD tuples, we are not
actually within a vacuum operation, but rather in an ordinary insertion
process that could well be running concurrently with a vacuum. So clearing
the cycleid is incorrect, and could cause the concurrent vacuum to miss
removing tuples that it needs to remove. This is a longstanding bug
introduced by commit e6284649b9
of
2006-07-25. I believe it explains Maxim Boguk's recent report of index
corruption, and probably some other previously unexplained reports.
In 9.0 and up this is a one-line fix; before that we need to introduce a
flag to tell _bt_delitems what to do.
This commit is contained in:
@@ -889,7 +889,7 @@ restart:
|
||||
*/
|
||||
if (ndeletable > 0)
|
||||
{
|
||||
_bt_delitems(rel, buf, deletable, ndeletable);
|
||||
_bt_delitems(rel, buf, deletable, ndeletable, true);
|
||||
stats->tuples_removed += ndeletable;
|
||||
/* must recompute maxoff */
|
||||
maxoff = PageGetMaxOffsetNumber(page);
|
||||
|
Reference in New Issue
Block a user