• Tom Lane's avatar
    Fix bogus initialization of replication origin shared memory state. · 80484049
    Tom Lane authored
    The previous coding zeroed out offsetof(ReplicationStateCtl, states)
    more bytes than it was entitled to, as a consequence of starting the
    zeroing from the wrong pointer (or, if you prefer, using the wrong
    calculation of how much to zero).
    
    It's unsurprising that this has not caused any reported problems,
    since it can be expected that the newly-allocated block is at the end
    of what we've used in shared memory, and we always make the shmem
    block substantially bigger than minimally necessary.  Nonetheless,
    this is wrong and it could bite us someday; plus it's a dangerous
    model for somebody to copy.
    
    This dates back to the introduction of this code (commit 5aa23504),
    so back-patch to all supported branches.
    80484049
origin.c 41.5 KB