Skip to content

Commit d3821e7

Browse files
committed
Code review for multixact bugfix
Reword messages, rename a confusingly named function. Per Robert Haas.
1 parent cbf9f0e commit d3821e7

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/backend/access/transam/multixact.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void ExtendMultiXactMember(MultiXactOffset offset, int nmembers);
347347
static void DetermineSafeOldestOffset(MultiXactId oldestMXact);
348348
static bool MultiXactOffsetWouldWrap(MultiXactOffset boundary,
349349
MultiXactOffset start, uint32 distance);
350-
static MultiXactOffset read_offset_for_multi(MultiXactId multi);
350+
static MultiXactOffset find_multixact_start(MultiXactId multi);
351351
static void WriteMZeroPageXlogRec(int pageno, uint8 info);
352352

353353

@@ -1074,12 +1074,12 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
10741074
ereport(ERROR,
10751075
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
10761076
errmsg("multixact \"members\" limit exceeded"),
1077-
errdetail_plural("This command would create a multixact with %u members, which exceeds remaining space (%u member.)",
1078-
"This command would create a multixact with %u members, which exceeds remaining space (%u members.)",
1077+
errdetail_plural("This command would create a multixact with %u members, but the remaining space is only enough for %u member.",
1078+
"This command would create a multixact with %u members, but the remaining space is only enough for %u members.",
10791079
MultiXactState->offsetStopLimit - nextOffset - 1,
10801080
nmembers,
10811081
MultiXactState->offsetStopLimit - nextOffset - 1),
1082-
errhint("Execute a database-wide VACUUM in database with OID %u, with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.",
1082+
errhint("Execute a database-wide VACUUM in database with OID %u with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.",
10831083
MultiXactState->oldestMultiXactDB)));
10841084
else if (MultiXactOffsetWouldWrap(MultiXactState->offsetStopLimit,
10851085
nextOffset,
@@ -1089,7 +1089,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
10891089
errmsg("database with OID %u must be vacuumed before %d more multixact members are used",
10901090
MultiXactState->oldestMultiXactDB,
10911091
MultiXactState->offsetStopLimit - nextOffset + nmembers),
1092-
errhint("Execute a database-wide VACUUM in that database, with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.")));
1092+
errhint("Execute a database-wide VACUUM in that database with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.")));
10931093

10941094
ExtendMultiXactMember(nextOffset, nmembers);
10951095

@@ -2487,7 +2487,7 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
24872487
* one-segment hole at a minimum. We start spewing warnings a few
24882488
* complete segments before that.
24892489
*/
2490-
oldestOffset = read_offset_for_multi(oldestMXact);
2490+
oldestOffset = find_multixact_start(oldestMXact);
24912491
/* move back to start of the corresponding segment */
24922492
oldestOffset -= oldestOffset / MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT;
24932493

@@ -2543,20 +2543,16 @@ MultiXactOffsetWouldWrap(MultiXactOffset boundary, MultiXactOffset start,
25432543
*-----------------------------------------------------------------------
25442544
*/
25452545
if (start < boundary)
2546-
{
25472546
return finish >= boundary || finish < start;
2548-
}
25492547
else
2550-
{
25512548
return finish >= boundary && finish < start;
2552-
}
25532549
}
25542550

25552551
/*
2556-
* Read the offset of the first member of the given multixact.
2552+
* Find the starting offset of the given MultiXactId.
25572553
*/
25582554
static MultiXactOffset
2559-
read_offset_for_multi(MultiXactId multi)
2555+
find_multixact_start(MultiXactId multi)
25602556
{
25612557
MultiXactOffset offset;
25622558
int pageno;
@@ -2709,7 +2705,7 @@ TruncateMultiXact(void)
27092705
* First, compute the safe truncation point for MultiXactMember. This is
27102706
* the starting offset of the oldest multixact.
27112707
*/
2712-
oldestOffset = read_offset_for_multi(oldestMXact);
2708+
oldestOffset = find_multixact_start(oldestMXact);
27132709

27142710
/*
27152711
* To truncate MultiXactMembers, we need to figure out the active page

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy