|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <sys/stat.h>#include <unistd.h>#include "access/commit_ts.h"#include "access/table.h"#include "access/tableam.h"#include "access/twophase.h"#include "access/xact.h"#include "catalog/indexing.h"#include "catalog/pg_inherits.h"#include "catalog/pg_subscription.h"#include "catalog/pg_subscription_rel.h"#include "commands/subscriptioncmds.h"#include "commands/tablecmds.h"#include "commands/trigger.h"#include "executor/executor.h"#include "executor/execPartition.h"#include "libpq/pqformat.h"#include "miscadmin.h"#include "optimizer/optimizer.h"#include "parser/parse_relation.h"#include "pgstat.h"#include "postmaster/bgworker.h"#include "postmaster/interrupt.h"#include "postmaster/walwriter.h"#include "replication/conflict.h"#include "replication/logicallauncher.h"#include "replication/logicalproto.h"#include "replication/logicalrelation.h"#include "replication/logicalworker.h"#include "replication/origin.h"#include "replication/slot.h"#include "replication/walreceiver.h"#include "replication/worker_internal.h"#include "rewrite/rewriteHandler.h"#include "storage/buffile.h"#include "storage/ipc.h"#include "storage/lmgr.h"#include "storage/procarray.h"#include "tcop/tcopprot.h"#include "utils/acl.h"#include "utils/guc.h"#include "utils/inval.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/pg_lsn.h"#include "utils/rel.h"#include "utils/rls.h"#include "utils/snapmgr.h"#include "utils/syscache.h"#include "utils/usercontext.h"
Go to the source code of this file.
Data Structures | |
| struct | FlushPosition |
| struct | ApplyExecutionData |
| struct | ApplyErrorCallbackArg |
| struct | RetainDeadTuplesData |
| struct | SubXactInfo |
| struct | ApplySubXactData |
Macros | |
| #define | NAPTIME_PER_CYCLE 1000 /* max sleep time between cycles (1s) */ |
| #define | MIN_XID_ADVANCE_INTERVAL 100 |
| #define | MAX_XID_ADVANCE_INTERVAL 180000 |
| #define | is_skipping_changes() (unlikely(XLogRecPtrIsValid(skip_xact_finish_lsn))) |
| #define is_skipping_changes | ( | ) | (unlikely(XLogRecPtrIsValid(skip_xact_finish_lsn))) |
| Enumerator | |
|---|---|
| RDT_GET_CANDIDATE_XID | |
| RDT_REQUEST_PUBLISHER_STATUS | |
| RDT_WAIT_FOR_PUBLISHER_STATUS | |
| RDT_WAIT_FOR_LOCAL_FLUSH | |
| RDT_STOP_CONFLICT_INFO_RETENTION | |
| RDT_RESUME_CONFLICT_INFO_RETENTION | |
Definition at line 387 of file worker.c.
| Enumerator | |
|---|---|
| TRANS_LEADER_APPLY | |
| TRANS_LEADER_SERIALIZE | |
| TRANS_LEADER_SEND_TO_PARALLEL | |
| TRANS_LEADER_PARTIAL_SERIALIZE | |
| TRANS_PARALLEL_APPLY | |
Definition at line 369 of file worker.c.
|
static |
Definition at line 4955 of file worker.c.
References fb(), MAX_XID_ADVANCE_INTERVAL, Subscription::maxretention, Min, MIN_XID_ADVANCE_INTERVAL, MySubscription, Subscription::retentionactive, and wal_receiver_status_interval.
Referenced by get_candidate_xid().
| void apply_dispatch | ( | StringInfo | s | ) |
Definition at line 3775 of file worker.c.
References apply_error_callback_arg, apply_handle_begin(), apply_handle_begin_prepare(), apply_handle_commit(), apply_handle_commit_prepared(), apply_handle_delete(), apply_handle_insert(), apply_handle_origin(), apply_handle_prepare(), apply_handle_relation(), apply_handle_rollback_prepared(), apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_handle_stream_start(), apply_handle_stream_stop(), apply_handle_truncate(), apply_handle_type(), apply_handle_update(), ApplyErrorCallbackArg::command, ereport, errcode(), errmsg(), ERROR, fb(), LOGICAL_REP_MSG_BEGIN, LOGICAL_REP_MSG_BEGIN_PREPARE, LOGICAL_REP_MSG_COMMIT, LOGICAL_REP_MSG_COMMIT_PREPARED, LOGICAL_REP_MSG_DELETE, LOGICAL_REP_MSG_INSERT, LOGICAL_REP_MSG_MESSAGE, LOGICAL_REP_MSG_ORIGIN, LOGICAL_REP_MSG_PREPARE, LOGICAL_REP_MSG_RELATION, LOGICAL_REP_MSG_ROLLBACK_PREPARED, LOGICAL_REP_MSG_STREAM_ABORT, LOGICAL_REP_MSG_STREAM_COMMIT, LOGICAL_REP_MSG_STREAM_PREPARE, LOGICAL_REP_MSG_STREAM_START, LOGICAL_REP_MSG_STREAM_STOP, LOGICAL_REP_MSG_TRUNCATE, LOGICAL_REP_MSG_TYPE, LOGICAL_REP_MSG_UPDATE, and pq_getmsgbyte().
Referenced by apply_spooled_messages(), LogicalParallelApplyLoop(), and LogicalRepApplyLoop().
Definition at line 6161 of file worker.c.
References apply_error_callback_arg, Assert, ApplyErrorCallbackArg::command, errcontext, fb(), logicalrep_message_type(), LSN_FORMAT_ARGS, TransactionIdIsValid, and XLogRecPtrIsValid.
Referenced by LogicalParallelApplyLoop(), and LogicalRepApplyLoop().
|
static |
Definition at line 1211 of file worker.c.
References Assert, fb(), in_remote_transaction, logicalrep_read_begin(), maybe_start_skipping_changes(), pgstat_report_activity(), remote_final_lsn, set_apply_error_context_xact(), STATE_RUNNING, stream_xid, and TransactionIdIsValid.
Referenced by apply_dispatch().
|
static |
Definition at line 1265 of file worker.c.
References am_tablesync_worker(), Assert, ereport, errcode(), errmsg_internal(), ERROR, fb(), in_remote_transaction, logicalrep_read_begin_prepare(), maybe_start_skipping_changes(), pgstat_report_activity(), remote_final_lsn, set_apply_error_context_xact(), STATE_RUNNING, stream_xid, and TransactionIdIsValid.
Referenced by apply_dispatch().
|
static |
Definition at line 1236 of file worker.c.
References apply_handle_commit_internal(), ereport, errcode(), errmsg_internal(), ERROR, fb(), logicalrep_read_commit(), LSN_FORMAT_ARGS, pgstat_report_activity(), ProcessSyncingRelations(), remote_final_lsn, reset_apply_error_context_info(), and STATE_IDLE.
Referenced by apply_dispatch().
|
static |
Definition at line 2503 of file worker.c.
References AcceptInvalidationMessages(), clear_subscription_skip_lsn(), CommitTransactionCommand(), EndTransactionBlock(), fb(), in_remote_transaction, is_skipping_changes, IsTransactionBlock(), IsTransactionState(), maybe_reread_subscription(), ReplOriginXactState::origin_lsn, ReplOriginXactState::origin_timestamp, pgstat_report_stat(), replorigin_xact_state, StartTransactionCommand(), stop_skipping_changes(), store_flush_position(), and XactLastCommitEnd.
Referenced by apply_handle_commit(), and apply_handle_stream_commit().
|
static |
Definition at line 1405 of file worker.c.
References begin_replication_step(), clear_subscription_skip_lsn(), CommitTransactionCommand(), end_replication_step(), fb(), FinishPreparedTransaction(), GIDSIZE, in_remote_transaction, logicalrep_read_commit_prepared(), MySubscription, Subscription::oid, ReplOriginXactState::origin_lsn, ReplOriginXactState::origin_timestamp, pgstat_report_activity(), pgstat_report_stat(), ProcessSyncingRelations(), replorigin_xact_state, reset_apply_error_context_info(), set_apply_error_context_xact(), STATE_IDLE, store_flush_position(), TwoPhaseTransactionGid(), and XactLastCommitEnd.
Referenced by apply_dispatch().
|
static |
Definition at line 3012 of file worker.c.
References apply_error_callback_arg, apply_handle_delete_internal(), apply_handle_tuple_routing(), begin_replication_step(), check_relation_updatable(), CMD_DELETE, create_edata_for_relation(), end_replication_step(), ExecCloseIndices(), ExecInitExtraTupleSlot(), ExecOpenIndices(), fb(), finish_edata(), GetPerTupleMemoryContext, handle_streamed_transaction(), is_skipping_changes, LogicalRepRelMapEntry::localindexoid, LogicalRepRelMapEntry::localrel, LOGICAL_REP_MSG_DELETE, logicalrep_read_delete(), logicalrep_rel_close(), logicalrep_rel_open(), MemoryContextSwitchTo(), MySubscription, NoLock, RelationData::rd_rel, ApplyErrorCallbackArg::rel, RelationGetDescr, RestoreUserContext(), RowExclusiveLock, Subscription::runasowner, should_apply_changes_for_rel(), slot_store_data(), SwitchToUntrustedUser(), and TTSOpsVirtual.
Referenced by apply_dispatch().
|
static |
Definition at line 3106 of file worker.c.
References ACL_DELETE, Assert, CT_DELETE_MISSING, CT_DELETE_ORIGIN_DIFFERS, EvalPlanQualEnd(), EvalPlanQualInit(), EvalPlanQualSetSlot, ExecSimpleRelationDelete(), fb(), FindReplTupleInLocalRel(), GetTupleTransactionInfo(), list_make1, LOG, NIL, ReplOriginXactState::origin, RelationData::rd_rel, RelationGetIndexList(), replorigin_xact_state, ReportApplyConflict(), and TargetPrivilegesCheck().
Referenced by apply_handle_delete(), and apply_handle_tuple_routing().
|
static |
Definition at line 2633 of file worker.c.
References apply_error_callback_arg, apply_handle_insert_internal(), apply_handle_tuple_routing(), begin_replication_step(), CMD_INSERT, create_edata_for_relation(), end_replication_step(), ExecCloseIndices(), ExecInitExtraTupleSlot(), ExecOpenIndices(), fb(), finish_edata(), GetPerTupleMemoryContext, handle_streamed_transaction(), is_skipping_changes, LogicalRepRelMapEntry::localrel, LOGICAL_REP_MSG_INSERT, logicalrep_read_insert(), logicalrep_rel_close(), logicalrep_rel_open(), MemoryContextSwitchTo(), MySubscription, NoLock, RelationData::rd_rel, ApplyErrorCallbackArg::rel, RelationGetDescr, RestoreUserContext(), RowExclusiveLock, Subscription::runasowner, should_apply_changes_for_rel(), slot_fill_defaults(), slot_store_data(), SwitchToUntrustedUser(), and TTSOpsVirtual.
Referenced by apply_dispatch().
|
static |
Definition at line 2724 of file worker.c.
References ACL_INSERT, Assert, ExecSimpleRelationInsert(), fb(), InitConflictIndexes(), NIL, RelationGetIndexList(), and TargetPrivilegesCheck().
Referenced by apply_handle_insert(), and apply_handle_tuple_routing().
|
static |
Definition at line 1666 of file worker.c.
References am_tablesync_worker(), ereport, errcode(), errmsg_internal(), ERROR, fb(), in_remote_transaction, in_streamed_transaction, and IsTransactionState().
Referenced by apply_dispatch().
|
static |
Definition at line 1331 of file worker.c.
References apply_handle_prepare_internal(), begin_replication_step(), clear_subscription_skip_lsn(), CommitTransactionCommand(), end_replication_step(), ereport, errcode(), errmsg_internal(), ERROR, fb(), in_remote_transaction, InvalidXLogRecPtr, logicalrep_read_prepare(), LSN_FORMAT_ARGS, pgstat_report_activity(), pgstat_report_stat(), ProcessSyncingRelations(), remote_final_lsn, reset_apply_error_context_info(), STATE_IDLE, stop_skipping_changes(), and store_flush_position().
Referenced by apply_dispatch().
|
static |
Definition at line 1294 of file worker.c.
References BeginTransactionBlock(), CommitTransactionCommand(), fb(), GIDSIZE, IsTransactionBlock(), MySubscription, Subscription::oid, ReplOriginXactState::origin_lsn, ReplOriginXactState::origin_timestamp, PrepareTransactionBlock(), replorigin_xact_state, and TwoPhaseTransactionGid().
Referenced by apply_handle_prepare(), and apply_handle_stream_prepare().
|
static |
Definition at line 2563 of file worker.c.
References handle_streamed_transaction(), LOGICAL_REP_MSG_RELATION, logicalrep_partmap_reset_relmap(), logicalrep_read_rel(), and logicalrep_relmap_update().
Referenced by apply_dispatch().
|
static |
Definition at line 1457 of file worker.c.
References begin_replication_step(), clear_subscription_skip_lsn(), CommitTransactionCommand(), end_replication_step(), fb(), FinishPreparedTransaction(), GIDSIZE, in_remote_transaction, InvalidXLogRecPtr, logicalrep_read_rollback_prepared(), LookupGXact(), MySubscription, Subscription::oid, ReplOriginXactState::origin_lsn, ReplOriginXactState::origin_timestamp, pgstat_report_activity(), pgstat_report_stat(), ProcessSyncingRelations(), replorigin_xact_state, reset_apply_error_context_info(), set_apply_error_context_xact(), STATE_IDLE, store_flush_position(), and TwoPhaseTransactionGid().
Referenced by apply_dispatch().
|
static |
Definition at line 2071 of file worker.c.
References AccessExclusiveLock, Assert, StringInfoData::data, DEBUG1, elog, ereport, errcode(), errmsg_internal(), ERROR, fb(), FS_SERIALIZE_DONE, get_transaction_apply_action(), in_streamed_transaction, InvalidXLogRecPtr, StringInfoData::len, LOGICAL_REP_MSG_STREAM_ABORT, logicalrep_read_stream_abort(), MyLogicalRepWorker, pa_decr_and_wait_stream_block(), pa_lock_stream(), pa_send_data(), pa_set_fileset_state(), pa_stream_abort(), pa_switch_to_partial_serialize(), pa_unlock_stream(), pa_xact_finish(), LogicalRepWorker::parallel_apply, ParallelApplyWorkerShared::pending_stream_count, pg_atomic_add_fetch_u32(), reset_apply_error_context_info(), set_apply_error_context_xact(), ParallelApplyWorkerInfo::shared, stream_abort_internal(), stream_close_file(), stream_fd, stream_open_and_write_change(), TRANS_LEADER_APPLY, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, and TRANS_PARALLEL_APPLY.
Referenced by apply_dispatch().
|
static |
Definition at line 2390 of file worker.c.
References AccessExclusiveLock, apply_handle_commit_internal(), apply_spooled_messages(), Assert, StringInfoData::data, DEBUG1, elog, ereport, errcode(), errmsg_internal(), ERROR, fb(), FS_SERIALIZE_DONE, get_transaction_apply_action(), in_streamed_transaction, ParallelApplyWorkerShared::last_commit_end, StringInfoData::len, LOGICAL_REP_MSG_STREAM_COMMIT, logicalrep_read_stream_commit(), MyLogicalRepWorker, MyParallelShared, pa_reset_subtrans(), pa_send_data(), pa_set_fileset_state(), pa_set_xact_state(), pa_switch_to_partial_serialize(), pa_unlock_transaction(), pa_xact_finish(), PARALLEL_TRANS_FINISHED, pgstat_report_activity(), ProcessSyncingRelations(), reset_apply_error_context_info(), set_apply_error_context_xact(), ParallelApplyWorkerInfo::shared, STATE_IDLE, stream_cleanup_files(), stream_close_file(), stream_fd, LogicalRepWorker::stream_fileset, stream_open_and_write_change(), LogicalRepWorker::subid, TRANS_LEADER_APPLY, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, TRANS_PARALLEL_APPLY, and XactLastCommitEnd.
Referenced by apply_dispatch().
|
static |
Definition at line 1518 of file worker.c.
References AccessExclusiveLock, am_tablesync_worker(), apply_handle_prepare_internal(), apply_spooled_messages(), Assert, begin_replication_step(), clear_subscription_skip_lsn(), CommitTransactionCommand(), StringInfoData::data, DEBUG1, elog, end_replication_step(), ereport, errcode(), errmsg_internal(), ERROR, fb(), FS_SERIALIZE_DONE, get_transaction_apply_action(), in_remote_transaction, in_streamed_transaction, InvalidXLogRecPtr, ParallelApplyWorkerShared::last_commit_end, StringInfoData::len, LOGICAL_REP_MSG_STREAM_PREPARE, logicalrep_read_stream_prepare(), MyLogicalRepWorker, MyParallelShared, pa_reset_subtrans(), pa_send_data(), pa_set_fileset_state(), pa_set_xact_state(), pa_switch_to_partial_serialize(), pa_unlock_transaction(), pa_xact_finish(), PARALLEL_TRANS_FINISHED, pgstat_report_activity(), pgstat_report_stat(), ProcessSyncingRelations(), reset_apply_error_context_info(), set_apply_error_context_xact(), ParallelApplyWorkerInfo::shared, STATE_IDLE, stop_skipping_changes(), store_flush_position(), stream_cleanup_files(), stream_close_file(), stream_fd, LogicalRepWorker::stream_fileset, stream_open_and_write_change(), LogicalRepWorker::subid, TRANS_LEADER_APPLY, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, TRANS_PARALLEL_APPLY, and ParallelApplyWorkerShared::xid.
Referenced by apply_dispatch().
|
static |
Definition at line 1725 of file worker.c.
References AccessExclusiveLock, Assert, StringInfoData::data, elog, ereport, errcode(), errmsg_internal(), ERROR, fb(), get_transaction_apply_action(), in_streamed_transaction, InvalidOid, InvalidXLogRecPtr, StringInfoData::len, LOGICAL_REP_MSG_STREAM_START, logicalrep_read_stream_start(), logicalrep_worker_wakeup(), MyLogicalRepWorker, MyParallelShared, pa_allocate_worker(), pa_lock_transaction(), pa_send_data(), pa_set_stream_apply_worker(), pa_set_xact_state(), pa_switch_to_partial_serialize(), pa_unlock_stream(), parallel_stream_nchanges, PARALLEL_TRANS_STARTED, ParallelApplyWorkerShared::pending_stream_count, pg_atomic_add_fetch_u32(), pgstat_report_activity(), set_apply_error_context_xact(), ParallelApplyWorkerInfo::shared, STATE_RUNNING, stream_start_internal(), stream_write_change(), stream_xid, LogicalRepWorker::subid, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, TRANS_LEADER_SERIALIZE, TRANS_PARALLEL_APPLY, TransactionIdIsValid, WORKERTYPE_APPLY, and ParallelApplyWorkerShared::xid.
Referenced by apply_dispatch().
|
static |
Definition at line 1885 of file worker.c.
References AccessExclusiveLock, Assert, StringInfoData::data, DEBUG1, elog, ereport, errcode(), errmsg_internal(), ERROR, fb(), get_transaction_apply_action(), in_streamed_transaction, InvalidTransactionId, IsTransactionOrTransactionBlock(), StringInfoData::len, LOGICAL_REP_MSG_STREAM_STOP, pa_decr_and_wait_stream_block(), pa_lock_stream(), pa_send_data(), pa_set_stream_apply_worker(), pa_switch_to_partial_serialize(), parallel_stream_nchanges, pgstat_report_activity(), reset_apply_error_context_info(), ParallelApplyWorkerInfo::shared, STATE_IDLE, STATE_IDLEINTRANSACTION, stream_stop_internal(), stream_write_change(), stream_xid, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, TRANS_LEADER_SERIALIZE, TRANS_PARALLEL_APPLY, and ParallelApplyWorkerShared::xid.
Referenced by apply_dispatch().
|
static |
Definition at line 3647 of file worker.c.
References AccessExclusiveLock, ACL_TRUNCATE, begin_replication_step(), DROP_RESTRICT, end_replication_step(), ExecuteTruncateGuts(), fb(), find_all_inheritors(), handle_streamed_transaction(), is_skipping_changes, lappend(), lappend_oid(), lfirst, lfirst_oid, list_member_oid(), LogicalRepRelMapEntry::localrel, LogicalRepRelMapEntry::localreloid, LOGICAL_REP_MSG_TRUNCATE, logicalrep_read_truncate(), logicalrep_rel_close(), logicalrep_rel_open(), MySubscription, NIL, NoLock, RelationData::rd_rel, RELATION_IS_OTHER_TEMP, RelationIsLogicallyLogged, Subscription::runasowner, should_apply_changes_for_rel(), table_close(), table_open(), and TargetPrivilegesCheck().
Referenced by apply_dispatch().
|
static |
Definition at line 3351 of file worker.c.
References ACL_DELETE, ACL_UPDATE, apply_handle_delete_internal(), apply_handle_insert_internal(), Assert, TupleConversionMap::attrMap, check_relation_updatable(), CheckSubscriptionRelkind(), CMD_DELETE, CMD_INSERT, CMD_UPDATE, convert_tuples_by_name(), CT_UPDATE_DELETED, CT_UPDATE_MISSING, CT_UPDATE_ORIGIN_DIFFERS, elog, ERROR, EState::es_tupleTable, EvalPlanQualEnd(), EvalPlanQualInit(), EvalPlanQualSetSlot, ExecCopySlot(), ExecFindPartition(), ExecGetRootToChildMap(), ExecPartitionCheck(), ExecSetupPartitionTupleRouting(), ExecSimpleRelationDelete(), ExecSimpleRelationUpdate(), execute_attr_map_slot(), fb(), FindDeletedTupleInLocalRel(), FindReplTupleInLocalRel(), get_namespace_name(), GetPerTupleMemoryContext, GetTupleTransactionInfo(), InitConflictIndexes(), list_make1, LOG, logicalrep_partition_open(), makeNode, MemoryContextSwitchTo(), NIL, ModifyTableState::operation, ReplOriginXactState::origin, PlanState::plan, ModifyTableState::ps, RelationData::rd_rel, RelationGetDescr, RelationGetNamespace, RelationGetRelationName, LogicalRepRelation::relkind, LogicalRepRelMapEntry::remoterel, replorigin_xact_state, ReportApplyConflict(), ModifyTableState::resultRelInfo, slot_getallattrs(), slot_modify_data(), slot_store_data(), PlanState::state, table_slot_create(), TargetPrivilegesCheck(), and type.
Referenced by apply_handle_delete(), apply_handle_insert(), and apply_handle_update().
|
static |
Definition at line 2586 of file worker.c.
References fb(), handle_streamed_transaction(), LOGICAL_REP_MSG_TYPE, and logicalrep_read_typ().
Referenced by apply_dispatch().
|
static |
Definition at line 2790 of file worker.c.
References apply_error_callback_arg, apply_handle_tuple_routing(), apply_handle_update_internal(), Assert, AttrMap::attnums, LogicalRepRelMapEntry::attrmap, begin_replication_step(), bms_add_member(), check_relation_updatable(), CMD_UPDATE, create_edata_for_relation(), end_replication_step(), EState::es_rteperminfos, ExecInitExtraTupleSlot(), fb(), finish_edata(), FirstLowInvalidHeapAttributeNumber, GetPerTupleMemoryContext, handle_streamed_transaction(), i, is_skipping_changes, list_nth(), LogicalRepRelMapEntry::localindexoid, LogicalRepRelMapEntry::localrel, LOGICAL_REP_MSG_UPDATE, LOGICALREP_COLUMN_UNCHANGED, logicalrep_read_update(), logicalrep_rel_close(), logicalrep_rel_open(), MemoryContextSwitchTo(), MySubscription, NoLock, RelationData::rd_rel, ApplyErrorCallbackArg::rel, RelationGetDescr, RestoreUserContext(), RowExclusiveLock, Subscription::runasowner, should_apply_changes_for_rel(), slot_store_data(), SwitchToUntrustedUser(), TTSOpsVirtual, and TupleDescCompactAttr().
Referenced by apply_dispatch().
|
static |
Definition at line 2907 of file worker.c.
References ACL_UPDATE, CT_UPDATE_DELETED, CT_UPDATE_MISSING, CT_UPDATE_ORIGIN_DIFFERS, EState::es_tupleTable, EvalPlanQualEnd(), EvalPlanQualInit(), EvalPlanQualSetSlot, ExecCloseIndices(), ExecOpenIndices(), ExecSimpleRelationUpdate(), fb(), FindDeletedTupleInLocalRel(), FindReplTupleInLocalRel(), GetPerTupleMemoryContext, GetTupleTransactionInfo(), InitConflictIndexes(), list_make1, LOG, MemoryContextSwitchTo(), NIL, ReplOriginXactState::origin, LogicalRepRelMapEntry::remoterel, replorigin_xact_state, ReportApplyConflict(), slot_modify_data(), slot_store_data(), table_slot_create(), TargetPrivilegesCheck(), and type.
Referenced by apply_handle_update().
| void apply_spooled_messages | ( | FileSet * | stream_fileset, |
| TransactionId | xid, | ||
| XLogRecPtr | lsn | ||
| ) |
Definition at line 2260 of file worker.c.
References am_parallel_apply_worker(), apply_dispatch(), ApplyMessageContext, begin_replication_step(), BufFileOpenFileSet(), BufFileReadExact(), BufFileReadMaybeEOF(), BufFileTell(), changes_filename(), CHECK_FOR_INTERRUPTS, CurrentResourceOwner, DEBUG1, elog, end_replication_step(), ensure_last_message(), ERROR, fb(), in_remote_transaction, initReadOnlyStringInfo(), len, MAXPGPATH, maybe_start_skipping_changes(), MemoryContextReset(), MemoryContextSwitchTo(), MyLogicalRepWorker, palloc(), pgstat_report_activity(), remote_final_lsn, repalloc(), s2, STATE_RUNNING, stream_close_file(), stream_fd, LogicalRepWorker::subid, TopTransactionContext, and TopTransactionResourceOwner.
Referenced by apply_handle_stream_commit(), apply_handle_stream_prepare(), and pa_process_spooled_messages_if_required().
Definition at line 5004 of file worker.c.
References am_leader_apply_worker(), am_parallel_apply_worker(), ApplyLauncherForgetWorkerStartTime(), MyLogicalRepWorker, proc_exit(), and LogicalRepWorker::subid.
Referenced by InitializeLogRepWorker(), maybe_reread_subscription(), and resume_conflict_info_retention().
Definition at line 5925 of file worker.c.
References DatumGetInt32(), fb(), InitializingApplyWorker, proc_exit(), run_apply_worker(), and SetupApplyOrSyncWorker().
Definition at line 6271 of file worker.c.
References fb(), lfirst, lfirst_oid, logicalrep_worker_wakeup_ptr(), logicalrep_workers_find(), LW_SHARED, LWLockAcquire(), LWLockRelease(), NIL, and on_commit_wakeup_workers_subids.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
Definition at line 726 of file worker.c.
References ApplyMessageContext, GetTransactionSnapshot(), IsTransactionState(), maybe_reread_subscription(), MemoryContextSwitchTo(), PushActiveSnapshot(), SetCurrentStatementStartTimestamp(), and StartTransactionCommand().
Referenced by apply_handle_commit_prepared(), apply_handle_delete(), apply_handle_insert(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_prepare(), apply_handle_truncate(), apply_handle_update(), apply_spooled_messages(), ensure_last_message(), stream_abort_internal(), and stream_start_internal().
|
static |
Definition at line 4401 of file worker.c.
References am_leader_apply_worker(), MySubscription, and Subscription::retaindeadtuples.
Referenced by maybe_advance_nonremovable_xid().
|
inlinestatic |
Definition at line 5367 of file worker.c.
References MAXPGPATH, and snprintf.
Referenced by apply_spooled_messages(), ensure_last_message(), stream_abort_internal(), stream_cleanup_files(), and stream_open_file().
|
static |
Definition at line 2749 of file worker.c.
References ereport, errcode(), errmsg(), ERROR, fb(), GetRelationIdentityOrPK(), LogicalRepRelMapEntry::localrel, LogicalRepRelation::nspname, OidIsValid, RelationData::rd_rel, LogicalRepRelation::relname, LogicalRepRelMapEntry::remoterel, and LogicalRepRelMapEntry::updatable.
Referenced by apply_handle_delete(), apply_handle_tuple_routing(), and apply_handle_update().
Definition at line 5564 of file worker.c.
References fb(), InvalidTransactionId, ApplySubXactData::nsubxacts, ApplySubXactData::nsubxacts_max, pfree(), subxact_data, ApplySubXactData::subxact_last, and ApplySubXactData::subxacts.
Referenced by stream_abort_internal(), and subxact_info_write().
|
static |
Definition at line 6072 of file worker.c.
References AccessShareLock, am_parallel_apply_worker(), CatalogTupleUpdate(), CommitTransactionCommand(), elog, ereport, errdetail(), errmsg(), ERROR, fb(), GETSTRUCT(), GetTransactionSnapshot(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, InvalidXLogRecPtr, IsTransactionState(), likely, LockSharedObject(), LSN_FORMAT_ARGS, LSNGetDatum(), MySubscription, Subscription::name, NoLock, ObjectIdGetDatum(), Subscription::oid, PopActiveSnapshot(), PushActiveSnapshot(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy1, Subscription::skiplsn, StartTransactionCommand(), table_close(), table_open(), values, WARNING, and XLogRecPtrIsValid.
Referenced by apply_handle_commit_internal(), apply_handle_commit_prepared(), apply_handle_prepare(), apply_handle_rollback_prepared(), and apply_handle_stream_prepare().
|
static |
Definition at line 870 of file worker.c.
References AccessShareLock, addRTEPermissionInfo(), AfterTriggerBeginQuery(), bms_make_singleton(), CreateExecutorState(), EState::es_opened_result_relations, EState::es_output_cid, ExecInitRangeTable(), fb(), GetCurrentCommandId(), InitResultRelInfo(), lappend(), list_make1, LogicalRepRelMapEntry::localrel, makeNode, NIL, palloc0_object, RelationData::rd_rel, RelationGetRelid, and RTE_RELATION.
Referenced by apply_handle_delete(), apply_handle_insert(), and apply_handle_update().
Definition at line 5945 of file worker.c.
References AbortOutOfAnyTransaction(), am_leader_apply_worker(), ApplyLauncherForgetWorkerStartTime(), CheckSubDeadTupleRetention(), CommitTransactionCommand(), DisableSubscription(), EmitErrorReport(), ereport, errmsg(), FlushErrorState(), GetTransactionSnapshot(), HOLD_INTERRUPTS, LOG, MyLogicalRepWorker, MySubscription, Subscription::name, Subscription::oid, pgstat_report_subscription_error(), PopActiveSnapshot(), proc_exit(), PushActiveSnapshot(), RESUME_INTERRUPTS, Subscription::retaindeadtuples, Subscription::retentionactive, StartTransactionCommand(), LogicalRepWorker::subid, LogicalRepWorker::type, and WARNING.
Referenced by start_apply(), start_sequence_sync(), and start_table_sync().
Definition at line 749 of file worker.c.
References CommandCounterIncrement(), and PopActiveSnapshot().
Referenced by apply_handle_commit_prepared(), apply_handle_delete(), apply_handle_insert(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_prepare(), apply_handle_truncate(), apply_handle_update(), apply_spooled_messages(), ensure_last_message(), stream_abort_internal(), and stream_start_internal().
|
static |
Definition at line 2228 of file worker.c.
References Assert, begin_replication_step(), BufFileClose(), BufFileOpenFileSet(), BufFileSeek(), BufFileTell(), changes_filename(), elog, end_replication_step(), ERROR, fb(), fd(), IsTransactionState(), MAXPGPATH, MyLogicalRepWorker, and LogicalRepWorker::subid.
Referenced by apply_spooled_messages().
|
static |
Definition at line 3269 of file worker.c.
References am_leader_apply_worker(), ereport, errcode(), errmsg(), ERROR, fb(), InvalidOid, IsIndexUsableForFindingDeletedTuple(), logicalrep_worker_find(), LW_SHARED, LWLockAcquire(), LWLockRelease(), MyLogicalRepWorker, MySubscription, OidIsValid, LogicalRepWorker::oldest_nonremovable_xid, RelationFindDeletedTupleInfoByIndex(), RelationFindDeletedTupleInfoSeq(), LogicalRepWorker::relmutex, Subscription::retaindeadtuples, SpinLockAcquire, SpinLockRelease, LogicalRepWorker::subid, track_commit_timestamp, TransactionIdIsValid, and WORKERTYPE_APPLY.
Referenced by apply_handle_tuple_routing(), and apply_handle_update_internal().
|
static |
Definition at line 3174 of file worker.c.
References AccessShareLock, ACL_SELECT, Assert, EState::es_tupleTable, fb(), GetRelationIdentityOrPK(), index_close(), index_open(), IsIndexUsableForReplicaIdentityFull(), LockTupleExclusive, OidIsValid, RelationFindReplTupleByIndex(), RelationFindReplTupleSeq(), LogicalRepRelation::replident, table_slot_create(), and TargetPrivilegesCheck().
Referenced by apply_handle_delete_internal(), apply_handle_tuple_routing(), and apply_handle_update_internal().
|
static |
Definition at line 928 of file worker.c.
References AfterTriggerEndQuery(), EState::es_tupleTable, ExecCleanupTupleRouting(), ExecResetTupleTable(), fb(), FreeExecutorState(), and pfree().
Referenced by apply_handle_delete(), apply_handle_insert(), and apply_handle_update().
|
static |
Definition at line 4453 of file worker.c.
References adjust_xid_advance_interval(), Assert, fb(), GetCurrentTimestamp(), GetOldestActiveTransactionId(), MyLogicalRepWorker, now(), LogicalRepWorker::oldest_nonremovable_xid, process_rdt_phase_transition(), RDT_REQUEST_PUBLISHER_STATUS, TimestampDifferenceExceeds(), TransactionIdEquals, and TransactionIdPrecedesOrEquals().
Referenced by process_rdt_phase_transition().
|
static |
Definition at line 3895 of file worker.c.
References dlist_mutable_iter::cur, dlist_container, dlist_delete(), dlist_foreach_modify, dlist_is_empty(), dlist_tail_element, fb(), GetFlushRecPtr(), InvalidXLogRecPtr, FlushPosition::local_end, lsn_mapping, pfree(), FlushPosition::remote_end, and write.
Referenced by send_feedback(), and wait_for_local_flush().
|
static |
Definition at line 6318 of file worker.c.
References am_parallel_apply_worker(), fb(), in_streamed_transaction, pa_find_worker(), ParallelApplyWorkerInfo::serialize_changes, TRANS_LEADER_APPLY, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, TRANS_LEADER_SERIALIZE, and TRANS_PARALLEL_APPLY.
Referenced by apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_handle_stream_start(), apply_handle_stream_stop(), and handle_streamed_transaction().
|
static |
Definition at line 777 of file worker.c.
References Assert, StringInfoData::data, elog, ereport, errcode(), errmsg_internal(), ERROR, fb(), get_transaction_apply_action(), StringInfoData::len, LOGICAL_REP_MSG_RELATION, LOGICAL_REP_MSG_TYPE, pa_send_data(), pa_start_subtrans(), pa_switch_to_partial_serialize(), parallel_stream_nchanges, pq_getmsgint(), stream_fd, stream_write_change(), stream_xid, subxact_info_add(), TRANS_LEADER_APPLY, TRANS_LEADER_PARTIAL_SERIALIZE, TRANS_LEADER_SEND_TO_PARALLEL, TRANS_LEADER_SERIALIZE, TRANS_PARALLEL_APPLY, and TransactionIdIsValid.
Referenced by apply_handle_delete(), apply_handle_insert(), apply_handle_relation(), apply_handle_truncate(), apply_handle_type(), and apply_handle_update().
Definition at line 5737 of file worker.c.
References AccessShareLock, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, am_leader_apply_worker(), am_sequencesync_worker(), am_tablesync_worker(), apply_worker_exit(), ApplyContext, ApplyLauncherForgetWorkerStartTime(), BackgroundWorkerInitializeConnectionByOid(), before_shmem_exit(), CacheRegisterSyscacheCallback(), CommitTransactionCommand(), LogicalRepWorker::dbid, Subscription::enabled, ereport, errmsg(), fb(), get_rel_name(), GetSubscription(), LockSharedObject(), LOG, MemoryContextSwitchTo(), MyLogicalRepWorker, MySubscription, MySubscriptionValid, Subscription::name, LogicalRepWorker::oldest_nonremovable_xid, on_exit_clear_xact_state(), PGC_BACKEND, PGC_S_OVERRIDE, PGC_SUSET, proc_exit(), LogicalRepWorker::relid, Subscription::retaindeadtuples, Subscription::retentionactive, SetConfigOption(), StartTransactionCommand(), LogicalRepWorker::subid, subscription_change_cb(), Subscription::synccommit, TopMemoryContext, TransactionIdIsValid, and LogicalRepWorker::userid.
Referenced by ParallelApplyWorkerMain(), and SetupApplyOrSyncWorker().
|
static |
Definition at line 3235 of file worker.c.
References elog, ERROR, fb(), HeapTupleHeaderGetXmin(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache1(), and TransactionIdPrecedes().
Referenced by FindDeletedTupleInLocalRel().
Definition at line 6013 of file worker.c.
References am_parallel_apply_worker(), and IsLogicalWorker().
Referenced by mq_putmessage().
Definition at line 6004 of file worker.c.
References fb(), and MyLogicalRepWorker.
Referenced by IsLogicalParallelApplyWorker(), and ProcessInterrupts().
|
static |
Definition at line 3981 of file worker.c.
References AcceptInvalidationMessages(), ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, apply_dispatch(), apply_error_callback(), apply_error_context_stack, ApplyContext, ApplyMessageContext, buf, ErrorContextCallback::callback, CHECK_FOR_INTERRUPTS, ConfigReloadPending, dlist_is_empty(), elog, ereport, errcode(), errmsg(), ERROR, error_context_stack, fb(), fd(), FullTransactionIdFromU64(), GetCurrentTimestamp(), in_remote_transaction, in_streamed_transaction, initReadOnlyStringInfo(), IsTransactionState(), len, LOG, LogicalStreamingContext, LogRepWorkerWalRcvConn, lsn_mapping, Subscription::maxretention, maybe_advance_nonremovable_xid(), maybe_reread_subscription(), MemoryContextReset(), MemoryContextSwitchTo(), Min, MyLatch, MySubscription, NAPTIME_PER_CYCLE, now(), PGC_SIGHUP, PGINVALID_SOCKET, pgstat_report_activity(), pgstat_report_stat(), pq_getmsgbyte(), pq_getmsgint64(), PqReplMsg_Keepalive, PqReplMsg_PrimaryStatusUpdate, PqReplMsg_WALData, ErrorContextCallback::previous, ProcessConfigFile(), ProcessSyncingRelations(), RDT_GET_CANDIDATE_XID, ResetLatch(), Subscription::retentionactive, send_feedback(), STATE_IDLE, TimestampTzPlusMilliseconds, TopMemoryContext, UpdateWorkerStats(), WaitLatchOrSocket(), wal_receiver_timeout, walrcv_endstreaming, walrcv_receive, WalWriterDelay, WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, WL_SOCKET_READABLE, WL_TIMEOUT, and XLogRecPtrIsValid.
Referenced by start_apply().
Definition at line 6257 of file worker.c.
References fb(), list_append_unique_oid(), MemoryContextSwitchTo(), on_commit_wakeup_workers_subids, and TopTransactionContext.
Referenced by AlterObjectRename_internal(), AlterSubscription(), and AlterSubscriptionOwner_internal().
|
static |
Definition at line 4387 of file worker.c.
References can_advance_nonremovable_xid(), fb(), and process_rdt_phase_transition().
Referenced by LogicalRepApplyLoop().
Definition at line 5038 of file worker.c.
References am_leader_apply_worker(), am_parallel_apply_worker(), apply_worker_exit(), ApplyContext, ApplyLauncherForgetWorkerStartTime(), Assert, Subscription::binary, CommitTransactionCommand(), Subscription::conninfo, Subscription::dbid, elog, equal(), ereport, errmsg(), ERROR, fb(), FreeSubscription(), GetSubscription(), IsTransactionState(), LOG, MemoryContextSwitchTo(), MyLogicalRepWorker, MySubscription, MySubscriptionValid, Subscription::name, newsub(), Subscription::origin, Subscription::owner, Subscription::ownersuperuser, Subscription::passwordrequired, PGC_BACKEND, PGC_S_OVERRIDE, proc_exit(), Subscription::publications, SetConfigOption(), Subscription::slotname, StartTransactionCommand(), Subscription::stream, LogicalRepWorker::subid, Subscription::synccommit, and Subscription::twophasestate.
Referenced by apply_handle_commit_internal(), begin_replication_step(), LogicalRepApplyLoop(), and pa_can_start().
|
static |
Definition at line 6023 of file worker.c.
References Assert, ereport, errmsg(), in_remote_transaction, in_streamed_transaction, is_skipping_changes, likely, LOG, LSN_FORMAT_ARGS, MySubscription, skip_xact_finish_lsn, Subscription::skiplsn, and XLogRecPtrIsValid.
Referenced by apply_handle_begin(), apply_handle_begin_prepare(), and apply_spooled_messages().
Definition at line 5875 of file worker.c.
References replorigin_xact_clear().
Referenced by InitializeLogRepWorker().
|
static |
Definition at line 4423 of file worker.c.
References fb(), get_candidate_xid(), RDT_GET_CANDIDATE_XID, RDT_REQUEST_PUBLISHER_STATUS, RDT_RESUME_CONFLICT_INFO_RETENTION, RDT_STOP_CONFLICT_INFO_RETENTION, RDT_WAIT_FOR_LOCAL_FLUSH, RDT_WAIT_FOR_PUBLISHER_STATUS, request_publisher_status(), resume_conflict_info_retention(), stop_conflict_info_retention(), wait_for_local_flush(), and wait_for_publisher_status().
Referenced by get_candidate_xid(), maybe_advance_nonremovable_xid(), wait_for_local_flush(), and wait_for_publisher_status().
| void ReplicationOriginNameForLogicalRep | ( | Oid | suboid, |
| Oid | relid, | ||
| char * | originname, | ||
| Size | szoriginname | ||
| ) |
Definition at line 641 of file worker.c.
References fb(), OidIsValid, and snprintf.
Referenced by AlterSubscription(), AlterSubscription_refresh(), binary_upgrade_replorigin_advance(), CreateSubscription(), DropSubscription(), LogicalRepSyncTableStart(), ParallelApplyWorkerMain(), ProcessSyncingTablesForApply(), ProcessSyncingTablesForSync(), run_apply_worker(), and run_tablesync_worker().
|
static |
Definition at line 4516 of file worker.c.
References ApplyContext, DEBUG2, elog, fb(), GetCurrentTimestamp(), LogRepWorkerWalRcvConn, makeStringInfo(), MemoryContextSwitchTo(), pq_sendbyte(), pq_sendint64(), PqReplMsg_PrimaryStatusRequest, RDT_WAIT_FOR_PUBLISHER_STATUS, resetStringInfo(), and walrcv_send.
Referenced by process_rdt_phase_transition().
Definition at line 6241 of file worker.c.
References apply_error_callback_arg, ApplyErrorCallbackArg::command, fb(), InvalidTransactionId, InvalidXLogRecPtr, ApplyErrorCallbackArg::rel, ApplyErrorCallbackArg::remote_attnum, and set_apply_error_context_xact().
Referenced by apply_handle_commit(), apply_handle_commit_prepared(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), and apply_handle_stream_stop().
|
static |
Definition at line 4921 of file worker.c.
References fb(), InvalidFullTransactionId, InvalidTransactionId, InvalidXLogRecPtr, and RDT_GET_CANDIDATE_XID.
Referenced by stop_conflict_info_retention(), and wait_for_local_flush().
|
static |
Definition at line 4842 of file worker.c.
References apply_worker_exit(), ereport, errdetail(), errmsg(), LOG, Subscription::maxretention, MySubscription, Subscription::name, and update_retention_status().
Referenced by process_rdt_phase_transition().
Definition at line 5624 of file worker.c.
References AllTablesyncsReady(), CommitTransactionCommand(), Subscription::conninfo, DEBUG1, ereport, err(), errcode(), errmsg(), errmsg_internal(), ERROR, fb(), GetTransactionSnapshot(), InvalidOid, InvalidXLogRecPtr, LogRepWorkerWalRcvConn, MySubscription, Subscription::name, NAMEDATALEN, Subscription::oid, OidIsValid, ReplOriginXactState::origin, Subscription::ownersuperuser, Subscription::passwordrequired, PopActiveSnapshot(), PushActiveSnapshot(), ReplicationOriginNameForLogicalRep(), replorigin_by_name(), replorigin_create(), replorigin_session_get_progress(), replorigin_session_setup(), replorigin_xact_state, set_apply_error_context_origin(), set_stream_options(), Subscription::slotname, start_apply(), StartTransactionCommand(), Subscription::twophasestate, UpdateTwoPhaseState(), walrcv_connect, walrcv_identify_system, and walrcv_startstreaming.
Referenced by ApplyWorkerMain().
|
static |
Definition at line 4297 of file worker.c.
References ApplyContext, StringInfoData::data, DEBUG2, elog, fb(), get_flush_position(), GetCurrentTimestamp(), InvalidXLogRecPtr, last_flushpos, StringInfoData::len, LogRepWorkerWalRcvConn, LSN_FORMAT_ARGS, makeStringInfo(), MemoryContextSwitchTo(), now(), pq_sendbyte(), pq_sendint64(), PqReplMsg_StandbyStatusUpdate, reply_message, resetStringInfo(), TimestampDifferenceExceeds(), wal_receiver_status_interval, and walrcv_send.
Referenced by LogicalRepApplyLoop().
Definition at line 6303 of file worker.c.
References apply_error_callback_arg, ApplyContext, fb(), MemoryContextStrdup(), and ApplyErrorCallbackArg::origin_name.
Referenced by ParallelApplyWorkerMain(), run_apply_worker(), and run_tablesync_worker().
|
inlinestatic |
Definition at line 6233 of file worker.c.
References apply_error_callback_arg, ApplyErrorCallbackArg::finish_lsn, and ApplyErrorCallbackArg::remote_xid.
Referenced by apply_handle_begin(), apply_handle_begin_prepare(), apply_handle_commit_prepared(), apply_handle_rollback_prepared(), apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_handle_stream_start(), and reset_apply_error_context_info().
| void set_stream_options | ( | WalRcvStreamOptions * | options, |
| char * | slotname, | ||
| XLogRecPtr * | origin_startpos | ||
| ) |
Definition at line 5514 of file worker.c.
References Subscription::binary, fb(), LOGICALREP_PROTO_STREAM_PARALLEL_VERSION_NUM, LOGICALREP_PROTO_STREAM_VERSION_NUM, LOGICALREP_PROTO_TWOPHASE_VERSION_NUM, LOGICALREP_PROTO_VERSION_NUM, LogRepWorkerWalRcvConn, MyLogicalRepWorker, MySubscription, Subscription::origin, LogicalRepWorker::parallel_apply, pstrdup(), Subscription::publications, server_version, Subscription::stream, and walrcv_server_version.
Referenced by run_apply_worker(), and run_tablesync_worker().
Definition at line 5884 of file worker.c.
References am_leader_apply_worker(), am_sequencesync_worker(), am_tablesync_worker(), Assert, BackgroundWorkerUnblockSignals(), CacheRegisterSyscacheCallback(), Subscription::conninfo, DEBUG1, die, elog, fb(), GetCurrentTimestamp(), InitializeLogRepWorker(), InvalidateSyncingRelStates(), LogicalRepWorker::last_recv_time, LogicalRepWorker::last_send_time, load_file(), logicalrep_worker_attach(), MyLogicalRepWorker, MySubscription, pqsignal, LogicalRepWorker::reply_time, SIGHUP, and SignalHandlerForConfigReload().
Referenced by ApplyWorkerMain(), SequenceSyncWorkerMain(), and TableSyncWorkerMain().
|
static |
Definition at line 681 of file worker.c.
References elog, ereport, errcode(), errdetail(), errmsg(), ERROR, fb(), LogicalRepRelMapEntry::localreloid, MyLogicalRepWorker, MySubscription, Subscription::name, LogicalRepWorker::relid, remote_final_lsn, LogicalRepRelMapEntry::state, LogicalRepRelMapEntry::statelsn, LogicalRepWorker::type, WORKERTYPE_APPLY, WORKERTYPE_PARALLEL_APPLY, WORKERTYPE_SEQUENCESYNC, WORKERTYPE_TABLESYNC, and WORKERTYPE_UNKNOWN.
Referenced by apply_handle_delete(), apply_handle_insert(), apply_handle_truncate(), and apply_handle_update().
|
static |
Definition at line 4769 of file worker.c.
References Assert, fb(), GetCurrentTimestamp(), Subscription::maxretention, MySubscription, now(), RDT_WAIT_FOR_LOCAL_FLUSH, RDT_WAIT_FOR_PUBLISHER_STATUS, TimestampDifferenceExceeds(), and TransactionIdIsValid.
Referenced by wait_for_local_flush(), and wait_for_publisher_status().
|
static |
Definition at line 959 of file worker.c.
References Assert, attnum, AttrMap::attnums, LogicalRepRelMapEntry::attrmap, build_column_default(), ExecEvalExpr(), ExecInitExpr(), expression_planner(), fb(), GetPerTupleExprContext, i, LogicalRepRelMapEntry::localrel, AttrMap::maplen, TupleDescData::natts, LogicalRepRelation::natts, palloc(), RelationGetDescr, LogicalRepRelMapEntry::remoterel, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, and TupleDescCompactAttr().
Referenced by apply_handle_insert().
|
static |
Definition at line 1118 of file worker.c.
References apply_error_callback_arg, Assert, AttrMap::attnums, LogicalRepRelMapEntry::attrmap, ereport, errcode(), errmsg(), ERROR, ExecClearTuple(), ExecStoreVirtualTuple(), fb(), getTypeBinaryInputInfo(), getTypeInputInfo(), i, LOGICALREP_COLUMN_BINARY, LOGICALREP_COLUMN_TEXT, LOGICALREP_COLUMN_UNCHANGED, AttrMap::maplen, TupleDescData::natts, OidInputFunctionCall(), OidReceiveFunctionCall(), ApplyErrorCallbackArg::remote_attnum, slot_getallattrs(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, and TupleDescAttr().
Referenced by apply_handle_tuple_routing(), and apply_handle_update_internal().
|
static |
Definition at line 1017 of file worker.c.
References apply_error_callback_arg, Assert, AttrMap::attnums, LogicalRepRelMapEntry::attrmap, ereport, errcode(), errmsg(), ERROR, ExecClearTuple(), ExecStoreVirtualTuple(), fb(), getTypeBinaryInputInfo(), getTypeInputInfo(), i, LOGICALREP_COLUMN_BINARY, LOGICALREP_COLUMN_TEXT, AttrMap::maplen, TupleDescData::natts, OidInputFunctionCall(), OidReceiveFunctionCall(), ApplyErrorCallbackArg::remote_attnum, TupleTableSlot::tts_isnull, TupleTableSlot::tts_tupleDescriptor, TupleTableSlot::tts_values, and TupleDescAttr().
Referenced by apply_handle_delete(), apply_handle_insert(), apply_handle_tuple_routing(), apply_handle_update(), and apply_handle_update_internal().
| void start_apply | ( | XLogRecPtr | origin_startpos | ) |
Definition at line 5583 of file worker.c.
References AbortOutOfAnyTransaction(), Subscription::disableonerr, DisableSubscriptionAndExit(), fb(), LogicalRepApplyLoop(), MyLogicalRepWorker, MySubscription, Subscription::oid, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pgstat_report_subscription_error(), replorigin_xact_clear(), and LogicalRepWorker::type.
Referenced by run_apply_worker(), and run_tablesync_worker().
|
static |
Definition at line 4804 of file worker.c.
References Assert, ereport, errdetail(), errmsg(), fb(), InvalidTransactionId, LOG, MyLogicalRepWorker, MySubscription, Subscription::name, LogicalRepWorker::oldest_nonremovable_xid, LogicalRepWorker::relmutex, reset_retention_data_fields(), Subscription::retentionactive, SpinLockAcquire, SpinLockRelease, TransactionIdIsValid, and update_retention_status().
Referenced by process_rdt_phase_transition().
Definition at line 6050 of file worker.c.
References ereport, errmsg(), InvalidXLogRecPtr, is_skipping_changes, LOG, LSN_FORMAT_ARGS, and skip_xact_finish_lsn.
Referenced by apply_handle_commit_internal(), apply_handle_prepare(), and apply_handle_stream_prepare().
| void store_flush_position | ( | XLogRecPtr | remote_lsn, |
| XLogRecPtr | local_lsn | ||
| ) |
Definition at line 3939 of file worker.c.
References am_parallel_apply_worker(), ApplyContext, ApplyMessageContext, dlist_push_tail(), fb(), lsn_mapping, MemoryContextSwitchTo(), and palloc_object.
Referenced by apply_handle_commit_internal(), apply_handle_commit_prepared(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_prepare(), and pa_xact_finish().
|
static |
Definition at line 1988 of file worker.c.
References begin_replication_step(), BufFileClose(), BufFileOpenFileSet(), BufFileTruncateFileSet(), changes_filename(), cleanup_subxact_info(), CommitTransactionCommand(), end_replication_step(), fb(), fd(), SubXactInfo::fileno, i, MAXPGPATH, MyLogicalRepWorker, ApplySubXactData::nsubxacts, SubXactInfo::offset, stream_cleanup_files(), LogicalRepWorker::stream_fileset, LogicalRepWorker::subid, subxact_data, subxact_info_read(), subxact_info_write(), ApplySubXactData::subxacts, and SubXactInfo::xid.
Referenced by apply_handle_stream_abort().
| void stream_cleanup_files | ( | Oid | subid, |
| TransactionId | xid | ||
| ) |
Definition at line 5381 of file worker.c.
References BufFileDeleteFileSet(), changes_filename(), MAXPGPATH, MyLogicalRepWorker, LogicalRepWorker::stream_fileset, and subxact_filename().
Referenced by apply_handle_stream_commit(), apply_handle_stream_prepare(), pa_free_worker_info(), and stream_abort_internal().
Definition at line 5450 of file worker.c.
References Assert, BufFileClose(), fb(), and stream_fd.
Referenced by apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_spooled_messages(), and stream_stop_internal().
|
static |
Definition at line 5498 of file worker.c.
References Assert, in_streamed_transaction, stream_fd, stream_start_internal(), stream_stop_internal(), and stream_write_change().
Referenced by apply_handle_stream_abort(), apply_handle_stream_commit(), and apply_handle_stream_prepare().
|
static |
Definition at line 5405 of file worker.c.
References Assert, BufFileCreateFileSet(), BufFileOpenFileSet(), BufFileSeek(), changes_filename(), DEBUG1, elog, fb(), LogicalStreamingContext, MAXPGPATH, MemoryContextSwitchTo(), MyLogicalRepWorker, OidIsValid, stream_fd, LogicalRepWorker::stream_fileset, and TransactionIdIsValid.
Referenced by stream_start_internal().
| void stream_start_internal | ( | TransactionId | xid, |
| bool | first_segment | ||
| ) |
Definition at line 1687 of file worker.c.
References ApplyContext, begin_replication_step(), end_replication_step(), fb(), FileSetInit(), MemoryContextSwitchTo(), MyLogicalRepWorker, palloc_object, LogicalRepWorker::stream_fileset, stream_open_file(), LogicalRepWorker::subid, and subxact_info_read().
Referenced by apply_handle_stream_start(), pa_switch_to_partial_serialize(), and stream_open_and_write_change().
| void stream_stop_internal | ( | TransactionId | xid | ) |
Definition at line 1862 of file worker.c.
References Assert, CommitTransactionCommand(), IsTransactionState(), LogicalStreamingContext, MemoryContextReset(), MyLogicalRepWorker, stream_close_file(), LogicalRepWorker::subid, and subxact_info_write().
Referenced by apply_handle_stream_stop(), and stream_open_and_write_change().
|
static |
Definition at line 5468 of file worker.c.
References Assert, BufFileWrite(), StringInfoData::cursor, StringInfoData::data, fb(), StringInfoData::len, len, and stream_fd.
Referenced by apply_handle_stream_start(), apply_handle_stream_stop(), handle_streamed_transaction(), and stream_open_and_write_change().
Definition at line 5167 of file worker.c.
References MySubscriptionValid.
Referenced by InitializeLogRepWorker().
|
inlinestatic |
Definition at line 5360 of file worker.c.
References MAXPGPATH, and snprintf.
Referenced by stream_cleanup_files(), subxact_info_read(), and subxact_info_write().
|
static |
Definition at line 5282 of file worker.c.
References Assert, BufFileTell(), fb(), SubXactInfo::fileno, i, LogicalStreamingContext, MemoryContextSwitchTo(), ApplySubXactData::nsubxacts, ApplySubXactData::nsubxacts_max, SubXactInfo::offset, palloc(), repalloc(), stream_fd, stream_xid, subxact_data, ApplySubXactData::subxact_last, ApplySubXactData::subxacts, TransactionIdIsValid, and SubXactInfo::xid.
Referenced by handle_streamed_transaction().
|
static |
Definition at line 5231 of file worker.c.
References Assert, BufFileClose(), BufFileOpenFileSet(), BufFileReadExact(), fb(), fd(), len, LogicalStreamingContext, MAXPGPATH, MemoryContextSwitchTo(), MyLogicalRepWorker, ApplySubXactData::nsubxacts, ApplySubXactData::nsubxacts_max, palloc(), pg_ceil_log2_32(), LogicalRepWorker::stream_fileset, subxact_data, subxact_filename(), and ApplySubXactData::subxacts.
Referenced by stream_abort_internal(), and stream_start_internal().
|
static |
Definition at line 5182 of file worker.c.
References Assert, BufFileClose(), BufFileCreateFileSet(), BufFileDeleteFileSet(), BufFileOpenFileSet(), BufFileWrite(), cleanup_subxact_info(), fb(), fd(), len, MAXPGPATH, MyLogicalRepWorker, ApplySubXactData::nsubxacts, LogicalRepWorker::stream_fileset, subxact_data, subxact_filename(), ApplySubXactData::subxacts, and TransactionIdIsValid.
Referenced by stream_abort_internal(), and stream_stop_internal().
Definition at line 2601 of file worker.c.
References aclcheck_error(), ACLCHECK_OK, check_enable_rls(), ereport, errcode(), errmsg(), ERROR, fb(), get_rel_name(), get_relkind_objtype(), GetUserId(), GetUserNameFromId(), InvalidOid, mode, pg_class_aclcheck(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, and RLS_ENABLED.
Referenced by apply_handle_delete_internal(), apply_handle_insert_internal(), apply_handle_truncate(), apply_handle_tuple_routing(), apply_handle_update_internal(), and FindReplTupleInLocalRel().
Definition at line 4882 of file worker.c.
References ApplyLauncherWakeup(), CommitTransactionCommand(), GetTransactionSnapshot(), IsTransactionState(), MySubscription, Subscription::oid, PopActiveSnapshot(), PushActiveSnapshot(), Subscription::retentionactive, StartTransactionCommand(), and UpdateDeadTupleRetentionStatus().
Referenced by resume_conflict_info_retention(), and stop_conflict_info_retention().
|
static |
Definition at line 3965 of file worker.c.
References fb(), GetCurrentTimestamp(), LogicalRepWorker::last_lsn, LogicalRepWorker::last_recv_time, LogicalRepWorker::last_send_time, MyLogicalRepWorker, LogicalRepWorker::reply_lsn, and LogicalRepWorker::reply_time.
Referenced by LogicalRepApplyLoop().
|
static |
Definition at line 4614 of file worker.c.
References AllTablesyncsReady(), ApplyLauncherWakeup(), Assert, DEBUG2, elog, ereport, errdetail_internal(), errmsg_internal(), ERROR, fb(), get_flush_position(), GetCurrentTimestamp(), HasSubscriptionTablesCached(), last_flushpos, LSN_FORMAT_ARGS, MyLogicalRepWorker, MySubscription, now(), LogicalRepWorker::oldest_nonremovable_xid, process_rdt_phase_transition(), RDT_RESUME_CONFLICT_INFO_RETENTION, RDT_STOP_CONFLICT_INFO_RETENTION, LogicalRepWorker::relmutex, reset_retention_data_fields(), Subscription::retentionactive, should_stop_conflict_info_retention(), SpinLockAcquire, SpinLockRelease, TimestampDifferenceExceeds(), TimestampDifferenceMilliseconds(), TransactionIdIsValid, WalWriterDelay, and XLogRecPtrIsValid.
Referenced by process_rdt_phase_transition().
|
static |
Definition at line 4555 of file worker.c.
References fb(), FullTransactionIdIsValid, FullTransactionIdPrecedesOrEquals, process_rdt_phase_transition(), RDT_REQUEST_PUBLISHER_STATUS, RDT_STOP_CONFLICT_INFO_RETENTION, RDT_WAIT_FOR_LOCAL_FLUSH, and should_stop_conflict_info_retention().
Referenced by process_rdt_phase_transition().
|
static |
Definition at line 459 of file worker.c.
Referenced by apply_dispatch(), apply_error_callback(), apply_handle_delete(), apply_handle_insert(), apply_handle_update(), reset_apply_error_context_info(), set_apply_error_context_origin(), set_apply_error_context_xact(), slot_modify_data(), and slot_store_data().
| ErrorContextCallback* apply_error_context_stack = NULL |
Definition at line 469 of file worker.c.
Referenced by LogicalRepApplyLoop(), and ProcessParallelApplyMessage().
| MemoryContext ApplyContext = NULL |
Definition at line 472 of file worker.c.
Referenced by copy_sequences(), InitializeLogRepWorker(), LogicalParallelApplyLoop(), LogicalRepApplyLoop(), LogicalRepSyncSequences(), maybe_reread_subscription(), pa_allocate_worker(), pa_launch_parallel_worker(), request_publisher_status(), send_feedback(), set_apply_error_context_origin(), start_table_sync(), store_flush_position(), and stream_start_internal().
| MemoryContext ApplyMessageContext = NULL |
Definition at line 471 of file worker.c.
Referenced by apply_spooled_messages(), begin_replication_step(), LogicalParallelApplyLoop(), LogicalRepApplyLoop(), and store_flush_position().
Definition at line 484 of file worker.c.
Referenced by apply_handle_begin(), apply_handle_begin_prepare(), apply_handle_commit_internal(), apply_handle_commit_prepared(), apply_handle_origin(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_prepare(), apply_spooled_messages(), LogicalRepApplyLoop(), and maybe_start_skipping_changes().
Definition at line 488 of file worker.c.
Referenced by apply_handle_origin(), apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_handle_stream_start(), apply_handle_stream_stop(), get_transaction_apply_action(), LogicalRepApplyLoop(), maybe_start_skipping_changes(), and stream_open_and_write_change().
Definition at line 499 of file worker.c.
Referenced by ApplyWorkerMain(), logicalrep_worker_onexit(), and ParallelApplyWorkerMain().
|
static |
Definition at line 527 of file worker.c.
Referenced by send_feedback(), and wait_for_local_flush().
|
static |
Definition at line 475 of file worker.c.
Referenced by LogicalRepApplyLoop(), stream_open_file(), stream_stop_internal(), subxact_info_add(), and subxact_info_read().
| WalReceiverConn* LogRepWorkerWalRcvConn = NULL |
Definition at line 477 of file worker.c.
Referenced by copy_read_data(), copy_table(), fetch_remote_table_info(), logicalrep_worker_onexit(), LogicalRepApplyLoop(), LogicalRepSyncSequences(), LogicalRepSyncTableStart(), ProcessSyncingTablesForSync(), request_publisher_status(), run_apply_worker(), run_tablesync_worker(), send_feedback(), and set_stream_options().
|
static |
Definition at line 308 of file worker.c.
Referenced by get_flush_position(), LogicalRepApplyLoop(), and store_flush_position().
| Subscription* MySubscription = NULL |
Definition at line 479 of file worker.c.
Referenced by adjust_xid_advance_interval(), apply_handle_commit_prepared(), apply_handle_delete(), apply_handle_insert(), apply_handle_prepare_internal(), apply_handle_rollback_prepared(), apply_handle_truncate(), apply_handle_update(), can_advance_nonremovable_xid(), clear_subscription_skip_lsn(), copy_sequence(), copy_sequences(), copy_table(), DisableSubscriptionAndExit(), fetch_remote_table_info(), FetchRelationStates(), FindDeletedTupleInLocalRel(), FinishSyncWorker(), InitializeLogRepWorker(), launch_sync_worker(), logicalrep_rel_open(), LogicalRepApplyLoop(), LogicalRepSyncSequences(), LogicalRepSyncTableStart(), maybe_reread_subscription(), maybe_start_skipping_changes(), pa_can_start(), pa_launch_parallel_worker(), pa_start_subtrans(), pa_stream_abort(), ParallelApplyWorkerMain(), ProcessParallelApplyInterrupts(), ProcessSyncingTablesForApply(), report_sequence_errors(), ReportApplyConflict(), resume_conflict_info_retention(), run_apply_worker(), run_tablesync_worker(), set_stream_options(), SetupApplyOrSyncWorker(), should_apply_changes_for_rel(), should_stop_conflict_info_retention(), start_apply(), start_sequence_sync(), start_table_sync(), stop_conflict_info_retention(), update_retention_status(), and wait_for_local_flush().
Definition at line 480 of file worker.c.
Referenced by InitializeLogRepWorker(), maybe_reread_subscription(), and subscription_change_cb().
Definition at line 482 of file worker.c.
Referenced by AtEOXact_LogicalRepWorkers(), and LogicalRepWorkersWakeupAtCommit().
|
static |
Definition at line 496 of file worker.c.
Referenced by apply_handle_stream_start(), apply_handle_stream_stop(), and handle_streamed_transaction().
|
static |
Definition at line 485 of file worker.c.
Referenced by apply_handle_begin(), apply_handle_begin_prepare(), apply_handle_commit(), apply_handle_prepare(), apply_spooled_messages(), and should_apply_changes_for_rel().
|
static |
Definition at line 516 of file worker.c.
Referenced by maybe_start_skipping_changes(), and stop_skipping_changes().
Definition at line 520 of file worker.c.
Referenced by apply_handle_stream_abort(), apply_handle_stream_commit(), apply_handle_stream_prepare(), apply_spooled_messages(), handle_streamed_transaction(), stream_close_file(), stream_open_and_write_change(), stream_open_file(), stream_write_change(), and subxact_info_add().
|
static |
Definition at line 490 of file worker.c.
Referenced by apply_handle_begin(), apply_handle_begin_prepare(), apply_handle_stream_start(), apply_handle_stream_stop(), handle_streamed_transaction(), and subxact_info_add().
|
static |
Definition at line 545 of file worker.c.
Referenced by cleanup_subxact_info(), stream_abort_internal(), subxact_info_add(), subxact_info_read(), and subxact_info_write().