0001-Use-InvalidXLogRecPtr-instead-of-MemSet-ptr-0-sizeof.patch
text/x-patch
Filename: 0001-Use-InvalidXLogRecPtr-instead-of-MemSet-ptr-0-sizeof.patch
Type: text/x-patch
Part: 0
Message:
Re: XLByte* usage
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch 0001
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 4 | 4 |
| src/backend/replication/walsender.c | 1 | 1 |
>From 4f5d486a830f8522f37200f739d928de0ed97051 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Mon, 17 Dec 2012 21:04:04 +0100 Subject: [PATCH 1/3] Use = InvalidXLogRecPtr instead of MemSet(&ptr, 0, sizeof(XLogRecPtr)) consistently --- src/backend/access/transam/xlog.c | 8 ++++---- src/backend/replication/walsender.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 2deb7e5..1354aa6 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5976,8 +5976,8 @@ StartupXLOG(void) LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); - MemSet(&ControlFile->backupStartPoint, 0, sizeof(XLogRecPtr)); - MemSet(&ControlFile->backupEndPoint, 0, sizeof(XLogRecPtr)); + ControlFile->backupStartPoint = InvalidXLogRecPtr; + ControlFile->backupEndPoint = InvalidXLogRecPtr; ControlFile->backupEndRequired = false; UpdateControlFile(); @@ -7336,7 +7336,7 @@ CreateCheckPoint(int flags) ControlFile->checkPointCopy = checkPoint; ControlFile->time = (pg_time_t) time(NULL); /* crash recovery should always recover to the end of WAL */ - MemSet(&ControlFile->minRecoveryPoint, 0, sizeof(XLogRecPtr)); + ControlFile->minRecoveryPoint = InvalidXLogRecPtr; ControlFile->minRecoveryPointTLI = 0; UpdateControlFile(); LWLockRelease(ControlFileLock); @@ -8148,7 +8148,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record) ControlFile->minRecoveryPoint = lsn; ControlFile->minRecoveryPointTLI = ThisTimeLineID; } - MemSet(&ControlFile->backupStartPoint, 0, sizeof(XLogRecPtr)); + ControlFile->backupStartPoint = InvalidXLogRecPtr; ControlFile->backupEndRequired = false; UpdateControlFile(); diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index aec57f5..b450b14 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1115,7 +1115,7 @@ InitWalSenderSlot(void) * Found a free slot. Reserve it for us. */ walsnd->pid = MyProcPid; - MemSet(&walsnd->sentPtr, 0, sizeof(XLogRecPtr)); + walsnd->sentPtr = InvalidXLogRecPtr; walsnd->state = WALSNDSTATE_STARTUP; SpinLockRelease(&walsnd->mutex); /* don't need the lock anymore */ -- 1.7.12.289.g0ce9864.dirty