Fixes worker pg_dist_object removal issue

pull/7240/head
gindibay 2023-10-24 10:32:27 +03:00
parent 690276c516
commit 2d009d46d3
1 changed files with 15 additions and 1 deletions

View File

@ -365,6 +365,20 @@ GetUnmarkDatabaseDistributedSql(char *dbName)
} }
static void
UnmarkObjectDistributedForDropDb(const ObjectAddress *distAddress, char *dbName)
{
UnmarkObjectDistributed(distAddress);
if (EnableMetadataSync)
{
char *workerPgDistObjectUpdateCommand =
GetUnmarkDatabaseDistributedSql(dbName);
SendCommandToWorkersWithMetadata(workerPgDistObjectUpdateCommand);
}
}
List * List *
PreprocessDropDatabaseStmt(Node *node, const char *queryString, PreprocessDropDatabaseStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext) ProcessUtilityContext processUtilityContext)
@ -394,7 +408,7 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
return NIL; return NIL;
} }
UnmarkObjectDistributed(&dbAddress); UnmarkObjectDistributedForDropDb(&dbAddress, stmt->dbname);
char *unmarkDatabaseDistributedSql = GetUnmarkDatabaseDistributedSql(stmt->dbname); char *unmarkDatabaseDistributedSql = GetUnmarkDatabaseDistributedSql(stmt->dbname);
char *dropDatabaseCommand = DeparseTreeNode(node); char *dropDatabaseCommand = DeparseTreeNode(node);