2014-02-01 04:45:17 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* slot.h
|
|
|
|
* Replication slot management.
|
|
|
|
*
|
2018-01-03 05:30:12 +01:00
|
|
|
* Copyright (c) 2012-2018, PostgreSQL Global Development Group
|
2014-02-01 04:45:17 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef SLOT_H
|
|
|
|
#define SLOT_H
|
|
|
|
|
|
|
|
#include "fmgr.h"
|
|
|
|
#include "access/xlog.h"
|
|
|
|
#include "access/xlogreader.h"
|
2017-07-25 19:26:49 +02:00
|
|
|
#include "storage/condition_variable.h"
|
2014-02-01 04:45:17 +01:00
|
|
|
#include "storage/lwlock.h"
|
|
|
|
#include "storage/shmem.h"
|
|
|
|
#include "storage/spin.h"
|
|
|
|
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
/*
|
|
|
|
* Behaviour of replication slots, upon release or crash.
|
|
|
|
*
|
2017-07-25 19:26:49 +02:00
|
|
|
* Slots marked as PERSISTENT are crash-safe and will not be dropped when
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
* released. Slots marked as EPHEMERAL will be dropped when released or after
|
2017-08-23 20:59:25 +02:00
|
|
|
* restarts. Slots marked TEMPORARY will be dropped at the end of a session
|
|
|
|
* or on error.
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
*
|
2017-08-23 20:59:25 +02:00
|
|
|
* EPHEMERAL is used as a not-quite-ready state when creating persistent
|
|
|
|
* slots. EPHEMERAL slots can be made PERSISTENT by calling
|
|
|
|
* ReplicationSlotPersist(). For a slot that goes away at the end of a
|
|
|
|
* session, TEMPORARY is the appropriate choice.
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
*/
|
|
|
|
typedef enum ReplicationSlotPersistency
|
|
|
|
{
|
|
|
|
RS_PERSISTENT,
|
2016-12-08 18:00:00 +01:00
|
|
|
RS_EPHEMERAL,
|
|
|
|
RS_TEMPORARY
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
} ReplicationSlotPersistency;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* On-Disk data of a replication slot, preserved across restarts.
|
|
|
|
*/
|
2014-02-01 04:45:17 +01:00
|
|
|
typedef struct ReplicationSlotPersistentData
|
|
|
|
{
|
|
|
|
/* The slot's identifier */
|
|
|
|
NameData name;
|
|
|
|
|
|
|
|
/* database the slot is active on */
|
|
|
|
Oid database;
|
|
|
|
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
/*
|
|
|
|
* The slot's behaviour when being dropped (or restored after a crash).
|
|
|
|
*/
|
|
|
|
ReplicationSlotPersistency persistency;
|
|
|
|
|
2014-02-01 04:45:17 +01:00
|
|
|
/*
|
|
|
|
* xmin horizon for data
|
|
|
|
*
|
|
|
|
* NB: This may represent a value that hasn't been written to disk yet;
|
|
|
|
* see notes for effective_xmin, below.
|
|
|
|
*/
|
|
|
|
TransactionId xmin;
|
|
|
|
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
/*
|
|
|
|
* xmin horizon for catalog tuples
|
|
|
|
*
|
|
|
|
* NB: This may represent a value that hasn't been written to disk yet;
|
|
|
|
* see notes for effective_xmin, below.
|
|
|
|
*/
|
|
|
|
TransactionId catalog_xmin;
|
|
|
|
|
2014-02-01 04:45:17 +01:00
|
|
|
/* oldest LSN that might be required by this replication slot */
|
|
|
|
XLogRecPtr restart_lsn;
|
|
|
|
|
2016-05-02 21:04:29 +02:00
|
|
|
/*
|
|
|
|
* Oldest LSN that the client has acked receipt for. This is used as the
|
|
|
|
* start_lsn point in case the client doesn't specify one, and also as a
|
2016-05-02 21:46:42 +02:00
|
|
|
* safety measure to jump forwards in case the client specifies a
|
|
|
|
* start_lsn that's further in the past than this value.
|
2016-05-02 21:04:29 +02:00
|
|
|
*/
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
XLogRecPtr confirmed_flush;
|
|
|
|
|
|
|
|
/* plugin name */
|
|
|
|
NameData plugin;
|
2014-02-01 04:45:17 +01:00
|
|
|
} ReplicationSlotPersistentData;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Shared memory state of a single replication slot.
|
2018-06-01 20:30:55 +02:00
|
|
|
*
|
|
|
|
* The in-memory data of replication slots follows a locking model based
|
|
|
|
* on two linked concepts:
|
|
|
|
* - A replication slot's in_use flag is switched when added or discarded using
|
|
|
|
* the LWLock ReplicationSlotControlLock, which needs to be hold in exclusive
|
|
|
|
* mode when updating the flag by the backend owning the slot and doing the
|
|
|
|
* operation, while readers (concurrent backends not owning the slot) need
|
|
|
|
* to hold it in shared mode when looking at replication slot data.
|
|
|
|
* - Individual fields are protected by mutex where only the backend owning
|
|
|
|
* the slot is authorized to update the fields from its own slot. The
|
|
|
|
* backend owning the slot does not need to take this lock when reading its
|
|
|
|
* own fields, while concurrent backends not owning this slot should take the
|
|
|
|
* lock when reading this slot's data.
|
2014-02-01 04:45:17 +01:00
|
|
|
*/
|
|
|
|
typedef struct ReplicationSlot
|
|
|
|
{
|
|
|
|
/* lock, on same cacheline as effective_xmin */
|
|
|
|
slock_t mutex;
|
|
|
|
|
|
|
|
/* is this slot defined */
|
|
|
|
bool in_use;
|
|
|
|
|
2015-04-21 11:51:06 +02:00
|
|
|
/* Who is streaming out changes for this slot? 0 in unused slots. */
|
|
|
|
pid_t active_pid;
|
2014-02-01 04:45:17 +01:00
|
|
|
|
|
|
|
/* any outstanding modifications? */
|
|
|
|
bool just_dirtied;
|
|
|
|
bool dirty;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For logical decoding, it's extremely important that we never remove any
|
|
|
|
* data that's still needed for decoding purposes, even after a crash;
|
|
|
|
* otherwise, decoding will produce wrong answers. Ordinary streaming
|
|
|
|
* replication also needs to prevent old row versions from being removed
|
2014-05-06 18:12:18 +02:00
|
|
|
* 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 xmin that has actually been
|
|
|
|
* written to disk, whereas for streaming replication, it's just the same
|
|
|
|
* as the persistent value (data.xmin).
|
2014-02-01 04:45:17 +01:00
|
|
|
*/
|
|
|
|
TransactionId effective_xmin;
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
TransactionId effective_catalog_xmin;
|
2014-02-01 04:45:17 +01:00
|
|
|
|
|
|
|
/* data surviving shutdowns and crashes */
|
|
|
|
ReplicationSlotPersistentData data;
|
|
|
|
|
|
|
|
/* is somebody performing io on this slot? */
|
2016-01-29 15:44:29 +01:00
|
|
|
LWLock io_in_progress_lock;
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
|
2017-07-25 19:26:49 +02:00
|
|
|
/* Condition variable signalled when active_pid changes */
|
|
|
|
ConditionVariable active_cv;
|
|
|
|
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
/* all the remaining data is only used for logical slots */
|
|
|
|
|
2016-05-02 21:04:29 +02:00
|
|
|
/*
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
* When the client has confirmed flushes >= candidate_xmin_lsn we can
|
2016-05-02 21:04:29 +02:00
|
|
|
* advance the catalog xmin. When restart_valid has been passed,
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
* restart_lsn can be increased.
|
|
|
|
*/
|
|
|
|
TransactionId candidate_catalog_xmin;
|
|
|
|
XLogRecPtr candidate_xmin_lsn;
|
|
|
|
XLogRecPtr candidate_restart_valid;
|
|
|
|
XLogRecPtr candidate_restart_lsn;
|
2014-02-01 04:45:17 +01:00
|
|
|
} ReplicationSlot;
|
|
|
|
|
2015-08-11 12:32:48 +02:00
|
|
|
#define SlotIsPhysical(slot) (slot->data.database == InvalidOid)
|
|
|
|
#define SlotIsLogical(slot) (slot->data.database != InvalidOid)
|
|
|
|
|
2014-02-01 04:45:17 +01:00
|
|
|
/*
|
|
|
|
* Shared memory control area for all of replication slots.
|
|
|
|
*/
|
|
|
|
typedef struct ReplicationSlotCtlData
|
|
|
|
{
|
2015-02-21 07:46:43 +01:00
|
|
|
/*
|
|
|
|
* This array should be declared [FLEXIBLE_ARRAY_MEMBER], but for some
|
|
|
|
* reason you can't do that in an otherwise-empty struct.
|
|
|
|
*/
|
2014-02-01 04:45:17 +01:00
|
|
|
ReplicationSlot replication_slots[1];
|
|
|
|
} ReplicationSlotCtlData;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pointers to shared memory
|
|
|
|
*/
|
|
|
|
extern ReplicationSlotCtlData *ReplicationSlotCtl;
|
2016-03-31 04:06:34 +02:00
|
|
|
extern PGDLLIMPORT ReplicationSlot *MyReplicationSlot;
|
2014-02-01 04:45:17 +01:00
|
|
|
|
|
|
|
/* GUCs */
|
|
|
|
extern PGDLLIMPORT int max_replication_slots;
|
|
|
|
|
|
|
|
/* shmem initialization functions */
|
|
|
|
extern Size ReplicationSlotsShmemSize(void);
|
|
|
|
extern void ReplicationSlotsShmemInit(void);
|
|
|
|
|
|
|
|
/* management of individual slots */
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
extern void ReplicationSlotCreate(const char *name, bool db_specific,
|
2014-05-06 18:12:18 +02:00
|
|
|
ReplicationSlotPersistency p);
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
extern void ReplicationSlotPersist(void);
|
2017-07-25 19:26:49 +02:00
|
|
|
extern void ReplicationSlotDrop(const char *name, bool nowait);
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
|
2017-07-25 19:26:49 +02:00
|
|
|
extern void ReplicationSlotAcquire(const char *name, bool nowait);
|
2014-02-01 04:45:17 +01:00
|
|
|
extern void ReplicationSlotRelease(void);
|
2016-12-08 18:00:00 +01:00
|
|
|
extern void ReplicationSlotCleanup(void);
|
2014-02-01 04:45:17 +01:00
|
|
|
extern void ReplicationSlotSave(void);
|
|
|
|
extern void ReplicationSlotMarkDirty(void);
|
|
|
|
|
|
|
|
/* misc stuff */
|
|
|
|
extern bool ReplicationSlotValidateName(const char *name, int elevel);
|
2015-08-11 12:34:31 +02:00
|
|
|
extern void ReplicationSlotReserveWal(void);
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
extern void ReplicationSlotsComputeRequiredXmin(bool already_locked);
|
2014-02-01 04:45:17 +01:00
|
|
|
extern void ReplicationSlotsComputeRequiredLSN(void);
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
extern XLogRecPtr ReplicationSlotsComputeLogicalRestartLSN(void);
|
|
|
|
extern bool ReplicationSlotsCountDBSlots(Oid dboid, int *nslots, int *nactive);
|
2017-03-28 16:05:21 +02:00
|
|
|
extern void ReplicationSlotsDropDBSlots(Oid dboid);
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
|
2014-06-12 13:23:46 +02:00
|
|
|
extern void StartupReplicationSlots(void);
|
2014-02-01 04:45:17 +01:00
|
|
|
extern void CheckPointReplicationSlots(void);
|
|
|
|
|
|
|
|
extern void CheckSlotRequirements(void);
|
|
|
|
|
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:18:54 +02:00
|
|
|
#endif /* SLOT_H */
|