Record dependencies on owners for logical replication objects
This was forgotten in 665d1fad99
and
caused the whole buildfarm to become red for a little while.
Author: Petr Jelínek
Also fix a typo in a nearby error message.
This commit is contained in:
parent
a600ee9e3f
commit
50cf1c80e6
|
@ -218,6 +218,8 @@ CreatePublication(CreatePublicationStmt *stmt)
|
||||||
CatalogUpdateIndexes(rel, tup);
|
CatalogUpdateIndexes(rel, tup);
|
||||||
heap_freetuple(tup);
|
heap_freetuple(tup);
|
||||||
|
|
||||||
|
recordDependencyOnOwner(PublicationRelationId, puboid, GetUserId());
|
||||||
|
|
||||||
ObjectAddressSet(myself, PublicationRelationId, puboid);
|
ObjectAddressSet(myself, PublicationRelationId, puboid);
|
||||||
|
|
||||||
/* Make the changes visible. */
|
/* Make the changes visible. */
|
||||||
|
|
|
@ -210,6 +210,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt)
|
||||||
Oid subid;
|
Oid subid;
|
||||||
bool nulls[Natts_pg_subscription];
|
bool nulls[Natts_pg_subscription];
|
||||||
Datum values[Natts_pg_subscription];
|
Datum values[Natts_pg_subscription];
|
||||||
|
Oid owner = GetUserId();
|
||||||
HeapTuple tup;
|
HeapTuple tup;
|
||||||
bool enabled_given;
|
bool enabled_given;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
@ -263,7 +264,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt)
|
||||||
values[Anum_pg_subscription_subdbid - 1] = ObjectIdGetDatum(MyDatabaseId);
|
values[Anum_pg_subscription_subdbid - 1] = ObjectIdGetDatum(MyDatabaseId);
|
||||||
values[Anum_pg_subscription_subname - 1] =
|
values[Anum_pg_subscription_subname - 1] =
|
||||||
DirectFunctionCall1(namein, CStringGetDatum(stmt->subname));
|
DirectFunctionCall1(namein, CStringGetDatum(stmt->subname));
|
||||||
values[Anum_pg_subscription_subowner - 1] = ObjectIdGetDatum(GetUserId());
|
values[Anum_pg_subscription_subowner - 1] = ObjectIdGetDatum(owner);
|
||||||
values[Anum_pg_subscription_subenabled - 1] = BoolGetDatum(enabled);
|
values[Anum_pg_subscription_subenabled - 1] = BoolGetDatum(enabled);
|
||||||
values[Anum_pg_subscription_subconninfo - 1] =
|
values[Anum_pg_subscription_subconninfo - 1] =
|
||||||
CStringGetTextDatum(conninfo);
|
CStringGetTextDatum(conninfo);
|
||||||
|
@ -279,6 +280,8 @@ CreateSubscription(CreateSubscriptionStmt *stmt)
|
||||||
CatalogUpdateIndexes(rel, tup);
|
CatalogUpdateIndexes(rel, tup);
|
||||||
heap_freetuple(tup);
|
heap_freetuple(tup);
|
||||||
|
|
||||||
|
recordDependencyOnOwner(SubscriptionRelationId, subid, owner);
|
||||||
|
|
||||||
snprintf(originname, sizeof(originname), "pg_%u", subid);
|
snprintf(originname, sizeof(originname), "pg_%u", subid);
|
||||||
replorigin_create(originname);
|
replorigin_create(originname);
|
||||||
|
|
||||||
|
@ -493,6 +496,9 @@ DropSubscription(DropSubscriptionStmt *stmt)
|
||||||
|
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
|
|
||||||
|
/* Clean up dependencies */
|
||||||
|
deleteSharedDependencyRecordsFor(SubscriptionRelationId, subid, 0);
|
||||||
|
|
||||||
/* Protect against launcher restarting the worker. */
|
/* Protect against launcher restarting the worker. */
|
||||||
LWLockAcquire(LogicalRepLauncherLock, LW_EXCLUSIVE);
|
LWLockAcquire(LogicalRepLauncherLock, LW_EXCLUSIVE);
|
||||||
|
|
||||||
|
@ -530,7 +536,7 @@ DropSubscription(DropSubscriptionStmt *stmt)
|
||||||
|
|
||||||
if (!walrcv_command(wrconn, cmd.data, &err))
|
if (!walrcv_command(wrconn, cmd.data, &err))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errmsg("count not drop the replication slot \"%s\" on publisher",
|
(errmsg("could not drop the replication slot \"%s\" on publisher",
|
||||||
slotname),
|
slotname),
|
||||||
errdetail("The error was: %s", err)));
|
errdetail("The error was: %s", err)));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue