mirror of https://github.com/citusdata/citus.git
Merge branch 'main' into missing_grantor_sync
commit
29fdac0ab6
|
@ -20,6 +20,6 @@ tail -n +$RegisterCitusConfigVariables_begin_linenumber src/backend/distributed/
|
||||||
|
|
||||||
# extract citus gucs in the form of <tab><tab>"citus.X"
|
# extract citus gucs in the form of <tab><tab>"citus.X"
|
||||||
grep -P "^[\t][\t]\"citus\.[a-zA-Z_0-9]+\"" RegisterCitusConfigVariables_func_def.out > gucs.out
|
grep -P "^[\t][\t]\"citus\.[a-zA-Z_0-9]+\"" RegisterCitusConfigVariables_func_def.out > gucs.out
|
||||||
sort -c gucs.out
|
LC_COLLATE=C sort -c gucs.out
|
||||||
rm gucs.out
|
rm gucs.out
|
||||||
rm RegisterCitusConfigVariables_func_def.out
|
rm RegisterCitusConfigVariables_func_def.out
|
||||||
|
|
|
@ -481,9 +481,7 @@ PreprocessCreateDatabaseStmt(Node *node, const char *queryString,
|
||||||
/*
|
/*
|
||||||
* PostprocessCreateDatabaseStmt is executed after the statement is applied to the local
|
* PostprocessCreateDatabaseStmt is executed after the statement is applied to the local
|
||||||
* postgres instance. In this stage we prepare the commands that need to be run on
|
* postgres instance. In this stage we prepare the commands that need to be run on
|
||||||
* all workers to create the database. Since the CREATE DATABASE statement gives error
|
* all workers to create the database.
|
||||||
* in a transaction block, we need to use NontransactionalNodeDDLTaskList to send the
|
|
||||||
* CREATE DATABASE statement to the workers.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
List *
|
List *
|
||||||
|
@ -508,20 +506,25 @@ PostprocessCreateDatabaseStmt(Node *node, const char *queryString)
|
||||||
|
|
||||||
char *createDatabaseCommand = DeparseTreeNode(node);
|
char *createDatabaseCommand = DeparseTreeNode(node);
|
||||||
|
|
||||||
List *commands = list_make3(DISABLE_DDL_PROPAGATION,
|
List *createDatabaseCommands = list_make3(DISABLE_DDL_PROPAGATION,
|
||||||
(void *) createDatabaseCommand,
|
(void *) createDatabaseCommand,
|
||||||
ENABLE_DDL_PROPAGATION);
|
ENABLE_DDL_PROPAGATION);
|
||||||
|
|
||||||
return NontransactionalNodeDDLTaskList(REMOTE_NODES, commands);
|
/*
|
||||||
|
* Since the CREATE DATABASE statements cannot be executed in a transaction
|
||||||
|
* block, we need to use NontransactionalNodeDDLTaskList() to send the CREATE
|
||||||
|
* DATABASE statement to the workers.
|
||||||
|
*/
|
||||||
|
List *createDatabaseDDLJobList =
|
||||||
|
NontransactionalNodeDDLTaskList(REMOTE_NODES, createDatabaseCommands);
|
||||||
|
return createDatabaseDDLJobList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PreprocessDropDatabaseStmt is executed before the statement is applied to the local
|
* PreprocessDropDatabaseStmt is executed before the statement is applied to the local
|
||||||
* postgres instance. In this stage we can prepare the commands that need to be run on
|
* postgres instance. In this stage we can prepare the commands that need to be run on
|
||||||
* all workers to drop the database. Since the DROP DATABASE statement gives error in
|
* all workers to drop the database.
|
||||||
* transaction context, we need to use NontransactionalNodeDDLTaskList to send the
|
|
||||||
* DROP DATABASE statement to the workers.
|
|
||||||
*
|
*
|
||||||
* We also serialize database commands globally by acquiring a Citus specific advisory
|
* We also serialize database commands globally by acquiring a Citus specific advisory
|
||||||
* lock based on OCLASS_DATABASE on the first primary worker node.
|
* lock based on OCLASS_DATABASE on the first primary worker node.
|
||||||
|
@ -559,11 +562,18 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
|
||||||
|
|
||||||
char *dropDatabaseCommand = DeparseTreeNode(node);
|
char *dropDatabaseCommand = DeparseTreeNode(node);
|
||||||
|
|
||||||
List *commands = list_make3(DISABLE_DDL_PROPAGATION,
|
List *dropDatabaseCommands = list_make3(DISABLE_DDL_PROPAGATION,
|
||||||
(void *) dropDatabaseCommand,
|
(void *) dropDatabaseCommand,
|
||||||
ENABLE_DDL_PROPAGATION);
|
ENABLE_DDL_PROPAGATION);
|
||||||
|
|
||||||
return NontransactionalNodeDDLTaskList(REMOTE_NODES, commands);
|
/*
|
||||||
|
* Due to same reason stated in PostprocessCreateDatabaseStmt(), we need to
|
||||||
|
* use NontransactionalNodeDDLTaskList() to send the DROP DATABASE statement
|
||||||
|
* to the workers.
|
||||||
|
*/
|
||||||
|
List *dropDatabaseDDLJobList =
|
||||||
|
NontransactionalNodeDDLTaskList(REMOTE_NODES, dropDatabaseCommands);
|
||||||
|
return dropDatabaseDDLJobList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue