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) |
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) |
char | GetSubscriptionRelState (Oid subid, Oid relid, XLogRecPtr *sublsn) |
void | RemoveSubscriptionRel (Oid subid, Oid relid) |
bool | HasSubscriptionRelations (Oid subid) |
List * | GetSubscriptionRelations (Oid subid, bool not_ready) |
void AddSubscriptionRelState | ( | Oid | subid, |
Oid | relid, | ||
char | state, | ||
XLogRecPtr | sublsn, | ||
bool | retain_lock | ||
) |
Definition at line 236 of file pg_subscription.c.
References AccessShareLock, CatalogTupleInsert(), CharGetDatum(), elog, ERROR, heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, InvalidXLogRecPtr, LockSharedObject(), LSNGetDatum(), NoLock, ObjectIdGetDatum(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, table_close(), table_open(), UnlockSharedObject(), and values.
Referenced by AlterSubscription_refresh(), binary_upgrade_add_sub_rel_state(), and CreateSubscription().
int CountDBSubscriptions | ( | Oid | dbid | ) |
Definition at line 123 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 169 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 155 of file pg_subscription.c.
References Subscription::conninfo, list_free_deep(), Subscription::name, pfree(), Subscription::publications, and Subscription::slotname.
Referenced by maybe_reread_subscription().
Subscription* GetSubscription | ( | Oid | subid, |
bool | missing_ok | ||
) |
Definition at line 41 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::name, NameStr, ObjectIdGetDatum(), Subscription::oid, Subscription::origin, Subscription::owner, Subscription::ownersuperuser, palloc(), Subscription::passwordrequired, pstrdup(), Subscription::publications, ReleaseSysCache(), 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 501 of file pg_subscription.c.
References AccessShareLock, BTEqualStrategyNumber, CharGetDatum(), DatumGetLSN(), GETSTRUCT, HeapTupleIsValid, InvalidOid, InvalidXLogRecPtr, lappend(), SubscriptionRelState::lsn, NIL, ObjectIdGetDatum(), palloc(), SubscriptionRelState::relid, res, ScanKeyInit(), SubscriptionRelState::state, SysCacheGetAttr(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by AlterSubscription_refresh(), DropSubscription(), and FetchTableStates().
char GetSubscriptionRelState | ( | Oid | subid, |
Oid | relid, | ||
XLogRecPtr * | sublsn | ||
) |
Definition at line 341 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_relation_state_change().
Definition at line 466 of file pg_subscription.c.
References AccessShareLock, BTEqualStrategyNumber, HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by FetchTableStates().
Definition at line 391 of file pg_subscription.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, ForwardScanDirection, get_rel_name(), 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 210 of file pg_subscription.c.
References deconstruct_array_builtin(), i, lappend(), makeString(), NIL, res, and TextDatumGetCString.
Referenced by GetSubscription().
void UpdateSubscriptionRelState | ( | Oid | subid, |
Oid | relid, | ||
char | state, | ||
XLogRecPtr | sublsn | ||
) |
Definition at line 290 of file pg_subscription.c.
References AccessShareLock, CatalogTupleUpdate(), CharGetDatum(), elog, ERROR, heap_modify_tuple(), HeapTupleIsValid, InvalidXLogRecPtr, LockSharedObject(), LSNGetDatum(), NoLock, ObjectIdGetDatum(), RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by LogicalRepSyncTableStart(), process_syncing_tables_for_apply(), and process_syncing_tables_for_sync().