|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "catalog/pg_subscription_rel.h"#include "pgstat.h"#include "replication/logicallauncher.h"#include "replication/worker_internal.h"#include "storage/ipc.h"#include "utils/lsyscache.h"#include "utils/memutils.h"
Go to the source code of this file.
Enumerations | |
| enum | SyncingRelationsState { SYNC_RELATIONS_STATE_NEEDS_REBUILD , SYNC_RELATIONS_STATE_REBUILD_STARTED , SYNC_RELATIONS_STATE_VALID } |
Functions | |
| pg_noreturn void | FinishSyncWorker (void) |
| void | InvalidateSyncingRelStates (Datum arg, int cacheid, uint32 hashvalue) |
| void | launch_sync_worker (LogicalRepWorkerType wtype, int nsyncworkers, Oid relid, TimestampTz *last_start_time) |
| void | ProcessSyncingRelations (XLogRecPtr current_lsn) |
| void | FetchRelationStates (bool *has_pending_subtables, bool *has_pending_subsequences, bool *started_tx) |
Variables | |
| static SyncingRelationsState | relation_states_validity = SYNC_RELATIONS_STATE_NEEDS_REBUILD |
| Enumerator | |
|---|---|
| SYNC_RELATIONS_STATE_NEEDS_REBUILD | |
| SYNC_RELATIONS_STATE_REBUILD_STARTED | |
| SYNC_RELATIONS_STATE_VALID | |
Definition at line 37 of file syncutils.c.
| void FetchRelationStates | ( | bool * | has_pending_subtables, |
| bool * | has_pending_subsequences, | ||
| bool * | started_tx | ||
| ) |
Definition at line 202 of file syncutils.c.
References CacheMemoryContext, foreach_ptr, get_rel_relkind(), GetSubscriptionRelations(), HasSubscriptionTables(), IsTransactionState(), lappend(), list_free_deep(), MemoryContextSwitchTo(), MySubscription, NIL, Subscription::oid, palloc(), relation_states_validity, StartTransactionCommand(), SYNC_RELATIONS_STATE_REBUILD_STARTED, SYNC_RELATIONS_STATE_VALID, and table_states_not_ready.
Referenced by AllTablesyncsReady(), HasSubscriptionTablesCached(), ProcessSequencesForSync(), and ProcessSyncingTablesForApply().
| pg_noreturn void FinishSyncWorker | ( | void | ) |
Definition at line 50 of file syncutils.c.
References am_sequencesync_worker(), am_tablesync_worker(), Assert(), CommitTransactionCommand(), ereport, errmsg(), get_rel_name(), GetXLogWriteRecPtr(), InvalidOid, IsTransactionState(), LOG, logicalrep_reset_seqsync_start_time(), logicalrep_worker_wakeup(), MyLogicalRepWorker, MySubscription, Subscription::name, pgstat_report_stat(), proc_exit(), LogicalRepWorker::relid, StartTransactionCommand(), LogicalRepWorker::subid, WORKERTYPE_APPLY, and XLogFlush().
Referenced by LogicalRepSyncTableStart(), ProcessSyncingTablesForSync(), SequenceSyncWorkerMain(), and TableSyncWorkerMain().
Definition at line 101 of file syncutils.c.
References relation_states_validity, and SYNC_RELATIONS_STATE_NEEDS_REBUILD.
Referenced by ParallelApplyWorkerMain(), and SetupApplyOrSyncWorker().
| void launch_sync_worker | ( | LogicalRepWorkerType | wtype, |
| int | nsyncworkers, | ||
| Oid | relid, | ||
| TimestampTz * | last_start_time | ||
| ) |
Definition at line 117 of file syncutils.c.
References Assert(), LogicalRepWorker::dbid, DSM_HANDLE_INVALID, GetCurrentTimestamp(), logicalrep_worker_launch(), max_sync_workers_per_subscription, MyLogicalRepWorker, MySubscription, Subscription::name, now(), Subscription::oid, OidIsValid, TimestampDifferenceExceeds(), LogicalRepWorker::userid, wal_retrieve_retry_interval, WORKERTYPE_SEQUENCESYNC, and WORKERTYPE_TABLESYNC.
Referenced by ProcessSequencesForSync(), and ProcessSyncingTablesForApply().
| void ProcessSyncingRelations | ( | XLogRecPtr | current_lsn | ) |
Definition at line 155 of file syncutils.c.
References elog, ERROR, MyLogicalRepWorker, ProcessSequencesForSync(), ProcessSyncingTablesForApply(), ProcessSyncingTablesForSync(), LogicalRepWorker::type, WORKERTYPE_APPLY, WORKERTYPE_PARALLEL_APPLY, WORKERTYPE_SEQUENCESYNC, WORKERTYPE_TABLESYNC, and WORKERTYPE_UNKNOWN.
Referenced by apply_handle_commit(), apply_handle_commit_prepared(), apply_handle_prepare(), apply_handle_rollback_prepared(), apply_handle_stream_commit(), apply_handle_stream_prepare(), and LogicalRepApplyLoop().
|
static |
Definition at line 44 of file syncutils.c.
Referenced by FetchRelationStates(), and InvalidateSyncingRelStates().