mirror of
https://github.com/postgres/postgres.git
synced 2026-05-26 19:28:27 -04:00
Use XLogRecPtrIsValid() consistently for WAL position checks
Commit a2b02293bc switched various checks to use XLogRecPtrIsValid(),
but later changes reintroduced XLogRecPtrIsInvalid() and direct comparisons
with InvalidXLogRecPtr.
This commit replaces those uses with XLogRecPtrIsValid() for better
readability and consistency.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>
Reviewed-by: Amul Sul <sulamul@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CALDaNm16knMFtcqyAG3XYSkyagmVXfhaR0T=hau8UTAU0+eLQQ@mail.gmail.com
This commit is contained in:
parent
4abcdc1bbe
commit
2fd84e2226
3 changed files with 5 additions and 5 deletions
|
|
@ -268,7 +268,7 @@ repack_setup_logical_decoding(Oid relid)
|
|||
ctx->reader->routine.page_read = read_local_xlog_page_no_wait;
|
||||
|
||||
/* Some WAL records should have been read. */
|
||||
Assert(ctx->reader->EndRecPtr != InvalidXLogRecPtr);
|
||||
Assert(XLogRecPtrIsValid(ctx->reader->EndRecPtr));
|
||||
|
||||
/*
|
||||
* Initialize repack_current_segment so that we can notice WAL segment
|
||||
|
|
|
|||
|
|
@ -1169,8 +1169,8 @@ XLogWalRcvSendReply(bool force, bool requestReply, bool checkApply)
|
|||
/* Construct a new message */
|
||||
writePtr = LogstreamResult.Write;
|
||||
flushPtr = LogstreamResult.Flush;
|
||||
applyPtr = (latestApplyPtr == InvalidXLogRecPtr) ?
|
||||
GetXLogReplayRecPtr(NULL) : latestApplyPtr;
|
||||
applyPtr = XLogRecPtrIsValid(latestApplyPtr) ?
|
||||
latestApplyPtr : GetXLogReplayRecPtr(NULL);
|
||||
|
||||
resetStringInfo(&reply_message);
|
||||
pq_sendbyte(&reply_message, PqReplMsg_StandbyStatusUpdate);
|
||||
|
|
|
|||
|
|
@ -216,11 +216,11 @@ init_archive_reader(XLogDumpPrivate *privateInfo,
|
|||
* With the WAL segment size available, we can now initialize the
|
||||
* dependent start and end segment numbers.
|
||||
*/
|
||||
Assert(!XLogRecPtrIsInvalid(privateInfo->startptr));
|
||||
Assert(XLogRecPtrIsValid(privateInfo->startptr));
|
||||
XLByteToSeg(privateInfo->startptr, privateInfo->start_segno,
|
||||
privateInfo->segsize);
|
||||
|
||||
if (!XLogRecPtrIsInvalid(privateInfo->endptr))
|
||||
if (XLogRecPtrIsValid(privateInfo->endptr))
|
||||
XLByteToSeg(privateInfo->endptr, privateInfo->end_segno,
|
||||
privateInfo->segsize);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue