Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit423e121

Browse files
committed
Accept pg_upgraded tuples during multixact freezing
The new MultiXact freezing routines introduced by commit8e9a16aneglected to consider tuples that came from a pg_upgrade'd database; avacuum run that tried to freeze such tuples would die with an error suchasERROR: MultiXactId 11415437 does no longer exist -- apparent wraparoundTo fix, ensure that GetMultiXactIdMembers is allowed to return emptymultis when the infomask bits are right, as is done in other callsites.Per trouble report from F-Secure.In passing, fix a copy&paste bug reported by Andrey Karpov from VIVA64from their PVS-Studio static checked, that instead of setting relminmxidto Invalid, we were setting relfrozenxid twice. Not an importantmistake because that code branch is about relations for which we don'tuse the frozenxid/minmxid values at all in the first place, but seems towarrants a fix nonetheless.
1 parentfaab7a9 commit423e121

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5456,6 +5456,7 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
54565456
boolhas_lockers;
54575457
TransactionIdupdate_xid;
54585458
boolupdate_committed;
5459+
boolallow_old;
54595460

54605461
*flags=0;
54615462

@@ -5517,7 +5518,9 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
55175518
* anything.
55185519
*/
55195520

5520-
nmembers=GetMultiXactIdMembers(multi,&members, false);
5521+
allow_old= !(t_infomask&HEAP_LOCK_MASK)&&
5522+
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask);
5523+
nmembers=GetMultiXactIdMembers(multi,&members,allow_old);
55215524
if (nmembers <=0)
55225525
{
55235526
/* Nothing worth keeping */
@@ -6219,10 +6222,13 @@ heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid,
62196222
MultiXactMember*members;
62206223
intnmembers;
62216224
inti;
6225+
boolallow_old;
62226226

62236227
/* need to check whether any member of the mxact is too old */
62246228

6225-
nmembers=GetMultiXactIdMembers(multi,&members, false);
6229+
allow_old= !(tuple->t_infomask&HEAP_LOCK_MASK)&&
6230+
HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask);
6231+
nmembers=GetMultiXactIdMembers(multi,&members,allow_old);
62266232

62276233
for (i=0;i<nmembers;i++)
62286234
{

‎src/backend/catalog/heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ AddNewRelationTuple(Relation pg_class_desc,
911911
* commands/sequence.c.)
912912
*/
913913
new_rel_reltup->relfrozenxid=InvalidTransactionId;
914-
new_rel_reltup->relfrozenxid=InvalidMultiXactId;
914+
new_rel_reltup->relminmxid=InvalidMultiXactId;
915915
}
916916

917917
new_rel_reltup->relowner=relowner;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp