diff options
author | Andres Freund | 2017-04-23 22:48:31 +0000 |
---|---|---|
committer | Andres Freund | 2017-04-23 22:54:41 +0000 |
commit | eb97aa7e65627c602f559207a5a104cacbdd585f (patch) | |
tree | 57cfa0a0aab77b23dd20acada9e3c956017041b5 | |
parent | e84d243b1ce6366e8415cefc623ca53e73a20393 (diff) |
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/[email protected]
Backpatch: 9.5, where replication origins were introduced
-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 5eaf863e02..c17f8ad277 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -559,6 +559,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; |