From 52b4854a9afd82fa4d7a707f589a5740e854b42a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 9 Jul 2018 14:28:21 -0400 Subject: [PATCH] Flip argument order in XLogSegNoOffsetToRecPtr MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Commit fc49e24fa69a added an input argument after the existing output argument. Flip those. Author: Álvaro Herrera Reviewed-by: Andres Freund Discussion: https://postgr.es/m/20180708182345.imdgovmkffgtihhk@alvherre.pgsql --- src/backend/access/transam/xlog.c | 4 ++-- src/backend/access/transam/xlogreader.c | 2 +- src/backend/replication/logical/reorderbuffer.c | 2 +- src/bin/pg_basebackup/pg_receivewal.c | 2 +- src/bin/pg_resetwal/pg_resetwal.c | 4 ++-- src/bin/pg_rewind/parsexlog.c | 2 +- src/bin/pg_waldump/pg_waldump.c | 8 ++++---- src/include/access/xlog_internal.h | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 4aaa8fb748..56c68775df 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -1971,7 +1971,7 @@ XLogBytePosToRecPtr(uint64 bytepos) seg_offset += fullpages * XLOG_BLCKSZ + bytesleft + SizeOfXLogShortPHD; } - XLogSegNoOffsetToRecPtr(fullsegs, seg_offset, result, wal_segment_size); + XLogSegNoOffsetToRecPtr(fullsegs, seg_offset, wal_segment_size, result); return result; } @@ -2017,7 +2017,7 @@ XLogBytePosToEndRecPtr(uint64 bytepos) seg_offset += fullpages * XLOG_BLCKSZ + bytesleft + SizeOfXLogShortPHD; } - XLogSegNoOffsetToRecPtr(fullsegs, seg_offset, result, wal_segment_size); + XLogSegNoOffsetToRecPtr(fullsegs, seg_offset, wal_segment_size, result); return result; } diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index dd96cef8f0..4c633c6c49 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -747,7 +747,7 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr, XLByteToSeg(recptr, segno, state->wal_segment_size); offset = XLogSegmentOffset(recptr, state->wal_segment_size); - XLogSegNoOffsetToRecPtr(segno, offset, recaddr, state->wal_segment_size); + XLogSegNoOffsetToRecPtr(segno, offset, state->wal_segment_size, recaddr); if (hdr->xlp_magic != XLOG_PAGE_MAGIC) { diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index d3ec137051..9b55b94227 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2782,7 +2782,7 @@ ReorderBufferSerializedPath(char *path, ReplicationSlot *slot, TransactionId xid { XLogRecPtr recptr; - XLogSegNoOffsetToRecPtr(segno, 0, recptr, wal_segment_size); + XLogSegNoOffsetToRecPtr(segno, 0, wal_segment_size, recptr); snprintf(path, MAXPGPATH, "pg_replslot/%s/xid-%u-lsn-%X-%X.snap", NameStr(MyReplicationSlot->data.name), diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c index 071b32d19d..ed9d7f6378 100644 --- a/src/bin/pg_basebackup/pg_receivewal.c +++ b/src/bin/pg_basebackup/pg_receivewal.c @@ -352,7 +352,7 @@ FindStreamingStart(uint32 *tli) if (!high_ispartial) high_segno++; - XLogSegNoOffsetToRecPtr(high_segno, 0, high_ptr, WalSegSz); + XLogSegNoOffsetToRecPtr(high_segno, 0, WalSegSz, high_ptr); *tli = high_tli; return high_ptr; diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 8cff535692..d63a3a27f6 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -933,8 +933,8 @@ RewriteControlFile(void) * Adjust fields as needed to force an empty XLOG starting at * newXlogSegNo. */ - XLogSegNoOffsetToRecPtr(newXlogSegNo, SizeOfXLogLongPHD, - ControlFile.checkPointCopy.redo, WalSegSz); + XLogSegNoOffsetToRecPtr(newXlogSegNo, SizeOfXLogLongPHD, WalSegSz, + ControlFile.checkPointCopy.redo); ControlFile.checkPointCopy.time = (pg_time_t) time(NULL); ControlFile.state = DB_SHUTDOWNED; diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c index b4c1f827a6..1689279767 100644 --- a/src/bin/pg_rewind/parsexlog.c +++ b/src/bin/pg_rewind/parsexlog.c @@ -248,7 +248,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, XLogSegNo targetSegNo; XLByteToSeg(targetPagePtr, targetSegNo, WalSegSz); - XLogSegNoOffsetToRecPtr(targetSegNo + 1, 0, targetSegEnd, WalSegSz); + XLogSegNoOffsetToRecPtr(targetSegNo + 1, 0, WalSegSz, targetSegEnd); targetPageOff = XLogSegmentOffset(targetPagePtr, WalSegSz); /* diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c index 5c4f38e597..d41b831b18 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -1039,7 +1039,7 @@ main(int argc, char **argv) XLogFromFileName(fname, &private.timeline, &segno, WalSegSz); if (XLogRecPtrIsInvalid(private.startptr)) - XLogSegNoOffsetToRecPtr(segno, 0, private.startptr, WalSegSz); + XLogSegNoOffsetToRecPtr(segno, 0, WalSegSz, private.startptr); else if (!XLByteInSeg(private.startptr, segno, WalSegSz)) { fprintf(stderr, @@ -1053,7 +1053,7 @@ main(int argc, char **argv) /* no second file specified, set end position */ if (!(optind + 1 < argc) && XLogRecPtrIsInvalid(private.endptr)) - XLogSegNoOffsetToRecPtr(segno + 1, 0, private.endptr, WalSegSz); + XLogSegNoOffsetToRecPtr(segno + 1, 0, WalSegSz, private.endptr); /* parse ENDSEG if passed */ if (optind + 1 < argc) @@ -1076,8 +1076,8 @@ main(int argc, char **argv) argv[optind + 1], argv[optind]); if (XLogRecPtrIsInvalid(private.endptr)) - XLogSegNoOffsetToRecPtr(endsegno + 1, 0, private.endptr, - WalSegSz); + XLogSegNoOffsetToRecPtr(endsegno + 1, 0, WalSegSz, + private.endptr); /* set segno to endsegno for check of --end */ segno = endsegno; diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 7c766836db..30610b3ea9 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -101,7 +101,7 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; #define XLogSegmentsPerXLogId(wal_segsz_bytes) \ (UINT64CONST(0x100000000) / (wal_segsz_bytes)) -#define XLogSegNoOffsetToRecPtr(segno, offset, dest, wal_segsz_bytes) \ +#define XLogSegNoOffsetToRecPtr(segno, offset, wal_segsz_bytes, dest) \ (dest) = (segno) * (wal_segsz_bytes) + (offset) #define XLogSegmentOffset(xlogptr, wal_segsz_bytes) \ -- 2.40.0