typedef struct ReplicationStateCtl
{
+ /* Tranche to use for per-origin LWLocks */
int tranche_id;
+ /* Array of length max_replication_slots */
ReplicationState states[FLEXIBLE_ARRAY_MEMBER];
} ReplicationStateCtl;
* max_replication_slots?
*/
static ReplicationState *replication_states;
+
+/*
+ * Actual shared memory block (replication_states[] is now part of this).
+ */
static ReplicationStateCtl *replication_states_ctl;
/*
/*
* XXX: max_replication_slots is arguably the wrong thing to use, as here
* we keep the replay state of *remote* transactions. But for now it seems
- * sufficient to reuse it, lest we introduce a separate GUC.
+ * sufficient to reuse it, rather than introduce a separate GUC.
*/
if (max_replication_slots == 0)
return size;
{
int i;
- replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN;
+ MemSet(replication_states_ctl, 0, ReplicationOriginShmemSize());
- MemSet(replication_states, 0, ReplicationOriginShmemSize());
+ replication_states_ctl->tranche_id = LWTRANCHE_REPLICATION_ORIGIN;
for (i = 0; i < max_replication_slots; i++)
{