replication_slot_catalog_xmin not explicitly initialized when creating procArray

Started by Wong, Yi Wenover 8 years ago3 messages
#1Wong, Yi Wen
yiwong@amazon.com
1 attachment(s)

Hi,

replication_slot_catalog_xmin is not explictly initialized to InvalidTransactionId.

Normally, there isn't an issue with this because a freshly mmap'd memory is zeroed, and the value of InvalidTransactionId is 0.

If the memory was not 0 for whatever reason, VACUUM would not behave as expected.

See attached patch.

Thanks,

Yi Wen

Attachments:

init_catalog_xmin.patchapplication/octet-stream; name=init_catalog_xmin.patchDownload
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 6eb7c72..fdeb766 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -238,6 +238,7 @@ CreateSharedProcArray(void)
 		procArray->numProcs = 0;
 		procArray->maxProcs = PROCARRAY_MAXPROCS;
 		procArray->replication_slot_xmin = InvalidTransactionId;
+		procArray->replication_slot_catalog_xmin = InvalidTransactionId;
 		procArray->maxKnownAssignedXids = TOTAL_MAX_CACHED_SUBXIDS;
 		procArray->numKnownAssignedXids = 0;
 		procArray->tailKnownAssignedXids = 0;
#2Masahiko Sawada
sawada.mshk@gmail.com
In reply to: Wong, Yi Wen (#1)
Re: replication_slot_catalog_xmin not explicitly initialized when creating procArray

On Sat, Jul 8, 2017 at 2:19 AM, Wong, Yi Wen <yiwong@amazon.com> wrote:

Hi,

replication_slot_catalog_xmin is not explictly initialized to
InvalidTransactionId.

Normally, there isn't an issue with this because a freshly mmap'd memory is
zeroed, and the value of InvalidTransactionId is 0.

If the memory was not 0 for whatever reason, VACUUM would not behave as
expected.

See attached patch.

Thank you for the patch. This change makes sense to me.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Peter Eisentraut
peter.eisentraut@2ndquadrant.com
In reply to: Masahiko Sawada (#2)
Re: replication_slot_catalog_xmin not explicitly initialized when creating procArray

On 7/9/17 21:23, Masahiko Sawada wrote:

On Sat, Jul 8, 2017 at 2:19 AM, Wong, Yi Wen <yiwong@amazon.com> wrote:

replication_slot_catalog_xmin is not explictly initialized to
InvalidTransactionId.

Thank you for the patch. This change makes sense to me.

Committed and backpatched

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers