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

Commit35c0152

Browse files
committed
Remove shadow variables linked to RedoRecPtr in xlog.c
This changes the routines in charge of recycling WAL segments past thelast redo LSN to not use anymore "RedoRecPtr" as a local variable, whichis also available in the context of the session as a static declaration,replacing it with "lastredoptr". This confusion has been introduced byd9fadbf, so backpatch down to v11 like the other commit.Thanks to Tom Lane, Robert Haas, Alvaro Herrera, Mark Dilger and KyotaroHoriguchi for the input provided.Author: Ranier VilelaDiscussion:https://postgr.es/m/MN2PR18MB2927F7B5F690065E1194B258E35D0@MN2PR18MB2927.namprd18.prod.outlook.comBackpatch-through: 11
1 parent97ba30f commit35c0152

File tree

1 file changed

+14
-14
lines changed
  • src/backend/access/transam

1 file changed

+14
-14
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,8 @@ static intemode_for_corrupt_record(int emode, XLogRecPtr RecPtr);
893893
staticvoidXLogFileClose(void);
894894
staticvoidPreallocXlogFiles(XLogRecPtrendptr);
895895
staticvoidRemoveTempXlogFiles(void);
896-
staticvoidRemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrRedoRecPtr,XLogRecPtrendptr);
897-
staticvoidRemoveXlogFile(constchar*segname,XLogRecPtrRedoRecPtr,XLogRecPtrendptr);
896+
staticvoidRemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrlastredoptr,XLogRecPtrendptr);
897+
staticvoidRemoveXlogFile(constchar*segname,XLogRecPtrlastredoptr,XLogRecPtrendptr);
898898
staticvoidUpdateLastRemovedPtr(char*filename);
899899
staticvoidValidateXLOGDirectoryStructure(void);
900900
staticvoidCleanupBackupHistory(void);
@@ -2299,7 +2299,7 @@ assign_checkpoint_completion_target(double newval, void *extra)
22992299
* XLOG segments? Returns the highest segment that should be preallocated.
23002300
*/
23012301
staticXLogSegNo
2302-
XLOGfileslop(XLogRecPtrRedoRecPtr)
2302+
XLOGfileslop(XLogRecPtrlastredoptr)
23032303
{
23042304
XLogSegNominSegNo;
23052305
XLogSegNomaxSegNo;
@@ -2311,9 +2311,9 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
23112311
* correspond to. Always recycle enough segments to meet the minimum, and
23122312
* remove enough segments to stay below the maximum.
23132313
*/
2314-
minSegNo=RedoRecPtr /wal_segment_size+
2314+
minSegNo=lastredoptr /wal_segment_size+
23152315
ConvertToXSegs(min_wal_size_mb,wal_segment_size)-1;
2316-
maxSegNo=RedoRecPtr /wal_segment_size+
2316+
maxSegNo=lastredoptr /wal_segment_size+
23172317
ConvertToXSegs(max_wal_size_mb,wal_segment_size)-1;
23182318

23192319
/*
@@ -2328,7 +2328,7 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
23282328
/* add 10% for good measure. */
23292329
distance *=1.10;
23302330

2331-
recycleSegNo= (XLogSegNo)ceil(((double)RedoRecPtr+distance) /
2331+
recycleSegNo= (XLogSegNo)ceil(((double)lastredoptr+distance) /
23322332
wal_segment_size);
23332333

23342334
if (recycleSegNo<minSegNo)
@@ -3935,12 +3935,12 @@ RemoveTempXlogFiles(void)
39353935
/*
39363936
* Recycle or remove all log files older or equal to passed segno.
39373937
*
3938-
* endptr is current (or recent) end of xlog, andRedoRecPtr is the
3938+
* endptr is current (or recent) end of xlog, andlastredoptr is the
39393939
* redo pointer of the last checkpoint. These are used to determine
39403940
* whether we want to recycle rather than delete no-longer-wanted log files.
39413941
*/
39423942
staticvoid
3943-
RemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrRedoRecPtr,XLogRecPtrendptr)
3943+
RemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrlastredoptr,XLogRecPtrendptr)
39443944
{
39453945
DIR*xldir;
39463946
structdirent*xlde;
@@ -3983,7 +3983,7 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
39833983
/* Update the last removed location in shared memory first */
39843984
UpdateLastRemovedPtr(xlde->d_name);
39853985

3986-
RemoveXlogFile(xlde->d_name,RedoRecPtr,endptr);
3986+
RemoveXlogFile(xlde->d_name,lastredoptr,endptr);
39873987
}
39883988
}
39893989
}
@@ -4057,14 +4057,14 @@ RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI)
40574057
/*
40584058
* Recycle or remove a log file that's no longer needed.
40594059
*
4060-
* endptr is current (or recent) end of xlog, andRedoRecPtr is the
4060+
* endptr is current (or recent) end of xlog, andlastredoptr is the
40614061
* redo pointer of the last checkpoint. These are used to determine
40624062
* whether we want to recycle rather than delete no-longer-wanted log files.
4063-
* IfRedoRecPtr is not known, pass invalid, and the function will recycle,
4063+
* Iflastredoptr is not known, pass invalid, and the function will recycle,
40644064
* somewhat arbitrarily, 10 future segments.
40654065
*/
40664066
staticvoid
4067-
RemoveXlogFile(constchar*segname,XLogRecPtrRedoRecPtr,XLogRecPtrendptr)
4067+
RemoveXlogFile(constchar*segname,XLogRecPtrlastredoptr,XLogRecPtrendptr)
40684068
{
40694069
charpath[MAXPGPATH];
40704070
#ifdefWIN32
@@ -4080,10 +4080,10 @@ RemoveXlogFile(const char *segname, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
40804080
* Initialize info about where to try to recycle to.
40814081
*/
40824082
XLByteToSeg(endptr,endlogSegNo,wal_segment_size);
4083-
if (RedoRecPtr==InvalidXLogRecPtr)
4083+
if (lastredoptr==InvalidXLogRecPtr)
40844084
recycleSegNo=endlogSegNo+10;
40854085
else
4086-
recycleSegNo=XLOGfileslop(RedoRecPtr);
4086+
recycleSegNo=XLOGfileslop(lastredoptr);
40874087
}
40884088
else
40894089
recycleSegNo=0;/* keep compiler quiet */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp