forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0b018fa
committed
Set relfrozenxid to oldest extant XID seen by VACUUM.
When VACUUM set relfrozenxid before now, it set it to whatever value wasused to determine which tuples to freeze -- the FreezeLimit cutoff.This approach was very naive. The relfrozenxid invariant only requiresthat new relfrozenxid values be <= the oldest extant XID remaining inthe table (at the point that the VACUUM operation ends), which ingeneral might be much more recent than FreezeLimit.VACUUM now carefully tracks the oldest remaining XID/MultiXactId as itgoes (the oldest remaining values _after_ lazy_scan_prune processing).The final values are set as the table's new relfrozenxid and newrelminmxid in pg_class at the end of each VACUUM. The oldest XID mightcome from a tuple's xmin, xmax, or xvac fields. It might even come fromone of the table's remaining MultiXacts.Final relfrozenxid values must still be >= FreezeLimit in an aggressiveVACUUM (FreezeLimit still acts as a lower bound on the final value thataggressive VACUUM can set relfrozenxid to). Since standard VACUUMsstill make no guarantees about advancing relfrozenxid, they might aswell set relfrozenxid to a value from well before FreezeLimit when theopportunity presents itself. In general standard VACUUMs may now setrelfrozenxid to any value > the original relfrozenxid and <= OldestXmin.Credit for the general idea of using the oldest extant XID to setpg_class.relfrozenxid at the end of VACUUM goes to Andres Freund.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Andres Freund <andres@anarazel.de>Reviewed-By: Robert Haas <robertmhaas@gmail.com>Discussion:https://postgr.es/m/CAH2-WzkymFbz6D_vL+jmqSn_5q1wsFvFrE+37yLgL_Rkfd6Gzg@mail.gmail.com1 parent05023a2 commit0b018fa
File tree
13 files changed
+717
-305
lines changed- doc/src/sgml
- src
- backend
- access/heap
- commands
- include
- access
- commands
- test/isolation
- expected
- specs
13 files changed
+717
-305
lines changedLines changed: 10 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
586 | 586 |
| |
587 | 587 |
| |
588 | 588 |
| |
589 |
| - | |
590 |
| - | |
591 |
| - | |
592 |
| - | |
593 |
| - | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
594 | 594 |
| |
595 | 595 |
| |
596 | 596 |
| |
| |||
638 | 638 |
| |
639 | 639 |
| |
640 | 640 |
| |
641 |
| - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
642 | 646 |
| |
643 | 647 |
| |
644 | 648 |
| |
|
0 commit comments
Comments
(0)