Rename data_xmin->xmin.
authorRobert Haas <rhaas@postgresql.org>
Thu, 30 Jan 2014 03:25:42 +0000 (22:25 -0500)
committerRobert Haas <rhaas@postgresql.org>
Thu, 30 Jan 2014 03:25:42 +0000 (22:25 -0500)
doc/src/sgml/catalogs.sgml
doc/src/sgml/high-availability.sgml
src/backend/catalog/system_views.sql
src/backend/replication/slot.c
src/backend/replication/slotfuncs.c
src/backend/replication/walsender.c
src/include/catalog/pg_proc.h
src/include/replication/slot.h
src/test/regress/expected/rules.out

index f9e62ccfae993843ec6e5c6560a221f6c679e363..19fe69ef12feb2b2df71f9af97ef194b62e2541a 100644 (file)
      </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>
 
index 18f8fb6fe755ae251779df2a702ead0ab07411b4..e3ab7f85c8dc9ff8006cf0d938c97edba554403a 100644 (file)
@@ -932,9 +932,9 @@ postgres=# SELECT * FROM create_physical_replication_slot('node_a_slot');
  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</>
index 85717f5b52e829a74b2d59db8688d5d9fb28543f..f02efeca974ef58b83a1b3a52aa8b3d35485cd47 100644 (file)
@@ -620,7 +620,7 @@ CREATE VIEW pg_replication_slots AS
             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);
index 89c77e1714de04e97b2ec708e9a460b2df4c28f5..17d026711c2e5af2aebe086c7e35b48f7e177f93 100644 (file)
@@ -246,8 +246,8 @@ ReplicationSlotCreate(const char *name, bool db_specific)
         */
        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;
@@ -525,7 +525,7 @@ void
 ReplicationSlotsComputeRequiredXmin(void)
 {
        int                     i;
-       TransactionId agg_data_xmin = InvalidTransactionId;
+       TransactionId agg_xmin = InvalidTransactionId;
 
        Assert(ReplicationSlotCtl != NULL);
 
@@ -533,7 +533,7 @@ ReplicationSlotsComputeRequiredXmin(void)
        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;
@@ -542,19 +542,19 @@ ReplicationSlotsComputeRequiredXmin(void)
                        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);
 }
 
 /*
@@ -1038,7 +1038,7 @@ RestoreSlotFromDisk(const char *name)
                           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;
 
index aa44826d0965382e49c80771d08ced62474d5fe9..3009cfc61429a32f956179fe9431582c6fafe59f 100644 (file)
@@ -136,7 +136,7 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
                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;
@@ -153,7 +153,7 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
                }
                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));
@@ -175,8 +175,8 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
                        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)
index d1edf7ed30674f941e45c39a131c2ae5e8eccc01..119a920af215b1c600b2239dd534111d41b6f31b 100644 (file)
@@ -1028,22 +1028,21 @@ PhysicalReplicationSlotNewXmin(TransactionId feedbackXmin)
 {
        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);
 
index 3aa174dcac2573082bb907a509e1ff9aadb2ad24..0dc5ebde310b184f6a851a91e0769a0be64ddd57 100644 (file)
@@ -4783,7 +4783,7 @@ DATA(insert OID = 3780 (  create_physical_replication_slot PGNSP PGUID 12 1 0 0
 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 */
index a0cc56b9c5c39c0a2d428f3a099d1aa525855f74..089b0f4b70cc27b7511badbf8e6c4070a555be0d 100644 (file)
@@ -28,9 +28,9 @@ typedef struct ReplicationSlotPersistentData
         * 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;
@@ -62,11 +62,11 @@ typedef struct ReplicationSlot
         * 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;
index f391f06b8224fafb8746d5139e94223ed30534a0..220e18b0bbdccdafa5ee26729987c43dd58d824a 100644 (file)
@@ -1372,9 +1372,9 @@ pg_replication_slots| SELECT l.slot_name,
     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,