mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Fix code comments regarding logical decoding
Back in 3b02ea4f07
I added some comments in various places to explain
how logical decoding and other things worked. Not all of the changes
were welcome, because they were misleading or wrong. This changes them
a little bit to make them more accurate.
Some other comments are also changed to be more accurate. Also, fix a
bunch of typos.
Author: Álvaro Herrera, Craig Ringer
Andres Freund reviewed some parts of this.
This commit is contained in:
@ -305,10 +305,18 @@ CreateInitDecodingContext(char *plugin,
|
||||
* Create a new decoding context, for a logical slot that has previously been
|
||||
* used already.
|
||||
*
|
||||
* start_lsn contains the LSN of the last received data or InvalidXLogRecPtr
|
||||
* output_plugin_options contains options passed to the output plugin
|
||||
* read_page, prepare_write, do_write are callbacks that have to be filled to
|
||||
* perform the use-case dependent, actual, work.
|
||||
* start_lsn
|
||||
* The LSN at which to start decoding. If InvalidXLogRecPtr, restart
|
||||
* from the slot's confirmed_flush; otherwise, start from the specified
|
||||
* location (but move it forwards to confirmed_flush if it's older than
|
||||
* that, see below).
|
||||
*
|
||||
* output_plugin_options
|
||||
* contains options passed to the output plugin.
|
||||
*
|
||||
* read_page, prepare_write, do_write
|
||||
* callbacks that have to be filled to perform the use-case dependent,
|
||||
* actual work.
|
||||
*
|
||||
* Needs to be called while in a memory context that's at least as long lived
|
||||
* as the decoding context because further memory contexts will be created
|
||||
@ -745,7 +753,7 @@ message_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
|
||||
* replication slot.
|
||||
*
|
||||
* Note that in the most cases, we won't be able to immediately use the xmin
|
||||
* to increase the xmin horizon, we need to wait till the client has confirmed
|
||||
* to increase the xmin horizon: we need to wait till the client has confirmed
|
||||
* receiving current_lsn with LogicalConfirmReceivedLocation().
|
||||
*/
|
||||
void
|
||||
@ -890,7 +898,7 @@ LogicalConfirmReceivedLocation(XLogRecPtr lsn)
|
||||
|
||||
MyReplicationSlot->data.confirmed_flush = lsn;
|
||||
|
||||
/* if were past the location required for bumping xmin, do so */
|
||||
/* if we're past the location required for bumping xmin, do so */
|
||||
if (MyReplicationSlot->candidate_xmin_lsn != InvalidXLogRecPtr &&
|
||||
MyReplicationSlot->candidate_xmin_lsn <= lsn)
|
||||
{
|
||||
@ -926,7 +934,7 @@ LogicalConfirmReceivedLocation(XLogRecPtr lsn)
|
||||
|
||||
SpinLockRelease(&MyReplicationSlot->mutex);
|
||||
|
||||
/* first write new xmin to disk, so we know whats up after a crash */
|
||||
/* first write new xmin to disk, so we know what's up after a crash */
|
||||
if (updated_xmin || updated_restart)
|
||||
{
|
||||
ReplicationSlotMarkDirty();
|
||||
|
Reference in New Issue
Block a user