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

Commit6683650

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 parentfc449ab commit6683650

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
@@ -887,8 +887,8 @@ static bool WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
887887
staticintemode_for_corrupt_record(intemode,XLogRecPtrRecPtr);
888888
staticvoidXLogFileClose(void);
889889
staticvoidPreallocXlogFiles(XLogRecPtrendptr);
890-
staticvoidRemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrRedoRecPtr,XLogRecPtrendptr);
891-
staticvoidRemoveXlogFile(constchar*segname,XLogRecPtrRedoRecPtr,XLogRecPtrendptr);
890+
staticvoidRemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrlastredoptr,XLogRecPtrendptr);
891+
staticvoidRemoveXlogFile(constchar*segname,XLogRecPtrlastredoptr,XLogRecPtrendptr);
892892
staticvoidUpdateLastRemovedPtr(char*filename);
893893
staticvoidValidateXLOGDirectoryStructure(void);
894894
staticvoidCleanupBackupHistory(void);
@@ -2293,7 +2293,7 @@ assign_checkpoint_completion_target(double newval, void *extra)
22932293
* XLOG segments? Returns the highest segment that should be preallocated.
22942294
*/
22952295
staticXLogSegNo
2296-
XLOGfileslop(XLogRecPtrRedoRecPtr)
2296+
XLOGfileslop(XLogRecPtrlastredoptr)
22972297
{
22982298
XLogSegNominSegNo;
22992299
XLogSegNomaxSegNo;
@@ -2305,9 +2305,9 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
23052305
* correspond to. Always recycle enough segments to meet the minimum, and
23062306
* remove enough segments to stay below the maximum.
23072307
*/
2308-
minSegNo=RedoRecPtr /wal_segment_size+
2308+
minSegNo=lastredoptr /wal_segment_size+
23092309
ConvertToXSegs(min_wal_size_mb,wal_segment_size)-1;
2310-
maxSegNo=RedoRecPtr /wal_segment_size+
2310+
maxSegNo=lastredoptr /wal_segment_size+
23112311
ConvertToXSegs(max_wal_size_mb,wal_segment_size)-1;
23122312

23132313
/*
@@ -2322,7 +2322,7 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
23222322
/* add 10% for good measure. */
23232323
distance *=1.10;
23242324

2325-
recycleSegNo= (XLogSegNo)ceil(((double)RedoRecPtr+distance) /
2325+
recycleSegNo= (XLogSegNo)ceil(((double)lastredoptr+distance) /
23262326
wal_segment_size);
23272327

23282328
if (recycleSegNo<minSegNo)
@@ -3887,12 +3887,12 @@ UpdateLastRemovedPtr(char *filename)
38873887
/*
38883888
* Recycle or remove all log files older or equal to passed segno.
38893889
*
3890-
* endptr is current (or recent) end of xlog, andRedoRecPtr is the
3890+
* endptr is current (or recent) end of xlog, andlastredoptr is the
38913891
* redo pointer of the last checkpoint. These are used to determine
38923892
* whether we want to recycle rather than delete no-longer-wanted log files.
38933893
*/
38943894
staticvoid
3895-
RemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrRedoRecPtr,XLogRecPtrendptr)
3895+
RemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrlastredoptr,XLogRecPtrendptr)
38963896
{
38973897
DIR*xldir;
38983898
structdirent*xlde;
@@ -3935,7 +3935,7 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
39353935
/* Update the last removed location in shared memory first */
39363936
UpdateLastRemovedPtr(xlde->d_name);
39373937

3938-
RemoveXlogFile(xlde->d_name,RedoRecPtr,endptr);
3938+
RemoveXlogFile(xlde->d_name,lastredoptr,endptr);
39393939
}
39403940
}
39413941
}
@@ -4009,14 +4009,14 @@ RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI)
40094009
/*
40104010
* Recycle or remove a log file that's no longer needed.
40114011
*
4012-
* endptr is current (or recent) end of xlog, andRedoRecPtr is the
4012+
* endptr is current (or recent) end of xlog, andlastredoptr is the
40134013
* redo pointer of the last checkpoint. These are used to determine
40144014
* whether we want to recycle rather than delete no-longer-wanted log files.
4015-
* IfRedoRecPtr is not known, pass invalid, and the function will recycle,
4015+
* Iflastredoptr is not known, pass invalid, and the function will recycle,
40164016
* somewhat arbitrarily, 10 future segments.
40174017
*/
40184018
staticvoid
4019-
RemoveXlogFile(constchar*segname,XLogRecPtrRedoRecPtr,XLogRecPtrendptr)
4019+
RemoveXlogFile(constchar*segname,XLogRecPtrlastredoptr,XLogRecPtrendptr)
40204020
{
40214021
charpath[MAXPGPATH];
40224022
#ifdefWIN32
@@ -4030,10 +4030,10 @@ RemoveXlogFile(const char *segname, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
40304030
* Initialize info about where to try to recycle to.
40314031
*/
40324032
XLByteToSeg(endptr,endlogSegNo,wal_segment_size);
4033-
if (RedoRecPtr==InvalidXLogRecPtr)
4033+
if (lastredoptr==InvalidXLogRecPtr)
40344034
recycleSegNo=endlogSegNo+10;
40354035
else
4036-
recycleSegNo=XLOGfileslop(RedoRecPtr);
4036+
recycleSegNo=XLOGfileslop(lastredoptr);
40374037

40384038
snprintf(path,MAXPGPATH,XLOGDIR"/%s",segname);
40394039

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp