PostgreSQL Source Code
git master
|
#include "access/xlog.h"
#include "access/xlogdefs.h"
#include "access/xlogreader.h"
#include "catalog/pg_replication_origin.h"
Go to the source code of this file.
Data Structures | |
struct | xl_replorigin_set |
struct | xl_replorigin_drop |
Macros | |
#define | XLOG_REPLORIGIN_SET 0x00 |
#define | XLOG_REPLORIGIN_DROP 0x10 |
#define | InvalidRepOriginId 0 |
#define | DoNotReplicateId PG_UINT16_MAX |
Typedefs | |
typedef struct xl_replorigin_set | xl_replorigin_set |
typedef struct xl_replorigin_drop | xl_replorigin_drop |
Variables | |
PGDLLIMPORT RepOriginId | replorigin_session_origin |
PGDLLIMPORT XLogRecPtr | replorigin_session_origin_lsn |
PGDLLIMPORT TimestampTz | replorigin_session_origin_timestamp |
#define DoNotReplicateId PG_UINT16_MAX |
typedef struct xl_replorigin_drop xl_replorigin_drop |
typedef struct xl_replorigin_set xl_replorigin_set |
void CheckPointReplicationOrigin | ( | void | ) |
Definition at line 577 of file origin.c.
References CloseTransientFile(), COMP_CRC32C, crc, durable_rename(), ereport, errcode_for_file_access(), errmsg(), FIN_CRC32C, i, INIT_CRC32C, InvalidRepOriginId, ReplicationState::local_lsn, ReplicationState::lock, LW_SHARED, LWLockAcquire(), LWLockRelease(), max_replication_slots, OpenTransientFile(), PANIC, PG_BINARY, PG_REPLORIGIN_CHECKPOINT_FILENAME, PG_REPLORIGIN_CHECKPOINT_TMPFILE, ReplicationState::remote_lsn, ReplicationStateOnDisk::remote_lsn, REPLICATION_STATE_MAGIC, replication_states, ReplicationState::roident, ReplicationStateOnDisk::roident, write, and XLogFlush().
Referenced by CheckPointGuts().
void ReplicationOriginShmemInit | ( | void | ) |
Definition at line 530 of file origin.c.
References ConditionVariableInit(), i, LWLockInitialize(), LWTRANCHE_REPLICATION_ORIGIN_STATE, max_replication_slots, MemSet, replication_states, replication_states_ctl, ReplicationOriginShmemSize(), ShmemInitStruct(), ReplicationStateCtl::states, and ReplicationStateCtl::tranche_id.
Referenced by CreateOrAttachShmemStructs().
Size ReplicationOriginShmemSize | ( | void | ) |
Definition at line 510 of file origin.c.
References add_size(), max_replication_slots, mul_size(), and size.
Referenced by CalculateShmemSize(), and ReplicationOriginShmemInit().
void replorigin_advance | ( | RepOriginId | node, |
XLogRecPtr | remote_commit, | ||
XLogRecPtr | local_commit, | ||
bool | go_backward, | ||
bool | wal_log | ||
) |
Definition at line 892 of file origin.c.
References ReplicationState::acquired_by, Assert, DoNotReplicateId, ereport, errcode(), errhint(), errmsg(), ERROR, xl_replorigin_set::force, i, InvalidRepOriginId, InvalidXLogRecPtr, ReplicationState::local_lsn, ReplicationState::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), max_replication_slots, xl_replorigin_set::node_id, ReplicationState::remote_lsn, xl_replorigin_set::remote_lsn, replication_states, ReplicationState::roident, XLOG_REPLORIGIN_SET, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by binary_upgrade_replorigin_advance(), LogicalRepSyncTableStart(), pg_replication_origin_advance(), PrepareRedoAdd(), replorigin_redo(), xact_redo_abort(), and xact_redo_commit().
RepOriginId replorigin_by_name | ( | const char * | roname, |
bool | missing_ok | ||
) |
Definition at line 225 of file origin.c.
References CStringGetTextDatum, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, ident, InvalidOid, ReleaseSysCache(), and SearchSysCache1().
Referenced by AlterSubscription(), binary_upgrade_replorigin_advance(), LogicalRepSyncTableStart(), ParallelApplyWorkerMain(), pg_replication_origin_advance(), pg_replication_origin_oid(), pg_replication_origin_progress(), pg_replication_origin_session_setup(), replorigin_drop_by_name(), and run_apply_worker().
bool replorigin_by_oid | ( | RepOriginId | roident, |
bool | missing_ok, | ||
char ** | roname | ||
) |
Definition at line 469 of file origin.c.
References Assert, DoNotReplicateId, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, InvalidRepOriginId, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache1(), and text_to_cstring().
Referenced by errdetail_apply_conflict(), pg_show_replication_origin_status(), and send_repl_origin().
RepOriginId replorigin_create | ( | const char * | roname | ) |
Definition at line 256 of file origin.c.
References Assert, BTEqualStrategyNumber, CatalogTupleInsert(), CHECK_FOR_INTERRUPTS, CommandCounterIncrement(), CStringGetTextDatum, ereport, errcode(), errmsg(), ERROR, ExclusiveLock, heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, InitDirtySnapshot, InvalidOid, IsTransactionState(), sort-test::key, ObjectIdGetDatum(), PG_UINT16_MAX, RelationGetDescr, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and values.
Referenced by CreateSubscription(), LogicalRepSyncTableStart(), pg_replication_origin_create(), and run_apply_worker().
void replorigin_desc | ( | StringInfo | buf, |
XLogReaderState * | record | ||
) |
Definition at line 19 of file replorigindesc.c.
References appendStringInfo(), buf, xl_replorigin_set::force, LSN_FORMAT_ARGS, xl_replorigin_set::node_id, xl_replorigin_drop::node_id, xl_replorigin_set::remote_lsn, XLOG_REPLORIGIN_DROP, XLOG_REPLORIGIN_SET, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.
Definition at line 415 of file origin.c.
References AccessExclusiveLock, Assert, CatalogTupleDelete(), CommandCounterIncrement(), elog, ERROR, HeapTupleIsValid, IsTransactionState(), LockSharedObject(), name, NoLock, ObjectIdGetDatum(), ReleaseSysCache(), replorigin_by_name(), replorigin_state_clear(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), table_open(), and UnlockSharedObject().
Referenced by AlterSubscription_refresh(), DropSubscription(), pg_replication_origin_drop(), process_syncing_tables_for_apply(), and process_syncing_tables_for_sync().
XLogRecPtr replorigin_get_progress | ( | RepOriginId | node, |
bool | flush | ||
) |
Definition at line 1018 of file origin.c.
References i, InvalidXLogRecPtr, LW_SHARED, LWLockAcquire(), LWLockRelease(), max_replication_slots, replication_states, and XLogFlush().
Referenced by AlterSubscription(), and pg_replication_origin_progress().
const char* replorigin_identify | ( | uint8 | info | ) |
Definition at line 51 of file replorigindesc.c.
References XLOG_REPLORIGIN_DROP, and XLOG_REPLORIGIN_SET.
void replorigin_redo | ( | XLogReaderState * | record | ) |
Definition at line 831 of file origin.c.
References elog, XLogReaderState::EndRecPtr, xl_replorigin_set::force, i, InvalidRepOriginId, InvalidXLogRecPtr, max_replication_slots, xl_replorigin_set::node_id, xl_replorigin_drop::node_id, PANIC, xl_replorigin_set::remote_lsn, replication_states, replorigin_advance(), XLOG_REPLORIGIN_DROP, XLOG_REPLORIGIN_SET, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.
void replorigin_session_advance | ( | XLogRecPtr | remote_commit, |
XLogRecPtr | local_commit | ||
) |
Definition at line 1223 of file origin.c.
References Assert, InvalidRepOriginId, ReplicationState::local_lsn, ReplicationState::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), ReplicationState::remote_lsn, ReplicationState::roident, and session_replication_state.
Referenced by EndPrepare(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), and RecordTransactionCommitPrepared().
XLogRecPtr replorigin_session_get_progress | ( | bool | flush | ) |
Definition at line 1241 of file origin.c.
References Assert, InvalidXLogRecPtr, ReplicationState::local_lsn, ReplicationState::lock, LW_SHARED, LWLockAcquire(), LWLockRelease(), ReplicationState::remote_lsn, session_replication_state, and XLogFlush().
Referenced by LogicalRepSyncTableStart(), pg_replication_origin_session_progress(), and run_apply_worker().
void replorigin_session_reset | ( | void | ) |
Definition at line 1194 of file origin.c.
References ReplicationState::acquired_by, Assert, ConditionVariableBroadcast(), ereport, errcode(), errmsg(), ERROR, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), max_replication_slots, ReplicationState::origin_cv, and session_replication_state.
Referenced by pg_replication_origin_session_reset(), and process_syncing_tables_for_sync().
void replorigin_session_setup | ( | RepOriginId | node, |
int | acquired_by | ||
) |
Definition at line 1101 of file origin.c.
References ReplicationState::acquired_by, Assert, ConditionVariableBroadcast(), elog, ereport, errcode(), errhint(), errmsg(), ERROR, i, InvalidRepOriginId, InvalidXLogRecPtr, ReplicationState::local_lsn, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), max_replication_slots, MyProcPid, on_shmem_exit(), ReplicationState::origin_cv, ReplicationState::remote_lsn, replication_states, ReplicationOriginExitCleanup(), ReplicationState::roident, and session_replication_state.
Referenced by LogicalRepSyncTableStart(), ParallelApplyWorkerMain(), pg_replication_origin_session_setup(), and run_apply_worker().
void StartupReplicationOrigin | ( | void | ) |
Definition at line 703 of file origin.c.
References Assert, CloseTransientFile(), COMP_CRC32C, crc, DEBUG2, elog, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg(), fd(), FIN_CRC32C, INIT_CRC32C, LOG, LSN_FORMAT_ARGS, max_replication_slots, OpenTransientFile(), PANIC, PG_BINARY, PG_REPLORIGIN_CHECKPOINT_FILENAME, read, ReplicationState::remote_lsn, ReplicationStateOnDisk::remote_lsn, REPLICATION_STATE_MAGIC, replication_states, ReplicationState::roident, and ReplicationStateOnDisk::roident.
Referenced by StartupXLOG().
|
extern |
Definition at line 159 of file origin.c.
Referenced by apply_handle_delete_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), EndPrepare(), LogicalRepSyncTableStart(), ParallelApplyWorkerMain(), pg_replication_origin_session_is_setup(), pg_replication_origin_session_reset(), pg_replication_origin_session_setup(), process_syncing_tables_for_sync(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), RecordTransactionCommitPrepared(), replorigin_reset(), run_apply_worker(), XactLogAbortRecord(), XactLogCommitRecord(), and XLogRecordAssemble().
|
extern |
Definition at line 160 of file origin.c.
Referenced by apply_handle_commit_internal(), apply_handle_commit_prepared(), apply_handle_prepare_internal(), apply_handle_rollback_prepared(), EndPrepare(), pa_stream_abort(), pg_replication_origin_session_reset(), pg_replication_origin_xact_reset(), pg_replication_origin_xact_setup(), process_syncing_tables_for_sync(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), RecordTransactionCommitPrepared(), replorigin_reset(), XactLogAbortRecord(), and XactLogCommitRecord().
|
extern |
Definition at line 161 of file origin.c.
Referenced by apply_handle_commit_internal(), apply_handle_commit_prepared(), apply_handle_prepare_internal(), apply_handle_rollback_prepared(), EndPrepare(), pa_stream_abort(), pg_replication_origin_session_reset(), pg_replication_origin_xact_reset(), pg_replication_origin_xact_setup(), process_syncing_tables_for_sync(), RecordTransactionCommit(), RecordTransactionCommitPrepared(), replorigin_reset(), XactLogAbortRecord(), and XactLogCommitRecord().