diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-07-23 17:59:20 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-07-23 17:59:20 +0900 |
commit | 165ea79a60774a0e287bfc5dc07363194c6d58df (patch) | |
tree | c081446e5d82023c0b19a4aab5abd64187c201ed /src/backend/commands/async.c | |
parent | 3b279d89cb5c86fa7ac6faaebb3ddadb2dbe0ca8 (diff) | |
download | postgresql-165ea79a60774a0e287bfc5dc07363194c6d58df.tar.gz postgresql-165ea79a60774a0e287bfc5dc07363194c6d58df.zip |
Use more consistently int64 for page numbers in SLRU-related code
clog.c, async.c and predicate.c included some SLRU page numbers still
handled as 4-byte integers, while int64 should be used for this purpose.
These holes have been introduced in 4ed8f0913bfd, that has introduced
the use of 8-byte integers for SLRU page numbers, still forgot about the
code paths updated by this commit.
Reported-by: Noah Misch
Author: Aleksander Alekseev, Michael Paquier
Discussion: https://postgr.es/m/20240626002747.dc.nmisch@google.com
Backpatch-through: 17
Diffstat (limited to 'src/backend/commands/async.c')
-rw-r--r-- | src/backend/commands/async.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 648ad4a8469..3d7d1e9beca 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -283,7 +283,7 @@ typedef struct AsyncQueueControl QueuePosition head; /* head points to the next free location */ QueuePosition tail; /* tail must be <= the queue position of every * listening backend */ - int stopPage; /* oldest unrecycled page; must be <= + int64 stopPage; /* oldest unrecycled page; must be <= * tail.page */ ProcNumber firstListener; /* id of first listener, or * INVALID_PROC_NUMBER */ @@ -1271,9 +1271,9 @@ asyncQueueUnregister(void) static bool asyncQueueIsFull(void) { - int headPage = QUEUE_POS_PAGE(QUEUE_HEAD); - int tailPage = QUEUE_POS_PAGE(QUEUE_TAIL); - int occupied = headPage - tailPage; + int64 headPage = QUEUE_POS_PAGE(QUEUE_HEAD); + int64 tailPage = QUEUE_POS_PAGE(QUEUE_TAIL); + int64 occupied = headPage - tailPage; return occupied >= max_notify_queue_pages; } @@ -1505,9 +1505,9 @@ pg_notification_queue_usage(PG_FUNCTION_ARGS) static double asyncQueueUsage(void) { - int headPage = QUEUE_POS_PAGE(QUEUE_HEAD); - int tailPage = QUEUE_POS_PAGE(QUEUE_TAIL); - int occupied = headPage - tailPage; + int64 headPage = QUEUE_POS_PAGE(QUEUE_HEAD); + int64 tailPage = QUEUE_POS_PAGE(QUEUE_TAIL); + int64 occupied = headPage - tailPage; if (occupied == 0) return (double) 0; /* fast exit for common case */ @@ -1932,7 +1932,7 @@ asyncQueueReadAllNotifications(void) do { - int curpage = QUEUE_POS_PAGE(pos); + int64 curpage = QUEUE_POS_PAGE(pos); int curoffset = QUEUE_POS_OFFSET(pos); int slotno; int copysize; @@ -2108,9 +2108,9 @@ static void asyncQueueAdvanceTail(void) { QueuePosition min; - int oldtailpage; - int newtailpage; - int boundary; + int64 oldtailpage; + int64 newtailpage; + int64 boundary; /* Restrict task to one backend per cluster; see SimpleLruTruncate(). */ LWLockAcquire(NotifyQueueTailLock, LW_EXCLUSIVE); |