mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Don't throw a warning if vacuum sees PD_ALL_VISIBLE flag set on a page that
contains newly-inserted tuples that according to our OldestXmin are not yet visible to everyone. The value returned by GetOldestXmin() is conservative, and it can move backwards on repeated calls, so if we see that contradiction between the PD_ALL_VISIBLE flag and status of tuples on the page, we have to assume it's because an earlier vacuum calculated a higher OldestXmin value, and all the tuples really are visible to everyone. We have received several reports of this bug, with the "PD_ALL_VISIBLE flag was incorrectly set in relation ..." warning appearing in logs. We were finally able to hunt it down with David Gould's help to run extra diagnostics in an environment where this happened frequently. Also reword the warning, per Robert Haas' suggestion, to not imply that the PD_ALL_VISIBLE flag is necessarily at fault, as it might also be a symptom of corruption on a tuple header. Backpatch to 8.4, where the PD_ALL_VISIBLE flag was introduced.
This commit is contained in:
@ -578,6 +578,18 @@ TransactionIdIsActive(TransactionId xid)
|
||||
* This is also used to determine where to truncate pg_subtrans. allDbs
|
||||
* must be TRUE for that case, and ignoreVacuum FALSE.
|
||||
*
|
||||
* Note: it's possible for the calculated value to move backwards on repeated
|
||||
* calls. The calculated value is conservative, so that anything older is
|
||||
* definitely not considered as running by anyone anymore, but the exact
|
||||
* value calculated depends on a number of things. For example, if allDbs is
|
||||
* TRUE and there are no transactions running in the current database,
|
||||
* GetOldestXmin() returns latestCompletedXid. If a transaction begins after
|
||||
* that, its xmin will include in-progress transactions in other databases
|
||||
* that started earlier, so another call will return an lower value. The
|
||||
* return value is also adjusted with vacuum_defer_cleanup_age, so increasing
|
||||
* that setting on the fly is an easy way to have GetOldestXmin() move
|
||||
* backwards.
|
||||
*
|
||||
* Note: we include all currently running xids in the set of considered xids.
|
||||
* This ensures that if a just-started xact has not yet set its snapshot,
|
||||
* when it does set the snapshot it cannot set xmin less than what we compute.
|
||||
|
Reference in New Issue
Block a user