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

Commita25c2b7

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 parent28fff0e commita25c2b7

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
@@ -5288,6 +5288,7 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
52885288
boolhas_lockers;
52895289
TransactionIdupdate_xid;
52905290
boolupdate_committed;
5291+
boolallow_old;
52915292

52925293
*flags=0;
52935294

@@ -5349,7 +5350,9 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
53495350
* anything.
53505351
*/
53515352

5352-
nmembers=GetMultiXactIdMembers(multi,&members, false);
5353+
allow_old= !(t_infomask&HEAP_LOCK_MASK)&&
5354+
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask);
5355+
nmembers=GetMultiXactIdMembers(multi,&members,allow_old);
53535356
if (nmembers <=0)
53545357
{
53555358
/* Nothing worth keeping */
@@ -6060,10 +6063,13 @@ heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid,
60606063
MultiXactMember*members;
60616064
intnmembers;
60626065
inti;
6066+
boolallow_old;
60636067

60646068
/* need to check whether any member of the mxact is too old */
60656069

6066-
nmembers=GetMultiXactIdMembers(multi,&members, false);
6070+
allow_old= !(tuple->t_infomask&HEAP_LOCK_MASK)&&
6071+
HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask);
6072+
nmembers=GetMultiXactIdMembers(multi,&members,allow_old);
60676073

60686074
for (i=0;i<nmembers;i++)
60696075
{

‎src/backend/catalog/heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ AddNewRelationTuple(Relation pg_class_desc,
903903
* commands/sequence.c.)
904904
*/
905905
new_rel_reltup->relfrozenxid=InvalidTransactionId;
906-
new_rel_reltup->relfrozenxid=InvalidMultiXactId;
906+
new_rel_reltup->relminmxid=InvalidMultiXactId;
907907
}
908908

909909
new_rel_reltup->relowner=relowner;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp