Skip to content

Commit cf0d888

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

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
@@ -345,7 +345,7 @@ static void ExtendMultiXactMember(MultiXactOffset offset, int nmembers);
345345
static void DetermineSafeOldestOffset(MultiXactId oldestMXact);
346346
static bool MultiXactOffsetWouldWrap(MultiXactOffset boundary,
347347
MultiXactOffset start, uint32 distance);
348-
static MultiXactOffset read_offset_for_multi(MultiXactId multi);
348+
static MultiXactOffset find_multixact_start(MultiXactId multi);
349349
static void WriteMZeroPageXlogRec(int pageno, uint8 info);
350350

351351

@@ -1079,12 +1079,12 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
10791079
ereport(ERROR,
10801080
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
10811081
errmsg("multixact \"members\" limit exceeded"),
1082-
errdetail_plural("This command would create a multixact with %u members, which exceeds remaining space (%u member.)",
1083-
"This command would create a multixact with %u members, which exceeds remaining space (%u members.)",
1082+
errdetail_plural("This command would create a multixact with %u members, but the remaining space is only enough for %u member.",
1083+
"This command would create a multixact with %u members, but the remaining space is only enough for %u members.",
10841084
MultiXactState->offsetStopLimit - nextOffset - 1,
10851085
nmembers,
10861086
MultiXactState->offsetStopLimit - nextOffset - 1),
1087-
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.",
1087+
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.",
10881088
MultiXactState->oldestMultiXactDB)));
10891089
else if (MultiXactOffsetWouldWrap(MultiXactState->offsetStopLimit,
10901090
nextOffset,
@@ -1094,7 +1094,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
10941094
errmsg("database with OID %u must be vacuumed before %d more multixact members are used",
10951095
MultiXactState->oldestMultiXactDB,
10961096
MultiXactState->offsetStopLimit - nextOffset + nmembers),
1097-
errhint("Execute a database-wide VACUUM in that database, with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.")));
1097+
errhint("Execute a database-wide VACUUM in that database with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.")));
10981098

10991099
ExtendMultiXactMember(nextOffset, nmembers);
11001100

@@ -2506,7 +2506,7 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
25062506
* one-segment hole at a minimum. We start spewing warnings a few
25072507
* complete segments before that.
25082508
*/
2509-
oldestOffset = read_offset_for_multi(oldestMXact);
2509+
oldestOffset = find_multixact_start(oldestMXact);
25102510
/* move back to start of the corresponding segment */
25112511
oldestOffset -= oldestOffset / MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT;
25122512

@@ -2562,20 +2562,16 @@ MultiXactOffsetWouldWrap(MultiXactOffset boundary, MultiXactOffset start,
25622562
*-----------------------------------------------------------------------
25632563
*/
25642564
if (start < boundary)
2565-
{
25662565
return finish >= boundary || finish < start;
2567-
}
25682566
else
2569-
{
25702567
return finish >= boundary && finish < start;
2571-
}
25722568
}
25732569

25742570
/*
2575-
* Read the offset of the first member of the given multixact.
2571+
* Find the starting offset of the given MultiXactId.
25762572
*/
25772573
static MultiXactOffset
2578-
read_offset_for_multi(MultiXactId multi)
2574+
find_multixact_start(MultiXactId multi)
25792575
{
25802576
MultiXactOffset offset;
25812577
int pageno;
@@ -2728,7 +2724,7 @@ TruncateMultiXact(void)
27282724
* First, compute the safe truncation point for MultiXactMember. This is
27292725
* the starting offset of the oldest multixact.
27302726
*/
2731-
oldestOffset = read_offset_for_multi(oldestMXact);
2727+
oldestOffset = find_multixact_start(oldestMXact);
27322728

27332729
/*
27342730
* 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