diff options
author | Andres Freund <andres@anarazel.de> | 2017-04-23 15:48:31 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-04-23 15:54:53 -0700 |
commit | 39369b41451e432396aa3a913cc4c68bf0f4ee3c (patch) | |
tree | ff4a1cb0ea04694f7b26fa49f3c68bbea28504db /src | |
parent | f5885488dacb62277c6452919e8961d27685675f (diff) | |
download | postgresql-39369b41451e432396aa3a913cc4c68bf0f4ee3c.tar.gz postgresql-39369b41451e432396aa3a913cc4c68bf0f4ee3c.zip |
Zero padding in replication origin's checkpointed on disk-state.
This seems to be largely cosmetic, avoiding valgrind bleats and the
like. The uninitialized padding influences the CRC of the on-disk
entry, but because it's also used when verifying the CRC, that doesn't
cause spurious failures. Backpatch nonetheless.
It's a bit unfortunate that contrib/test_decoding/sql/replorigin.sql
doesn't exercise the checkpoint path, but checkpoints are fairly
expensive on weaker machines, and we'd have to stop/start for that to
be meaningful.
Author: Andres Freund
Discussion: https://postgr.es/m/20170422183123.w2jgiuxtts7qrqaq@alap3.anarazel.de
Backpatch: 9.5, where replication origins were introduced
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/logical/origin.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index 78d9e9f17bb..0d0aa407baa 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -566,6 +566,9 @@ CheckPointReplicationOrigin(void) if (curstate->roident == InvalidRepOriginId) continue; + /* zero, to avoid uninitialized padding bytes */ + memset(&disk_state, 0, sizeof(disk_state)); + LWLockAcquire(&curstate->lock, LW_SHARED); disk_state.roident = curstate->roident; |