mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix more holes with SLRU code in need of int64 for segment numbers
This is a continuation of c9e2457390, containing changes included into
the proposed patch that have been missed in the actual commit.  I have
managed to miss these diffs while doing a rebase of the original patch.
Thanks to Noah Misch, Peter Eisentraut and Alexander Korotkov for the
pokes.
Discussion: https://postgr.es/m/92fe572d-638e-4162-aef6-1c42a2936f25@eisentraut.org
Discussion: https://postgr.es/m/20240810175055.cd.nmisch@google.com
Backpatch-through: 17
			
			
This commit is contained in:
		@@ -120,7 +120,7 @@ MultiXactIdToOffsetEntry(MultiXactId multi)
 | 
			
		||||
	return multi % MULTIXACT_OFFSETS_PER_PAGE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int
 | 
			
		||||
static inline int64
 | 
			
		||||
MultiXactIdToOffsetSegment(MultiXactId multi)
 | 
			
		||||
{
 | 
			
		||||
	return MultiXactIdToOffsetPage(multi) / SLRU_PAGES_PER_SEGMENT;
 | 
			
		||||
@@ -174,7 +174,7 @@ MXOffsetToMemberPage(MultiXactOffset offset)
 | 
			
		||||
	return offset / MULTIXACT_MEMBERS_PER_PAGE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int
 | 
			
		||||
static inline int64
 | 
			
		||||
MXOffsetToMemberSegment(MultiXactOffset offset)
 | 
			
		||||
{
 | 
			
		||||
	return MXOffsetToMemberPage(offset) / SLRU_PAGES_PER_SEGMENT;
 | 
			
		||||
@@ -3039,10 +3039,10 @@ SlruScanDirCbFindEarliest(SlruCtl ctl, char *filename, int64 segpage, void *data
 | 
			
		||||
static void
 | 
			
		||||
PerformMembersTruncation(MultiXactOffset oldestOffset, MultiXactOffset newOldestOffset)
 | 
			
		||||
{
 | 
			
		||||
	const int	maxsegment = MXOffsetToMemberSegment(MaxMultiXactOffset);
 | 
			
		||||
	int			startsegment = MXOffsetToMemberSegment(oldestOffset);
 | 
			
		||||
	int			endsegment = MXOffsetToMemberSegment(newOldestOffset);
 | 
			
		||||
	int			segment = startsegment;
 | 
			
		||||
	const int64 maxsegment = MXOffsetToMemberSegment(MaxMultiXactOffset);
 | 
			
		||||
	int64		startsegment = MXOffsetToMemberSegment(oldestOffset);
 | 
			
		||||
	int64		endsegment = MXOffsetToMemberSegment(newOldestOffset);
 | 
			
		||||
	int64		segment = startsegment;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Delete all the segments but the last one. The last segment can still
 | 
			
		||||
 
 | 
			
		||||
@@ -1532,7 +1532,7 @@ restart:
 | 
			
		||||
	did_write = false;
 | 
			
		||||
	for (int slotno = 0; slotno < shared->num_slots; slotno++)
 | 
			
		||||
	{
 | 
			
		||||
		int			pagesegno;
 | 
			
		||||
		int64		pagesegno;
 | 
			
		||||
		int			curbank = SlotGetBankNumber(slotno);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user