Re: recovering from "found xmin ... from before relfrozenxid ..."
x4mmm@yandex-team.ru
From: "Andrey M. Borodin" <x4mmm@yandex-team.ru>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andres Freund <andres@anarazel.de>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Tom Lane <tgl@sss.pgh.pa.us>,
Stephen Frost <sfrost@snowman.net>,
Robert Haas <robertmhaas@gmail.com>
Date: 2020-07-26T17:54:35Z
Lists: pgsql-hackers
> 24 июля 2020 г., в 14:05, Ashutosh Sharma <ashu.coek88@gmail.com> написал(а): > > Attached is the patch that adds heap_force_kill(regclass, tid[]) and heap_force_freeze(regclass, tid[]) functions which Robert mentioned in the first email in this thread. The patch basically adds an extension named pg_surgery that contains these functions. Please have a look and let me know your feedback. Thank you. Thanks for the patch! I have just few random thoughts. I think here we should report that we haven't done what was asked. + /* Nothing to do if the itemid is unused or already dead. */ + if (!ItemIdIsUsed(itemid) || ItemIdIsDead(itemid)) + continue; Also, should we try to fix VM along the way? Are there any caveats with concurrent VACUUM? (I do not see any, just asking) It would be good to have some checks for interrupts in safe places. I think we should not trust user entierly here. I'd prefer validation and graceful exit, not a core dump. + Assert(noffs <= PageGetMaxOffsetNumber(page)); For some reason we had unlogged versions of these functions. But I do not recall exact rationale.. Also, I'd be happy if we had something like "Restore this tuple iff this does not break unique constraint". To do so we need to sort tids by xmin\xmax, to revive most recent data first. Thanks! Best regards, Andrey Borodin.
Commits
-
Fix wrong data table horizon computation during backend startup.
- 1c7675a7a426 14.0 landed
-
Centralize horizon determination for temp tables, fixing bug due to skew.
- 94bc27b57680 14.0 landed
-
pg_surgery: Try to stabilize regression tests.
- 0811f766fd74 14.0 landed
-
New contrib module, pg_surgery, with heap surgery functions.
- 34a947ca13e5 14.0 landed
-
Set cutoff xmin more aggressively when vacuuming a temporary table.
- a7212be8b9e0 14.0 cited
-
snapshot scalability: Don't compute global horizons while building snapshots.
- dc7420c2c927 14.0 cited
-
Introduce vacuum errcontext to display additional information.
- b61d161c1463 13.0 cited