Re: Spurious "apparent wraparound" via SimpleLruTruncate() rounding
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2021-01-10T09:43:48Z
Lists: pgsql-hackers
Attachments
- slru-truncate-modulo-v6.patch (text/plain) patch v6
- slru-truncate-t-insurance-v5.patch (text/plain) patch v5
On Sun, Jan 10, 2021 at 11:44:14AM +0500, Andrey Borodin wrote: > > 10 янв. 2021 г., в 03:15, Noah Misch <noah@leadboat.com> написал(а): > > > > No; it deletes the most recent ~1B and leaves the older segments. An > > exception is multixact, as described in the commit message and the patch's > > change to a comment in TruncateMultiXact(). > > Thanks for clarification. > One more thing: retention point at 3/4 of overall space (half of wraparound) seems more or less random to me. Why not 5/8 or 9/16? No reason for that exact value. The purpose of that patch is to mitigate bugs that cause the server to write data into a region of the SLRU that we permit truncation to unlink. If the patch instead tested "diff > INT_MIN * .99", the new behavior would get little testing, because xidWarnLimit would start first. Also, the new behavior wouldn't mitigate bugs that trespass >~20M XIDs into unlink-eligible space. If the patch tested "diff > INT_MIN * .01", more sites would see disk consumption grow. I think reasonable multipliers range from 0.5 (in the patch today) to 0.9, but it's a judgment call. > Can you please send revised patches with fixes? Attached.
Commits
-
Prevent excess SimpleLruTruncate() deletion.
- c424c75f5382 9.5.25 landed
- 9afba9b0e282 10.16 landed
- 677f6cb1d987 11.11 landed
- 66087f7e922c 12.6 landed
- 1a31d8c52db4 9.6.21 landed
- 6eb3fc7fcd89 13.2 landed
- 6db992833c04 14.0 landed
-
Fix unlinking of SLRU segments.
- c732c3f8c122 14.0 cited
-
Defer flushing of SLRU files.
- dee663f78439 14.0 cited
-
Change XID and mxact limits to warn at 40M and stop at 3M.
- cd5e82256de5 14.0 cited