@@ -306,8 +306,8 @@ typedef struct mXactCacheEnt
306
306
} mXactCacheEnt ;
307
307
308
308
#define MAX_CACHE_ENTRIES 256
309
- static dlist_head MXactCache = DLIST_STATIC_INIT (MXactCache );
310
- static int MXactCacheMembers = 0 ;
309
+ static dlist_head MXactCache = DLIST_STATIC_INIT (MXactCache );
310
+ static int MXactCacheMembers = 0 ;
311
311
static MemoryContext MXactContext = NULL ;
312
312
313
313
#ifdef MULTIXACT_DEBUG
@@ -620,9 +620,9 @@ MultiXactIdSetOldestMember(void)
620
620
* back. Which would be wrong.
621
621
*
622
622
* Note that a shared lock is sufficient, because it's enough to stop
623
- * someone from advancing nextMXact; and nobody else could be trying to
624
- * write to our OldestMember entry, only reading (and we assume storing
625
- * it is atomic.)
623
+ * someone from advancing nextMXact; and nobody else could be trying
624
+ * to write to our OldestMember entry, only reading (and we assume
625
+ * storing it is atomic.)
626
626
*/
627
627
LWLockAcquire (MultiXactGenLock , LW_SHARED );
628
628
@@ -970,7 +970,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
970
970
*/
971
971
if (!MultiXactIdPrecedes (result , MultiXactState -> multiVacLimit ) ||
972
972
(MultiXactState -> nextOffset - MultiXactState -> oldestOffset
973
- > MULTIXACT_MEMBER_SAFE_THRESHOLD ))
973
+ > MULTIXACT_MEMBER_SAFE_THRESHOLD ))
974
974
{
975
975
/*
976
976
* For safety's sake, we release MultiXactGenLock while sending
@@ -1025,17 +1025,17 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
1025
1025
(errmsg_plural ("database \"%s\" must be vacuumed before %u more MultiXactId is used" ,
1026
1026
"database \"%s\" must be vacuumed before %u more MultiXactIds are used" ,
1027
1027
multiWrapLimit - result ,
1028
- oldest_datname ,
1029
- multiWrapLimit - result ),
1028
+ oldest_datname ,
1029
+ multiWrapLimit - result ),
1030
1030
errhint ("Execute a database-wide VACUUM in that database.\n"
1031
1031
"You might also need to commit or roll back old prepared transactions." )));
1032
1032
else
1033
1033
ereport (WARNING ,
1034
1034
(errmsg_plural ("database with OID %u must be vacuumed before %u more MultiXactId is used" ,
1035
1035
"database with OID %u must be vacuumed before %u more MultiXactIds are used" ,
1036
1036
multiWrapLimit - result ,
1037
- oldest_datoid ,
1038
- multiWrapLimit - result ),
1037
+ oldest_datoid ,
1038
+ multiWrapLimit - result ),
1039
1039
errhint ("Execute a database-wide VACUUM in that database.\n"
1040
1040
"You might also need to commit or roll back old prepared transactions." )));
1041
1041
}
@@ -1194,14 +1194,14 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members,
1194
1194
*
1195
1195
* An ID older than MultiXactState->oldestMultiXactId cannot possibly be
1196
1196
* useful; it has already been removed, or will be removed shortly, by
1197
- * truncation. Returning the wrong values could lead
1198
- * to an incorrect visibility result. However, to support pg_upgrade we
1199
- * need to allow an empty set to be returned regardless, if the caller is
1200
- * willing to accept it; the caller is expected to check that it's an
1201
- * allowed condition (such as ensuring that the infomask bits set on the
1202
- * tuple are consistent with the pg_upgrade scenario). If the caller is
1203
- * expecting this to be called only on recently created multis, then we
1204
- * raise an error.
1197
+ * truncation. Returning the wrong values could lead to an incorrect
1198
+ * visibility result. However, to support pg_upgrade we need to allow an
1199
+ * empty set to be returned regardless, if the caller is willing to accept
1200
+ * it; the caller is expected to check that it's an allowed condition
1201
+ * (such as ensuring that the infomask bits set on the tuple are
1202
+ * consistent with the pg_upgrade scenario). If the caller is expecting
1203
+ * this to be called only on recently created multis, then we raise an
1204
+ * error.
1205
1205
*
1206
1206
* Conversely, an ID >= nextMXact shouldn't ever be seen here; if it is
1207
1207
* seen, it implies undetected ID wraparound has occurred. This raises a
@@ -1383,8 +1383,8 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members,
1383
1383
1384
1384
/*
1385
1385
* MultiXactHasRunningRemoteMembers
1386
- * Does the given multixact have still-live members from
1387
- * transactions other than our own?
1386
+ * Does the given multixact have still-live members from
1387
+ * transactions other than our own?
1388
1388
*/
1389
1389
bool
1390
1390
MultiXactHasRunningRemoteMembers (MultiXactId multi )
@@ -1935,7 +1935,7 @@ MaybeExtendOffsetSlru(void)
1935
1935
1936
1936
if (!SimpleLruDoesPhysicalPageExist (MultiXactOffsetCtl , pageno ))
1937
1937
{
1938
- int slotno ;
1938
+ int slotno ;
1939
1939
1940
1940
/*
1941
1941
* Fortunately for us, SimpleLruWritePage is already prepared to deal
@@ -2142,11 +2142,11 @@ MultiXactSetNextMXact(MultiXactId nextMulti,
2142
2142
* enough to contain the next value that would be created.
2143
2143
*
2144
2144
* We need to do this pretty early during the first startup in binary
2145
- * upgrade mode: before StartupMultiXact() in fact, because this routine is
2146
- * called even before that by StartupXLOG(). And we can't do it earlier
2147
- * than at this point, because during that first call of this routine we
2148
- * determine the MultiXactState->nextMXact value that MaybeExtendOffsetSlru
2149
- * needs.
2145
+ * upgrade mode: before StartupMultiXact() in fact, because this routine
2146
+ * is called even before that by StartupXLOG(). And we can't do it
2147
+ * earlier than at this point, because during that first call of this
2148
+ * routine we determine the MultiXactState->nextMXact value that
2149
+ * MaybeExtendOffsetSlru needs.
2150
2150
*/
2151
2151
if (IsBinaryUpgrade )
2152
2152
MaybeExtendOffsetSlru ();
@@ -2221,11 +2221,11 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
2221
2221
2222
2222
/*
2223
2223
* Determine the offset of the oldest multixact that might still be
2224
- * referenced. Normally, we can read the offset from the multixact itself,
2225
- * but there's an important special case: if there are no multixacts in
2226
- * existence at all, oldest_datminmxid obviously can't point to one. It
2227
- * will instead point to the multixact ID that will be assigned the next
2228
- * time one is needed.
2224
+ * referenced. Normally, we can read the offset from the multixact
2225
+ * itself, but there's an important special case: if there are no
2226
+ * multixacts in existence at all, oldest_datminmxid obviously can't point
2227
+ * to one. It will instead point to the multixact ID that will be
2228
+ * assigned the next time one is needed.
2229
2229
*
2230
2230
* NB: oldest_dataminmxid is the oldest multixact that might still be
2231
2231
* referenced from a table, unlike in DetermineSafeOldestOffset, where we
@@ -2302,17 +2302,17 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
2302
2302
(errmsg_plural ("database \"%s\" must be vacuumed before %u more MultiXactId is used" ,
2303
2303
"database \"%s\" must be vacuumed before %u more MultiXactIds are used" ,
2304
2304
multiWrapLimit - curMulti ,
2305
- oldest_datname ,
2306
- multiWrapLimit - curMulti ),
2305
+ oldest_datname ,
2306
+ multiWrapLimit - curMulti ),
2307
2307
errhint ("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
2308
2308
"You might also need to commit or roll back old prepared transactions." )));
2309
2309
else
2310
2310
ereport (WARNING ,
2311
2311
(errmsg_plural ("database with OID %u must be vacuumed before %u more MultiXactId is used" ,
2312
2312
"database with OID %u must be vacuumed before %u more MultiXactIds are used" ,
2313
2313
multiWrapLimit - curMulti ,
2314
- oldest_datoid ,
2315
- multiWrapLimit - curMulti ),
2314
+ oldest_datoid ,
2315
+ multiWrapLimit - curMulti ),
2316
2316
errhint ("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
2317
2317
"You might also need to commit or roll back old prepared transactions." )));
2318
2318
}
@@ -2539,10 +2539,9 @@ DetermineSafeOldestOffset(MultiXactId oldestMXact)
2539
2539
* obviously can't point to one. It will instead point to the multixact
2540
2540
* ID that will be assigned the next time one is needed.
2541
2541
*
2542
- * NB: oldestMXact should be the oldest multixact that still exists in
2543
- * the SLRU, unlike in SetMultiXactIdLimit, where we do this same
2544
- * computation based on the oldest value that might be referenced in a
2545
- * table.
2542
+ * NB: oldestMXact should be the oldest multixact that still exists in the
2543
+ * SLRU, unlike in SetMultiXactIdLimit, where we do this same computation
2544
+ * based on the oldest value that might be referenced in a table.
2546
2545
*/
2547
2546
LWLockAcquire (MultiXactGenLock , LW_SHARED );
2548
2547
if (MultiXactState -> nextMXact == oldestMXact )
@@ -2680,7 +2679,7 @@ ReadMultiXactCounts(uint32 *multixacts, MultiXactOffset *members)
2680
2679
* to a value just less than the number of multixacts in use. We hope that
2681
2680
* this will quickly trigger autovacuuming on the table or tables with the
2682
2681
* oldest relminmxid, thus allowing datminmxid values to advance and removing
2683
- * some members.
2682
+ * some members.
2684
2683
*
2685
2684
* As the fraction of the member space currently in use grows, we become
2686
2685
* more aggressive in clamping this value. That not only causes autovacuum
@@ -2698,9 +2697,9 @@ int
2698
2697
MultiXactMemberFreezeThreshold (void )
2699
2698
{
2700
2699
MultiXactOffset members ;
2701
- uint32 multixacts ;
2702
- uint32 victim_multixacts ;
2703
- double fraction ;
2700
+ uint32 multixacts ;
2701
+ uint32 victim_multixacts ;
2702
+ double fraction ;
2704
2703
2705
2704
ReadMultiXactCounts (& multixacts , & members );
2706
2705
@@ -2725,32 +2724,32 @@ MultiXactMemberFreezeThreshold(void)
2725
2724
2726
2725
/*
2727
2726
* SlruScanDirectory callback.
2728
- * This callback deletes segments that are outside the range determined by
2729
- * the given page numbers.
2727
+ * This callback deletes segments that are outside the range determined by
2728
+ * the given page numbers.
2730
2729
*
2731
2730
* Both range endpoints are exclusive (that is, segments containing any of
2732
2731
* those pages are kept.)
2733
2732
*/
2734
2733
typedef struct MembersLiveRange
2735
2734
{
2736
- int rangeStart ;
2737
- int rangeEnd ;
2735
+ int rangeStart ;
2736
+ int rangeEnd ;
2738
2737
} MembersLiveRange ;
2739
2738
2740
2739
static bool
2741
2740
SlruScanDirCbRemoveMembers (SlruCtl ctl , char * filename , int segpage ,
2742
2741
void * data )
2743
2742
{
2744
2743
MembersLiveRange * range = (MembersLiveRange * ) data ;
2745
- MultiXactOffset nextOffset ;
2744
+ MultiXactOffset nextOffset ;
2746
2745
2747
2746
if ((segpage == range -> rangeStart ) ||
2748
2747
(segpage == range -> rangeEnd ))
2749
- return false; /* easy case out */
2748
+ return false; /* easy case out */
2750
2749
2751
2750
/*
2752
- * To ensure that no segment is spuriously removed, we must keep track
2753
- * of new segments added since the start of the directory scan; to do this,
2751
+ * To ensure that no segment is spuriously removed, we must keep track of
2752
+ * new segments added since the start of the directory scan; to do this,
2754
2753
* we update our end-of-range point as we run.
2755
2754
*
2756
2755
* As an optimization, we can skip looking at shared memory if we know for
@@ -2819,12 +2818,12 @@ SlruScanDirCbFindEarliest(SlruCtl ctl, char *filename, int segpage, void *data)
2819
2818
void
2820
2819
TruncateMultiXact (void )
2821
2820
{
2822
- MultiXactId oldestMXact ;
2821
+ MultiXactId oldestMXact ;
2823
2822
MultiXactOffset oldestOffset ;
2824
- MultiXactOffset nextOffset ;
2823
+ MultiXactOffset nextOffset ;
2825
2824
mxtruncinfo trunc ;
2826
2825
MultiXactId earliest ;
2827
- MembersLiveRange range ;
2826
+ MembersLiveRange range ;
2828
2827
2829
2828
Assert (AmCheckpointerProcess () || AmStartupProcess () ||
2830
2829
!IsPostmasterEnvironment );
@@ -2879,7 +2878,6 @@ TruncateMultiXact(void)
2879
2878
SimpleLruTruncate (MultiXactOffsetCtl ,
2880
2879
MultiXactIdToOffsetPage (oldestMXact ));
2881
2880
2882
-
2883
2881
/*
2884
2882
* Now, and only now, we can advance the stop point for multixact members.
2885
2883
* If we did it any sooner, the segments we deleted above might already
0 commit comments