mirror of https://github.com/citusdata/citus.git
Fixes review issues
parent
91b1e8ab5e
commit
6bff0ad924
|
@ -100,8 +100,8 @@
|
||||||
* supported from non-main databases and whether it should be marked as
|
* supported from non-main databases and whether it should be marked as
|
||||||
* distributed explicitly (*).
|
* distributed explicitly (*).
|
||||||
*
|
*
|
||||||
* We always have to mark such the objects created "as distributed" but while for
|
* (*) We always have to mark such objects as "distributed" but while for some
|
||||||
* some object types we can delegate this to main database, for some others we have
|
* object types we can delegate this to main database, for some others we have
|
||||||
* to explicitly send a command to all nodes in this code-path to achieve this.
|
* to explicitly send a command to all nodes in this code-path to achieve this.
|
||||||
*/
|
*/
|
||||||
typedef struct NonMainDbDistributedStatementInfo
|
typedef struct NonMainDbDistributedStatementInfo
|
||||||
|
@ -157,8 +157,8 @@ static void RunPreprocessMainDBCommand(Node *parsetree, const char *queryString)
|
||||||
static void RunPostprocessMainDBCommand(Node *parsetree);
|
static void RunPostprocessMainDBCommand(Node *parsetree);
|
||||||
static bool IsStatementSupportedInNonMainDb(Node *parsetree);
|
static bool IsStatementSupportedInNonMainDb(Node *parsetree);
|
||||||
static bool StatementRequiresMarkDistributedFromNonMainDb(Node *parsetree);
|
static bool StatementRequiresMarkDistributedFromNonMainDb(Node *parsetree);
|
||||||
static ObjectInfo GetObjectInfo(Node *parsetree);
|
|
||||||
static void MarkObjectDistributedInNonMainDb(Node *parsetree);
|
static void MarkObjectDistributedInNonMainDb(Node *parsetree);
|
||||||
|
static ObjectInfo GetObjectInfo(Node *parsetree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ProcessUtilityParseTree is a convenience method to create a PlannedStmt out of
|
* ProcessUtilityParseTree is a convenience method to create a PlannedStmt out of
|
||||||
|
@ -1673,23 +1673,26 @@ RunPostprocessMainDBCommand(Node *parsetree)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GetObjectInfo returns the name and oid of the object in the given parsetree.
|
* GetObjectInfo returns ObjectInfo for the target object of given parsetree.
|
||||||
*/
|
*/
|
||||||
static ObjectInfo
|
static ObjectInfo
|
||||||
GetObjectInfo(Node *parsetree)
|
GetObjectInfo(Node *parsetree)
|
||||||
{
|
{
|
||||||
ObjectInfo info;
|
|
||||||
|
|
||||||
if (IsA(parsetree, CreateRoleStmt))
|
if (IsA(parsetree, CreateRoleStmt))
|
||||||
{
|
{
|
||||||
CreateRoleStmt *stmt = castNode(CreateRoleStmt, parsetree);
|
CreateRoleStmt *stmt = castNode(CreateRoleStmt, parsetree);
|
||||||
info.name = stmt->role;
|
ObjectInfo info = {
|
||||||
info.id = get_role_oid(stmt->role, false);
|
.name = stmt->role,
|
||||||
|
.id = get_role_oid(stmt->role, false)
|
||||||
|
};
|
||||||
|
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add else if branches for other statement types */
|
/* Add else if branches for other statement types */
|
||||||
|
|
||||||
return info;
|
elog(ERROR, "unsupported statement type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1713,7 +1716,7 @@ MarkObjectDistributedInNonMainDb(Node *parsetree)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IsStatementSupportedIn2Pc returns true if the statement is supported from a
|
* IsStatementSupportedInNonMainDb returns true if the statement is supported from a
|
||||||
* non-main database.
|
* non-main database.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
|
@ -1735,7 +1738,7 @@ IsStatementSupportedInNonMainDb(Node *parsetree)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DoesStatementRequireMarkDistributedFor2PC returns true if the statement should be marked
|
* StatementRequiresMarkDistributedFromNonMainDb returns true if the statement should be marked
|
||||||
* as distributed when executed from a non-main database.
|
* as distributed when executed from a non-main database.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
|
|
|
@ -127,12 +127,12 @@ $$);
|
||||||
[{"member":"grant_role2pc_user2","role":"grant_role2pc_user1","grantor":"postgres","admin_option":true},{"member":"grant_role2pc_user3","role":"grant_role2pc_user2","grantor":"postgres","admin_option":true},{"member":"grant_role2pc_user5","role":"grant_role2pc_user2","grantor":"grant_role2pc_user3","admin_option":false},{"member":"grant_role2pc_user6","role":"grant_role2pc_user2","grantor":"grant_role2pc_user3","admin_option":false},{"member":"grant_role2pc_user7","role":"grant_role2pc_user2","grantor":"grant_role2pc_user3","admin_option":false}]
|
[{"member":"grant_role2pc_user2","role":"grant_role2pc_user1","grantor":"postgres","admin_option":true},{"member":"grant_role2pc_user3","role":"grant_role2pc_user2","grantor":"postgres","admin_option":true},{"member":"grant_role2pc_user5","role":"grant_role2pc_user2","grantor":"grant_role2pc_user3","admin_option":false},{"member":"grant_role2pc_user6","role":"grant_role2pc_user2","grantor":"grant_role2pc_user3","admin_option":false},{"member":"grant_role2pc_user7","role":"grant_role2pc_user2","grantor":"grant_role2pc_user3","admin_option":false}]
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c grant_role2pc_db - - :worker_1_port
|
||||||
BEGIN;
|
BEGIN;
|
||||||
grant grant_role2pc_user1 to grant_role2pc_user5 WITH ADMIN OPTION;
|
grant grant_role2pc_user1 to grant_role2pc_user5 WITH ADMIN OPTION;
|
||||||
grant grant_role2pc_user1 to grant_role2pc_user6;
|
grant grant_role2pc_user1 to grant_role2pc_user6;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
\c - - - :master_port
|
\c regression - - :master_port
|
||||||
select result FROM run_command_on_all_nodes($$
|
select result FROM run_command_on_all_nodes($$
|
||||||
SELECT array_to_json(array_agg(row_to_json(t)))
|
SELECT array_to_json(array_agg(row_to_json(t)))
|
||||||
FROM (
|
FROM (
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
CREATE SCHEMA grant_role2pc;
|
CREATE SCHEMA grant_role2pc;
|
||||||
SET search_path TO grant_role2pc;
|
SET search_path TO grant_role2pc;
|
||||||
set citus.enable_create_database_propagation to on;
|
set citus.enable_create_database_propagation to on;
|
||||||
|
@ -119,13 +117,13 @@ FROM (
|
||||||
) t
|
) t
|
||||||
$$);
|
$$);
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c grant_role2pc_db - - :worker_1_port
|
||||||
BEGIN;
|
BEGIN;
|
||||||
grant grant_role2pc_user1 to grant_role2pc_user5 WITH ADMIN OPTION;
|
grant grant_role2pc_user1 to grant_role2pc_user5 WITH ADMIN OPTION;
|
||||||
grant grant_role2pc_user1 to grant_role2pc_user6;
|
grant grant_role2pc_user1 to grant_role2pc_user6;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
\c - - - :master_port
|
\c regression - - :master_port
|
||||||
|
|
||||||
select result FROM run_command_on_all_nodes($$
|
select result FROM run_command_on_all_nodes($$
|
||||||
SELECT array_to_json(array_agg(row_to_json(t)))
|
SELECT array_to_json(array_agg(row_to_json(t)))
|
||||||
|
|
Loading…
Reference in New Issue