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

Commit7011649

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 parent2acab05 commit7011649

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
@@ -891,8 +891,8 @@ static intemode_for_corrupt_record(int emode, XLogRecPtr RecPtr);
891891
staticvoidXLogFileClose(void);
892892
staticvoidPreallocXlogFiles(XLogRecPtrendptr);
893893
staticvoidRemoveTempXlogFiles(void);
894-
staticvoidRemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrRedoRecPtr,XLogRecPtrendptr);
895-
staticvoidRemoveXlogFile(constchar*segname,XLogRecPtrRedoRecPtr,XLogRecPtrendptr);
894+
staticvoidRemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrlastredoptr,XLogRecPtrendptr);
895+
staticvoidRemoveXlogFile(constchar*segname,XLogRecPtrlastredoptr,XLogRecPtrendptr);
896896
staticvoidUpdateLastRemovedPtr(char*filename);
897897
staticvoidValidateXLOGDirectoryStructure(void);
898898
staticvoidCleanupBackupHistory(void);
@@ -2298,7 +2298,7 @@ assign_checkpoint_completion_target(double newval, void *extra)
22982298
* XLOG segments? Returns the highest segment that should be preallocated.
22992299
*/
23002300
staticXLogSegNo
2301-
XLOGfileslop(XLogRecPtrRedoRecPtr)
2301+
XLOGfileslop(XLogRecPtrlastredoptr)
23022302
{
23032303
XLogSegNominSegNo;
23042304
XLogSegNomaxSegNo;
@@ -2310,9 +2310,9 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
23102310
* correspond to. Always recycle enough segments to meet the minimum, and
23112311
* remove enough segments to stay below the maximum.
23122312
*/
2313-
minSegNo=RedoRecPtr /wal_segment_size+
2313+
minSegNo=lastredoptr /wal_segment_size+
23142314
ConvertToXSegs(min_wal_size_mb,wal_segment_size)-1;
2315-
maxSegNo=RedoRecPtr /wal_segment_size+
2315+
maxSegNo=lastredoptr /wal_segment_size+
23162316
ConvertToXSegs(max_wal_size_mb,wal_segment_size)-1;
23172317

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

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

23332333
if (recycleSegNo<minSegNo)
@@ -3948,12 +3948,12 @@ RemoveTempXlogFiles(void)
39483948
/*
39493949
* Recycle or remove all log files older or equal to passed segno.
39503950
*
3951-
* endptr is current (or recent) end of xlog, andRedoRecPtr is the
3951+
* endptr is current (or recent) end of xlog, andlastredoptr is the
39523952
* redo pointer of the last checkpoint. These are used to determine
39533953
* whether we want to recycle rather than delete no-longer-wanted log files.
39543954
*/
39553955
staticvoid
3956-
RemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrRedoRecPtr,XLogRecPtrendptr)
3956+
RemoveOldXlogFiles(XLogSegNosegno,XLogRecPtrlastredoptr,XLogRecPtrendptr)
39573957
{
39583958
DIR*xldir;
39593959
structdirent*xlde;
@@ -3996,7 +3996,7 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
39963996
/* Update the last removed location in shared memory first */
39973997
UpdateLastRemovedPtr(xlde->d_name);
39983998

3999-
RemoveXlogFile(xlde->d_name,RedoRecPtr,endptr);
3999+
RemoveXlogFile(xlde->d_name,lastredoptr,endptr);
40004000
}
40014001
}
40024002
}
@@ -4070,14 +4070,14 @@ RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI)
40704070
/*
40714071
* Recycle or remove a log file that's no longer needed.
40724072
*
4073-
* endptr is current (or recent) end of xlog, andRedoRecPtr is the
4073+
* endptr is current (or recent) end of xlog, andlastredoptr is the
40744074
* redo pointer of the last checkpoint. These are used to determine
40754075
* whether we want to recycle rather than delete no-longer-wanted log files.
4076-
* IfRedoRecPtr is not known, pass invalid, and the function will recycle,
4076+
* Iflastredoptr is not known, pass invalid, and the function will recycle,
40774077
* somewhat arbitrarily, 10 future segments.
40784078
*/
40794079
staticvoid
4080-
RemoveXlogFile(constchar*segname,XLogRecPtrRedoRecPtr,XLogRecPtrendptr)
4080+
RemoveXlogFile(constchar*segname,XLogRecPtrlastredoptr,XLogRecPtrendptr)
40814081
{
40824082
charpath[MAXPGPATH];
40834083
#ifdefWIN32
@@ -4093,10 +4093,10 @@ RemoveXlogFile(const char *segname, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
40934093
* Initialize info about where to try to recycle to.
40944094
*/
40954095
XLByteToSeg(endptr,endlogSegNo,wal_segment_size);
4096-
if (RedoRecPtr==InvalidXLogRecPtr)
4096+
if (lastredoptr==InvalidXLogRecPtr)
40974097
recycleSegNo=endlogSegNo+10;
40984098
else
4099-
recycleSegNo=XLOGfileslop(RedoRecPtr);
4099+
recycleSegNo=XLOGfileslop(lastredoptr);
41004100
}
41014101
else
41024102
recycleSegNo=0;/* keep compiler quiet */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp