</row>
<row>
- <entry><structfield>data_xmin</structfield></entry>
+ <entry><structfield>xmin</structfield></entry>
<entry><type>xid</type></entry>
<entry></entry>
- <entry>The <literal>xmin</literal>, or oldest transaction ID, of
- user data that this slot forces to be retained in the database.
- <literal>VACUUM</literal> cannot remove tuples whose
- <literal>xmax</literal> is greater than this.
+ <entry>The oldest transaction that this slot needs the database to
+ retain. <literal>VACUUM</literal> cannot remove tuples deleted
+ by any later transaction.
</entry>
</row>
node_a_slot |
postgres=# SELECT * FROM pg_replication_slots;
- slot_name | slot_type | datoid | database | active | data_xmin | restart_lsn
--------------+-----------+--------+----------+--------+-----------+-------------
- node_a_slot | physical | 0 | | f | 0 | 0/0
+ slot_name | slot_type | datoid | database | active | xmin | restart_lsn
+-------------+-----------+--------+----------+--------+------+-------------
+ node_a_slot | physical | 0 | | f | 0 | 0/0
(1 row)
</programlisting>
To configure the standby to use this slot, <varname>primary_slotname</>
L.datoid,
D.datname AS database,
L.active,
- L.data_xmin,
+ L.xmin,
L.restart_lsn
FROM pg_get_replication_slots() AS L
LEFT JOIN pg_database D ON (L.datoid = D.oid);
*/
Assert(!slot->in_use);
Assert(!slot->active);
- slot->data.data_xmin = InvalidTransactionId;
- slot->effective_data_xmin = InvalidTransactionId;
+ slot->data.xmin = InvalidTransactionId;
+ slot->effective_xmin = InvalidTransactionId;
strncpy(NameStr(slot->data.name), name, NAMEDATALEN);
NameStr(slot->data.name)[NAMEDATALEN - 1] = '\0';
slot->data.database = db_specific ? MyDatabaseId : InvalidOid;
ReplicationSlotsComputeRequiredXmin(void)
{
int i;
- TransactionId agg_data_xmin = InvalidTransactionId;
+ TransactionId agg_xmin = InvalidTransactionId;
Assert(ReplicationSlotCtl != NULL);
for (i = 0; i < max_replication_slots; i++)
{
ReplicationSlot *s = &ReplicationSlotCtl->replication_slots[i];
- TransactionId effective_data_xmin;
+ TransactionId effective_xmin;
if (!s->in_use)
continue;
volatile ReplicationSlot *vslot = s;
SpinLockAcquire(&s->mutex);
- effective_data_xmin = vslot->effective_data_xmin;
+ effective_xmin = vslot->effective_xmin;
SpinLockRelease(&s->mutex);
}
/* check the data xmin */
- if (TransactionIdIsValid(effective_data_xmin) &&
- (!TransactionIdIsValid(agg_data_xmin) ||
- TransactionIdPrecedes(effective_data_xmin, agg_data_xmin)))
- agg_data_xmin = effective_data_xmin;
+ if (TransactionIdIsValid(effective_xmin) &&
+ (!TransactionIdIsValid(agg_xmin) ||
+ TransactionIdPrecedes(effective_xmin, agg_xmin)))
+ agg_xmin = effective_xmin;
}
LWLockRelease(ReplicationSlotControlLock);
- ProcArraySetReplicationSlotXmin(agg_data_xmin);
+ ProcArraySetReplicationSlotXmin(agg_xmin);
}
/*
sizeof(ReplicationSlotPersistentData));
/* initialize in memory state */
- slot->effective_data_xmin = cp.slotdata.data_xmin;
+ slot->effective_xmin = cp.slotdata.xmin;
slot->in_use = true;
slot->active = false;
Datum values[PG_STAT_GET_REPLICATION_SLOTS_COLS];
bool nulls[PG_STAT_GET_REPLICATION_SLOTS_COLS];
- TransactionId data_xmin;
+ TransactionId xmin;
XLogRecPtr restart_lsn;
bool active;
Oid database;
}
else
{
- data_xmin = slot->data.data_xmin;
+ xmin = slot->data.xmin;
database = slot->data.database;
restart_lsn = slot->data.restart_lsn;
slot_name = pstrdup(NameStr(slot->data.name));
values[i++] = CStringGetTextDatum("logical");
values[i++] = database;
values[i++] = BoolGetDatum(active);
- if (data_xmin != InvalidTransactionId)
- values[i++] = TransactionIdGetDatum(data_xmin);
+ if (xmin != InvalidTransactionId)
+ values[i++] = TransactionIdGetDatum(xmin);
else
nulls[i++] = true;
if (restart_lsn != InvalidTransactionId)
{
bool changed = false;
volatile ReplicationSlot *slot = MyReplicationSlot;
- SpinLockAcquire(&slot->mutex);
+ SpinLockAcquire(&slot->mutex);
MyPgXact->xmin = InvalidTransactionId;
-
/*
* For physical replication we don't need the the interlock provided
- * by data_xmin and effective_data_xmin since the consequences of a
- * missed increase aren't bad, so set both at once.
+ * by xmin and effective_xmin since the consequences of a missed increase
+ * are limited to query cancellations, so set both at once.
*/
- if (!TransactionIdIsNormal(slot->data.data_xmin) ||
+ if (!TransactionIdIsNormal(slot->data.xmin) ||
!TransactionIdIsNormal(feedbackXmin) ||
- TransactionIdPrecedes(slot->data.data_xmin, feedbackXmin))
+ TransactionIdPrecedes(slot->data.xmin, feedbackXmin))
{
changed = true;
- slot->data.data_xmin = feedbackXmin;
- slot->effective_data_xmin = feedbackXmin;
+ slot->data.xmin = feedbackXmin;
+ slot->effective_xmin = feedbackXmin;
}
SpinLockRelease(&slot->mutex);
DESCR("create a physical replication slot");
DATA(insert OID = 3781 ( drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 23 "19" _null_ _null_ _null_ _null_ drop_replication_slot _null_ _null_ _null_ ));
DESCR("drop a replication slot");
-DATA(insert OID = 3475 ( pg_get_replication_slots PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{25,25,26,16,28,25}" "{o,o,o,o,o,o}" "{slot_name,slot_type,datoid,active,data_xmin,restart_lsn}" _null_ pg_get_replication_slots _null_ _null_ _null_ ));
+DATA(insert OID = 3475 ( pg_get_replication_slots PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{25,25,26,16,28,25}" "{o,o,o,o,o,o}" "{slot_name,slot_type,datoid,active,xmin,restart_lsn}" _null_ pg_get_replication_slots _null_ _null_ _null_ ));
DESCR("information about replication slots currently in use");
/* event triggers */
* xmin horizon for data
*
* NB: This may represent a value that hasn't been written to disk yet;
- * see notes for effective_data_xmin, below.
+ * see notes for effective_xmin, below.
*/
- TransactionId data_xmin;
+ TransactionId xmin;
/* oldest LSN that might be required by this replication slot */
XLogRecPtr restart_lsn;
* replication also needs to prevent old row versions from being removed
* too soon, but the worst consequence we might encounter there is unwanted
* query cancellations on the standby. Thus, for logical decoding,
- * this value represents the latest data_xmin that has actually been
+ * this value represents the latest xmin that has actually been
* written to disk, whereas for streaming replication, it's just the
- * same as the persistent value (data.data_xmin).
+ * same as the persistent value (data.xmin).
*/
- TransactionId effective_data_xmin;
+ TransactionId effective_xmin;
/* data surviving shutdowns and crashes */
ReplicationSlotPersistentData data;
l.datoid,
d.datname AS database,
l.active,
- l.data_xmin,
+ l.xmin,
l.restart_lsn
- FROM (pg_get_replication_slots() l(slot_name, slot_type, datoid, active, data_xmin, restart_lsn)
+ FROM (pg_get_replication_slots() l(slot_name, slot_type, datoid, active, xmin, restart_lsn)
LEFT JOIN pg_database d ON ((l.datoid = d.oid)));
pg_roles| SELECT pg_authid.rolname,
pg_authid.rolsuper,