Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3937cad

Browse files
committed
Use more consistently int64 for page numbers in SLRU-related code
clog.c, async.c and predicate.c included some SLRU page numbers stillhandled as 4-byte integers, while int64 should be used for this purpose.These holes have been introduced in4ed8f09, that has introducedthe use of 8-byte integers for SLRU page numbers, still forgot about thecode paths updated by this commit.Reported-by: Noah MischAuthor: Aleksander Alekseev, Michael PaquierDiscussion:https://postgr.es/m/20240626002747.dc.nmisch@google.comBackpatch-through: 17
1 parentf68d85b commit3937cad

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

‎src/backend/access/transam/clog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
445445
PGPROC*proc=MyProc;
446446
uint32nextidx;
447447
uint32wakeidx;
448-
intprevpageno;
448+
int64prevpageno;
449449
LWLock*prevlock=NULL;
450450

451451
/* We should definitely have an XID whose status needs to be updated. */
@@ -577,7 +577,7 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
577577
while (nextidx!=INVALID_PROC_NUMBER)
578578
{
579579
PGPROC*nextproc=&ProcGlobal->allProcs[nextidx];
580-
intthispageno=nextproc->clogGroupMemberPage;
580+
int64thispageno=nextproc->clogGroupMemberPage;
581581

582582
/*
583583
* If the page to update belongs to a different bank than the previous

‎src/backend/commands/async.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ typedef struct AsyncQueueControl
283283
QueuePositionhead;/* head points to the next free location */
284284
QueuePositiontail;/* tail must be <= the queue position of every
285285
* listening backend */
286-
intstopPage;/* oldest unrecycled page; must be <=
286+
int64stopPage;/* oldest unrecycled page; must be <=
287287
* tail.page */
288288
ProcNumberfirstListener;/* id of first listener, or
289289
* INVALID_PROC_NUMBER */
@@ -1271,9 +1271,9 @@ asyncQueueUnregister(void)
12711271
staticbool
12721272
asyncQueueIsFull(void)
12731273
{
1274-
intheadPage=QUEUE_POS_PAGE(QUEUE_HEAD);
1275-
inttailPage=QUEUE_POS_PAGE(QUEUE_TAIL);
1276-
intoccupied=headPage-tailPage;
1274+
int64headPage=QUEUE_POS_PAGE(QUEUE_HEAD);
1275+
int64tailPage=QUEUE_POS_PAGE(QUEUE_TAIL);
1276+
int64occupied=headPage-tailPage;
12771277

12781278
returnoccupied >=max_notify_queue_pages;
12791279
}
@@ -1505,9 +1505,9 @@ pg_notification_queue_usage(PG_FUNCTION_ARGS)
15051505
staticdouble
15061506
asyncQueueUsage(void)
15071507
{
1508-
intheadPage=QUEUE_POS_PAGE(QUEUE_HEAD);
1509-
inttailPage=QUEUE_POS_PAGE(QUEUE_TAIL);
1510-
intoccupied=headPage-tailPage;
1508+
int64headPage=QUEUE_POS_PAGE(QUEUE_HEAD);
1509+
int64tailPage=QUEUE_POS_PAGE(QUEUE_TAIL);
1510+
int64occupied=headPage-tailPage;
15111511

15121512
if (occupied==0)
15131513
return (double)0;/* fast exit for common case */
@@ -1932,7 +1932,7 @@ asyncQueueReadAllNotifications(void)
19321932

19331933
do
19341934
{
1935-
intcurpage=QUEUE_POS_PAGE(pos);
1935+
int64curpage=QUEUE_POS_PAGE(pos);
19361936
intcuroffset=QUEUE_POS_OFFSET(pos);
19371937
intslotno;
19381938
intcopysize;
@@ -2108,9 +2108,9 @@ static void
21082108
asyncQueueAdvanceTail(void)
21092109
{
21102110
QueuePositionmin;
2111-
intoldtailpage;
2112-
intnewtailpage;
2113-
intboundary;
2111+
int64oldtailpage;
2112+
int64newtailpage;
2113+
int64boundary;
21142114

21152115
/* Restrict task to one backend per cluster; see SimpleLruTruncate(). */
21162116
LWLockAcquire(NotifyQueueTailLock,LW_EXCLUSIVE);

‎src/backend/storage/lmgr/predicate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static SlruCtlData SerialSlruCtlData;
344344

345345
typedefstructSerialControlData
346346
{
347-
intheadPage;/* newest initialized page */
347+
int64headPage;/* newest initialized page */
348348
TransactionIdheadXid;/* newest valid Xid in the SLRU */
349349
TransactionIdtailXid;/* oldest xmin we might be interested in */
350350
}SerialControlData;
@@ -1035,7 +1035,7 @@ SerialSetActiveSerXmin(TransactionId xid)
10351035
void
10361036
CheckPointPredicate(void)
10371037
{
1038-
inttruncateCutoffPage;
1038+
int64truncateCutoffPage;
10391039

10401040
LWLockAcquire(SerialControlLock,LW_EXCLUSIVE);
10411041

@@ -1048,7 +1048,7 @@ CheckPointPredicate(void)
10481048

10491049
if (TransactionIdIsValid(serialControl->tailXid))
10501050
{
1051-
inttailPage;
1051+
int64tailPage;
10521052

10531053
tailPage=SerialPage(serialControl->tailXid);
10541054

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp