@@ -282,11 +282,12 @@ typedef struct MultiXactStateData
282
282
}MultiXactStateData ;
283
283
284
284
/*
285
- * Pointers to the state data in shared memory
286
- *
287
- * The index of the last element of the OldestMemberMXactId and
288
- * OldestVisibleMXactId arrays can be obtained with GetMaxOldestSlot().
285
+ * Last element of OldestMemberMXactId and OldestVisibleMXactId arrays.
286
+ * Valid elements are (1..MaxOldestSlot); element 0 is never used.
289
287
*/
288
+ #define MaxOldestSlot (MaxBackends + max_prepared_xacts)
289
+
290
+ /* Pointers to the state data in shared memory */
290
291
static MultiXactStateData * MultiXactState ;
291
292
static MultiXactId * OldestMemberMXactId ;
292
293
static MultiXactId * OldestVisibleMXactId ;
@@ -341,7 +342,6 @@ static void MultiXactIdSetOldestVisible(void);
341
342
static void RecordNewMultiXact (MultiXactId multi ,MultiXactOffset offset ,
342
343
int nmembers ,MultiXactMember * members );
343
344
static MultiXactId GetNewMultiXactId (int nmembers ,MultiXactOffset * offset );
344
- static inline int GetMaxOldestSlot (void );
345
345
346
346
/* MultiXact cache management */
347
347
static int mxactMemberComparator (const void * arg1 ,const void * arg2 );
@@ -662,17 +662,6 @@ MultiXactIdSetOldestMember(void)
662
662
}
663
663
}
664
664
665
- /*
666
- * Retrieve the index of the last element of the OldestMemberMXactId and
667
- * OldestVisibleMXactId arrays. Valid elements are (1..MaxOldestSlot); element
668
- * 0 is never used.
669
- */
670
- static inline int
671
- GetMaxOldestSlot (void )
672
- {
673
- return GetMaxBackends ()+ max_prepared_xacts ;
674
- }
675
-
676
665
/*
677
666
* MultiXactIdSetOldestVisible
678
667
*Save the oldest MultiXactId this transaction considers possibly live.
@@ -695,7 +684,6 @@ MultiXactIdSetOldestVisible(void)
695
684
if (!MultiXactIdIsValid (OldestVisibleMXactId [MyBackendId ]))
696
685
{
697
686
MultiXactId oldestMXact ;
698
- int maxOldestSlot = GetMaxOldestSlot ();
699
687
int i ;
700
688
701
689
LWLockAcquire (MultiXactGenLock ,LW_EXCLUSIVE );
@@ -709,7 +697,7 @@ MultiXactIdSetOldestVisible(void)
709
697
if (oldestMXact < FirstMultiXactId )
710
698
oldestMXact = FirstMultiXactId ;
711
699
712
- for (i = 1 ;i <=maxOldestSlot ;i ++ )
700
+ for (i = 1 ;i <=MaxOldestSlot ;i ++ )
713
701
{
714
702
MultiXactId thisoldest = OldestMemberMXactId [i ];
715
703
@@ -1843,7 +1831,7 @@ MultiXactShmemSize(void)
1843
1831
/* We need 2*MaxOldestSlot + 1 perBackendXactIds[] entries */
1844
1832
#define SHARED_MULTIXACT_STATE_SIZE \
1845
1833
add_size(offsetof(MultiXactStateData, perBackendXactIds) + sizeof(MultiXactId), \
1846
- mul_size(sizeof(MultiXactId) * 2,GetMaxOldestSlot() ))
1834
+ mul_size(sizeof(MultiXactId) * 2,MaxOldestSlot ))
1847
1835
1848
1836
size = SHARED_MULTIXACT_STATE_SIZE ;
1849
1837
size = add_size (size ,SimpleLruShmemSize (NUM_MULTIXACTOFFSET_BUFFERS ,0 ));
@@ -1894,7 +1882,7 @@ MultiXactShmemInit(void)
1894
1882
* since we only use indexes 1..MaxOldestSlot in each array.
1895
1883
*/
1896
1884
OldestMemberMXactId = MultiXactState -> perBackendXactIds ;
1897
- OldestVisibleMXactId = OldestMemberMXactId + GetMaxOldestSlot () ;
1885
+ OldestVisibleMXactId = OldestMemberMXactId + MaxOldestSlot ;
1898
1886
}
1899
1887
1900
1888
/*
@@ -2519,7 +2507,6 @@ GetOldestMultiXactId(void)
2519
2507
{
2520
2508
MultiXactId oldestMXact ;
2521
2509
MultiXactId nextMXact ;
2522
- int maxOldestSlot = GetMaxOldestSlot ();
2523
2510
int i ;
2524
2511
2525
2512
/*
@@ -2538,7 +2525,7 @@ GetOldestMultiXactId(void)
2538
2525
nextMXact = FirstMultiXactId ;
2539
2526
2540
2527
oldestMXact = nextMXact ;
2541
- for (i = 1 ;i <=maxOldestSlot ;i ++ )
2528
+ for (i = 1 ;i <=MaxOldestSlot ;i ++ )
2542
2529
{
2543
2530
MultiXactId thisoldest ;
2544
2531