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

Commit71e0d0a

Browse files
committed
Tidy up XLogSource code in xlog.c.
This commit replaces 0 used as an initial value of XLogSource variable,with XLOG_FROM_ANY. Also this commit changes those variable so thatXLogSource instead of int is used as the type for them. These changesare for code readability and debugger-friendliness.Author: Kyotaro HoriguchiReviewed-by: Fujii MasaoDiscussion:https://postgr.es/m/20200227.124830.2197604521555566121.horikyota.ntt@gmail.com
1 parent8728b2c commit71e0d0a

File tree

1 file changed

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

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ static intreadFile = -1;
795795
staticXLogSegNoreadSegNo=0;
796796
staticuint32readOff=0;
797797
staticuint32readLen=0;
798-
staticXLogSourcereadSource=0;/* XLOG_FROM_* code */
798+
staticXLogSourcereadSource=XLOG_FROM_ANY;
799799

800800
/*
801801
* Keeps track of which source we're currently reading from. This is
@@ -804,7 +804,7 @@ static XLogSource readSource = 0;/* XLOG_FROM_* code */
804804
* attempt to read from currentSource failed, and we should try another source
805805
* next.
806806
*/
807-
staticXLogSourcecurrentSource=0;/* XLOG_FROM_* code */
807+
staticXLogSourcecurrentSource=XLOG_FROM_ANY;
808808
staticboollastSourceFailed= false;
809809

810810
typedefstructXLogPageReadPrivate
@@ -823,7 +823,7 @@ typedef struct XLogPageReadPrivate
823823
* XLogReceiptSource tracks where we last successfully read some WAL.)
824824
*/
825825
staticTimestampTzXLogReceiptTime=0;
826-
staticXLogSourceXLogReceiptSource=0;/* XLOG_FROM_* code */
826+
staticXLogSourceXLogReceiptSource=XLOG_FROM_ANY;
827827

828828
/* State information for XLOG reading */
829829
staticXLogRecPtrReadRecPtr;/* start of last record read */
@@ -886,8 +886,8 @@ static bool InstallXLogFileSegment(XLogSegNo *segno, char *tmppath,
886886
boolfind_free,XLogSegNomax_segno,
887887
booluse_lock);
888888
staticintXLogFileRead(XLogSegNosegno,intemode,TimeLineIDtli,
889-
intsource,boolnotfoundOk);
890-
staticintXLogFileReadAnyTLI(XLogSegNosegno,intemode,intsource);
889+
XLogSourcesource,boolnotfoundOk);
890+
staticintXLogFileReadAnyTLI(XLogSegNosegno,intemode,XLogSourcesource);
891891
staticintXLogPageRead(XLogReaderState*xlogreader,XLogRecPtrtargetPagePtr,
892892
intreqLen,XLogRecPtrtargetRecPtr,char*readBuf);
893893
staticboolWaitForWALToBecomeAvailable(XLogRecPtrRecPtr,boolrandAccess,
@@ -3633,7 +3633,7 @@ XLogFileOpen(XLogSegNo segno)
36333633
*/
36343634
staticint
36353635
XLogFileRead(XLogSegNosegno,intemode,TimeLineIDtli,
3636-
intsource,boolnotfoundOk)
3636+
XLogSourcesource,boolnotfoundOk)
36373637
{
36383638
charxlogfname[MAXFNAMELEN];
36393639
charactivitymsg[MAXFNAMELEN+16];
@@ -3715,7 +3715,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
37153715
* This version searches for the segment with any TLI listed in expectedTLEs.
37163716
*/
37173717
staticint
3718-
XLogFileReadAnyTLI(XLogSegNosegno,intemode,intsource)
3718+
XLogFileReadAnyTLI(XLogSegNosegno,intemode,XLogSourcesource)
37193719
{
37203720
charpath[MAXPGPATH];
37213721
ListCell*cell;
@@ -4387,7 +4387,7 @@ ReadRecord(XLogReaderState *xlogreader, int emode,
43874387
* so that we will check the archive next.
43884388
*/
43894389
lastSourceFailed= false;
4390-
currentSource=0;
4390+
currentSource=XLOG_FROM_ANY;
43914391

43924392
continue;
43934393
}
@@ -11673,7 +11673,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
1167311673

1167411674
close(readFile);
1167511675
readFile=-1;
11676-
readSource=0;
11676+
readSource=XLOG_FROM_ANY;
1167711677
}
1167811678

1167911679
XLByteToSeg(targetPagePtr,readSegNo,wal_segment_size);
@@ -11693,7 +11693,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
1169311693
close(readFile);
1169411694
readFile=-1;
1169511695
readLen=0;
11696-
readSource=0;
11696+
readSource=XLOG_FROM_ANY;
1169711697

1169811698
return-1;
1169911699
}
@@ -11799,7 +11799,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
1179911799
close(readFile);
1180011800
readFile=-1;
1180111801
readLen=0;
11802-
readSource=0;
11802+
readSource=XLOG_FROM_ANY;
1180311803

1180411804
/* In standby-mode, keep trying */
1180511805
if (StandbyMode)
@@ -11870,7 +11870,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
1187011870
*/
1187111871
if (!InArchiveRecovery)
1187211872
currentSource=XLOG_FROM_PG_WAL;
11873-
elseif (currentSource==0||
11873+
elseif (currentSource==XLOG_FROM_ANY||
1187411874
(!StandbyMode&&currentSource==XLOG_FROM_STREAM))
1187511875
{
1187611876
lastSourceFailed= false;
@@ -11879,7 +11879,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
1187911879

1188011880
for (;;)
1188111881
{
11882-
intoldSource=currentSource;
11882+
XLogSourceoldSource=currentSource;
1188311883

1188411884
/*
1188511885
* First check if we failed to read from the current source, and

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp