Re: GiST VACUUM
x4mmm@yandex-team.ru
From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Michael Paquier <michael@paquier.xyz>, Thomas Munro <thomas.munro@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Костя Кузнецов <chapaev28@ya.ru>
Date: 2019-06-25T09:38:43Z
Lists: pgsql-hackers
Hi! Thanks for clarification, now I understand these patches better. > 25 июня 2019 г., в 13:10, Heikki Linnakangas <hlinnaka@iki.fi> написал(а): > >> Also, I did not understand this optimization: >> + /* >> + * We can skip this if the page was deleted so long ago, that no scan can possibly >> + * still see it, even in a standby. One measure might be anything older than the >> + * table's frozen-xid, but we don't have that at hand here. But anything older than >> + * 2 billion, from the next XID, is surely old enough, because you would hit XID >> + * wraparound at that point. >> + */ >> + nextxid = ReadNextFullTransactionId(); >> + diff = U64FromFullTransactionId(nextxid) - U64FromFullTransactionId(latestRemovedXid); >> + if (diff < 0x7fffffff) >> + return; >> Standby can be lagging months from primary, and, theoretically, close >> the gap in one sudden WAL leap... > It would still process the WAL one WAL record at a time, even if it's lagging months behind. It can't just jump over 2 billion XIDs. I feel a little uncomfortable with number 0x7fffffff right in code. Thanks! Best regards, Andrey Borodin.
Commits
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- fb5344c969af 12.0 landed
- 6655a7299d83 13.0 landed
-
Refactor checks for deleted GiST pages.
- e2e992c93145 12.0 landed
- 9eb5607e6993 13.0 landed
-
Delete empty pages during GiST VACUUM.
- 7df159a620b7 12.0 landed
-
Scan GiST indexes in physical order during VACUUM.
- fe280694d0d4 12.0 landed
-
Prevent GIN deleted pages from being reclaimed too early
- 52ac6cd2d0cd 12.0 cited