|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/genam.h"#include "access/heapam.h"#include "access/htup_details.h"#include "access/tableam.h"#include "catalog/indexing.h"#include "catalog/pg_subscription.h"#include "catalog/pg_subscription_rel.h"#include "catalog/pg_type.h"#include "miscadmin.h"#include "storage/lmgr.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/fmgroids.h"#include "utils/lsyscache.h"#include "utils/pg_lsn.h"#include "utils/rel.h"#include "utils/syscache.h"
Go to the source code of this file.
Functions | |
| static List * | textarray_to_stringlist (ArrayType *textarray) |
| void | GetPublicationsStr (List *publications, StringInfo dest, bool quote_literal) |
| Subscription * | GetSubscription (Oid subid, bool missing_ok) |
| int | CountDBSubscriptions (Oid dbid) |
| void | FreeSubscription (Subscription *sub) |
| void | DisableSubscription (Oid subid) |
| void | AddSubscriptionRelState (Oid subid, Oid relid, char state, XLogRecPtr sublsn, bool retain_lock) |
| void | UpdateSubscriptionRelState (Oid subid, Oid relid, char state, XLogRecPtr sublsn, bool already_locked) |
| char | GetSubscriptionRelState (Oid subid, Oid relid, XLogRecPtr *sublsn) |
| void | RemoveSubscriptionRel (Oid subid, Oid relid) |
| bool | HasSubscriptionTables (Oid subid) |
| List * | GetSubscriptionRelations (Oid subid, bool tables, bool sequences, bool not_ready) |
| void | UpdateDeadTupleRetentionStatus (Oid subid, bool active) |
| void AddSubscriptionRelState | ( | Oid | subid, |
| Oid | relid, | ||
| char | state, | ||
| XLogRecPtr | sublsn, | ||
| bool | retain_lock | ||
| ) |
Definition at line 270 of file pg_subscription.c.
References AccessShareLock, CatalogTupleInsert(), CharGetDatum(), elog, ERROR, heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, LockSharedObject(), LSNGetDatum(), NoLock, ObjectIdGetDatum(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, table_close(), table_open(), UnlockSharedObject(), values, and XLogRecPtrIsValid.
Referenced by AlterSubscription_refresh(), binary_upgrade_add_sub_rel_state(), and CreateSubscription().
| int CountDBSubscriptions | ( | Oid | dbid | ) |
Definition at line 157 of file pg_subscription.c.
References BTEqualStrategyNumber, HeapTupleIsValid, InvalidOid, NoLock, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by dropdb().
| void DisableSubscription | ( | Oid | subid | ) |
Definition at line 203 of file pg_subscription.c.
References AccessShareLock, BoolGetDatum(), CatalogTupleUpdate(), elog, ERROR, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, LockSharedObject(), NoLock, ObjectIdGetDatum(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by DisableSubscriptionAndExit().
| void FreeSubscription | ( | Subscription * | sub | ) |
Definition at line 189 of file pg_subscription.c.
References Subscription::conninfo, list_free_deep(), Subscription::name, pfree(), Subscription::publications, and Subscription::slotname.
Referenced by maybe_reread_subscription().
| void GetPublicationsStr | ( | List * | publications, |
| StringInfo | dest, | ||
| bool | quote_literal | ||
| ) |
Definition at line 41 of file pg_subscription.c.
References appendStringInfoChar(), appendStringInfoString(), Assert(), generate_unaccent_rules::dest, lfirst, NIL, quote_literal(), quote_literal_cstr(), and strVal.
Referenced by check_publications(), check_publications_origin_sequences(), check_publications_origin_tables(), fetch_relation_list(), and fetch_remote_table_info().
| Subscription * GetSubscription | ( | Oid | subid, |
| bool | missing_ok | ||
| ) |
Definition at line 72 of file pg_subscription.c.
References Subscription::binary, Subscription::conninfo, DatumGetArrayTypeP, DatumGetName(), Subscription::dbid, Subscription::disableonerr, elog, Subscription::enabled, ERROR, Subscription::failover, GETSTRUCT(), HeapTupleIsValid, Subscription::maxretention, Subscription::name, NameStr, ObjectIdGetDatum(), Subscription::oid, Subscription::origin, Subscription::owner, Subscription::ownersuperuser, palloc(), Subscription::passwordrequired, pstrdup(), Subscription::publications, ReleaseSysCache(), Subscription::retaindeadtuples, Subscription::retentionactive, Subscription::runasowner, SearchSysCache1(), Subscription::skiplsn, Subscription::slotname, Subscription::stream, superuser_arg(), Subscription::synccommit, SysCacheGetAttr(), SysCacheGetAttrNotNull(), textarray_to_stringlist(), TextDatumGetCString, and Subscription::twophasestate.
Referenced by AlterSubscription(), InitializeLogRepWorker(), and maybe_reread_subscription().
Definition at line 568 of file pg_subscription.c.
References AccessShareLock, Assert(), BTEqualStrategyNumber, CharGetDatum(), DatumGetLSN(), get_rel_relkind(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, InvalidXLogRecPtr, lappend(), SubscriptionRelState::lsn, NIL, ObjectIdGetDatum(), palloc(), SubscriptionRelState::relid, ScanKeyInit(), sequences, SubscriptionRelState::state, SysCacheGetAttr(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by AlterSubscription_refresh(), AlterSubscription_refresh_seq(), DropSubscription(), and FetchRelationStates().
| char GetSubscriptionRelState | ( | Oid | subid, |
| Oid | relid, | ||
| XLogRecPtr * | sublsn | ||
| ) |
Definition at line 390 of file pg_subscription.c.
References AccessShareLock, DatumGetLSN(), GETSTRUCT(), HeapTupleIsValid, InvalidXLogRecPtr, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache2(), SysCacheGetAttr(), table_close(), and table_open().
Referenced by AlterSubscription_refresh(), logicalrep_rel_open(), LogicalRepSyncTableStart(), and wait_for_table_state_change().
| bool HasSubscriptionTables | ( | Oid | subid | ) |
Definition at line 519 of file pg_subscription.c.
References AccessShareLock, BTEqualStrategyNumber, get_rel_relkind(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by FetchRelationStates().
Definition at line 440 of file pg_subscription.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, ForwardScanDirection, get_rel_name(), get_rel_relkind(), get_subscription_name(), GETSTRUCT(), heap_getnext(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, RowExclusiveLock, ScanKeyInit(), HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by AlterSubscription_refresh(), DropSubscription(), and heap_drop_with_catalog().
Definition at line 244 of file pg_subscription.c.
References deconstruct_array_builtin(), i, lappend(), makeString(), NIL, and TextDatumGetCString.
Referenced by GetSubscription().
| void UpdateDeadTupleRetentionStatus | ( | Oid | subid, |
| bool | active | ||
| ) |
Definition at line 645 of file pg_subscription.c.
References AccessShareLock, CatalogTupleUpdate(), elog, ERROR, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, LockSharedObject(), NoLock, ObjectIdGetDatum(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by update_retention_status().
| void UpdateSubscriptionRelState | ( | Oid | subid, |
| Oid | relid, | ||
| char | state, | ||
| XLogRecPtr | sublsn, | ||
| bool | already_locked | ||
| ) |
Definition at line 324 of file pg_subscription.c.
References AccessShareLock, Assert(), CatalogTupleUpdate(), CharGetDatum(), CheckRelationOidLockedByMe(), elog, ERROR, heap_modify_tuple(), HeapTupleIsValid, InvalidOid, LockHeldByMe(), LockSharedObject(), LSNGetDatum(), NoLock, ObjectIdGetDatum(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, SET_LOCKTAG_OBJECT, HeapTupleData::t_self, table_close(), table_open(), values, and XLogRecPtrIsValid.
Referenced by AlterSubscription_refresh_seq(), copy_sequence(), LogicalRepSyncTableStart(), ProcessSyncingTablesForApply(), and ProcessSyncingTablesForSync().