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

Commitfba49d5

Browse files
committed
Remove emode argument from XLogFileRead() and XLogFileReadAnyTLI()
This change makes the code slightly easier to reason about, becausethere is actually no need to know if a specific caller of one of theseroutines should fail hard on a PANIC, or just let it go through with aDEBUG2.The only caller of XLogFileReadAnyTLI() used DEBUG2, and XLogFileRead()has never used its emode. This can be simplified since1bb2558that has introduced XLogFileReadAnyTLI(), splitting both.Author: Yugo NagataDiscussion:https://postgr.es/m/20240906201043.a640f3b44e755d4db2b6943e@sraoss.co.jp
1 parentbb77752 commitfba49d5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ static intemode_for_corrupt_record(int emode, XLogRecPtr RecPtr);
430430
staticXLogRecord*ReadCheckpointRecord(XLogPrefetcher*xlogprefetcher,
431431
XLogRecPtrRecPtr,TimeLineIDreplayTLI);
432432
staticboolrescanLatestTimeLine(TimeLineIDreplayTLI,XLogRecPtrreplayLSN);
433-
staticintXLogFileRead(XLogSegNosegno,intemode,TimeLineIDtli,
433+
staticintXLogFileRead(XLogSegNosegno,TimeLineIDtli,
434434
XLogSourcesource,boolnotfoundOk);
435-
staticintXLogFileReadAnyTLI(XLogSegNosegno,intemode,XLogSourcesource);
435+
staticintXLogFileReadAnyTLI(XLogSegNosegno,XLogSourcesource);
436436

437437
staticboolCheckForStandbyTrigger(void);
438438
staticvoidSetPromoteIsTriggered(void);
@@ -3780,7 +3780,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
37803780
* Try to restore the file from archive, or read an existing
37813781
* file from pg_wal.
37823782
*/
3783-
readFile=XLogFileReadAnyTLI(readSegNo,DEBUG2,
3783+
readFile=XLogFileReadAnyTLI(readSegNo,
37843784
currentSource==XLOG_FROM_ARCHIVE ?XLOG_FROM_ANY :
37853785
currentSource);
37863786
if (readFile >=0)
@@ -3929,8 +3929,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
39293929
{
39303930
if (!expectedTLEs)
39313931
expectedTLEs=readTimeLineHistory(recoveryTargetTLI);
3932-
readFile=XLogFileRead(readSegNo,PANIC,
3933-
receiveTLI,
3932+
readFile=XLogFileRead(readSegNo,receiveTLI,
39343933
XLOG_FROM_STREAM, false);
39353934
Assert(readFile >=0);
39363935
}
@@ -4201,7 +4200,7 @@ rescanLatestTimeLine(TimeLineID replayTLI, XLogRecPtr replayLSN)
42014200
* Otherwise, it's assumed to be already available in pg_wal.
42024201
*/
42034202
staticint
4204-
XLogFileRead(XLogSegNosegno,intemode,TimeLineIDtli,
4203+
XLogFileRead(XLogSegNosegno,TimeLineIDtli,
42054204
XLogSourcesource,boolnotfoundOk)
42064205
{
42074206
charxlogfname[MAXFNAMELEN];
@@ -4283,7 +4282,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
42834282
* This version searches for the segment with any TLI listed in expectedTLEs.
42844283
*/
42854284
staticint
4286-
XLogFileReadAnyTLI(XLogSegNosegno,intemode,XLogSourcesource)
4285+
XLogFileReadAnyTLI(XLogSegNosegno,XLogSourcesource)
42874286
{
42884287
charpath[MAXPGPATH];
42894288
ListCell*cell;
@@ -4347,8 +4346,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
43474346

43484347
if (source==XLOG_FROM_ANY||source==XLOG_FROM_ARCHIVE)
43494348
{
4350-
fd=XLogFileRead(segno,emode,tli,
4351-
XLOG_FROM_ARCHIVE, true);
4349+
fd=XLogFileRead(segno,tli,XLOG_FROM_ARCHIVE, true);
43524350
if (fd!=-1)
43534351
{
43544352
elog(DEBUG1,"got WAL segment from archive");
@@ -4360,8 +4358,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
43604358

43614359
if (source==XLOG_FROM_ANY||source==XLOG_FROM_PG_WAL)
43624360
{
4363-
fd=XLogFileRead(segno,emode,tli,
4364-
XLOG_FROM_PG_WAL, true);
4361+
fd=XLogFileRead(segno,tli,XLOG_FROM_PG_WAL, true);
43654362
if (fd!=-1)
43664363
{
43674364
if (!expectedTLEs)
@@ -4374,7 +4371,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
43744371
/* Couldn't find it. For simplicity, complain about front timeline */
43754372
XLogFilePath(path,recoveryTargetTLI,segno,wal_segment_size);
43764373
errno=ENOENT;
4377-
ereport(emode,
4374+
ereport(DEBUG2,
43784375
(errcode_for_file_access(),
43794376
errmsg("could not open file \"%s\": %m",path)));
43804377
return-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp