Merge pull request #5678 from citusdata/unify_gucs

Unify old GUCs into a single one
pull/5679/head^2
Önder Kalacı 2022-02-04 14:18:10 +01:00 committed by GitHub
commit b9b4833710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 273 additions and 238 deletions

View File

@ -34,8 +34,6 @@ static List * GetDependencyCreateDDLCommands(const ObjectAddress *dependency);
static List * FilterObjectAddressListByPredicate(List *objectAddressList, static List * FilterObjectAddressListByPredicate(List *objectAddressList,
AddressPredicate predicate); AddressPredicate predicate);
bool EnableDependencyCreation = true;
/* /*
* EnsureDependenciesExistOnAllNodes finds all the dependencies that we support and makes * EnsureDependenciesExistOnAllNodes finds all the dependencies that we support and makes
* sure these are available on all workers. If not available they will be created on the * sure these are available on all workers. If not available they will be created on the
@ -364,7 +362,7 @@ ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort)
List *dependencies = GetDistributedObjectAddressList(); List *dependencies = GetDistributedObjectAddressList();
/* /*
* Depending on changes in the environment, such as the enable_object_propagation guc * Depending on changes in the environment, such as the enable_metadata_sync guc
* there might be objects in the distributed object address list that should currently * there might be objects in the distributed object address list that should currently
* not be propagated by citus as they are 'not supported'. * not be propagated by citus as they are 'not supported'.
*/ */
@ -415,7 +413,7 @@ ShouldPropagate(void)
return false; return false;
} }
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* we are configured to disable object propagation, should not propagate anything * we are configured to disable object propagation, should not propagate anything

View File

@ -649,7 +649,7 @@ static bool
ShouldPropagateExtensionCommand(Node *parseTree) ShouldPropagateExtensionCommand(Node *parseTree)
{ {
/* if we disabled object propagation, then we should not propagate anything. */ /* if we disabled object propagation, then we should not propagate anything. */
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
return false; return false;
} }

View File

@ -200,8 +200,8 @@ create_distributed_function(PG_FUNCTION_ARGS)
const char *createFunctionSQL = GetFunctionDDLCommand(funcOid, true); const char *createFunctionSQL = GetFunctionDDLCommand(funcOid, true);
const char *alterFunctionOwnerSQL = GetFunctionAlterOwnerCommand(funcOid); const char *alterFunctionOwnerSQL = GetFunctionAlterOwnerCommand(funcOid);
initStringInfo(&ddlCommand); initStringInfo(&ddlCommand);
appendStringInfo(&ddlCommand, "%s;%s;%s;%s", DISABLE_OBJECT_PROPAGATION, appendStringInfo(&ddlCommand, "%s;%s;%s;%s", DISABLE_METADATA_SYNC,
createFunctionSQL, alterFunctionOwnerSQL, ENABLE_OBJECT_PROPAGATION); createFunctionSQL, alterFunctionOwnerSQL, ENABLE_METADATA_SYNC);
SendCommandToWorkersAsUser(NON_COORDINATOR_NODES, CurrentUserName(), ddlCommand.data); SendCommandToWorkersAsUser(NON_COORDINATOR_NODES, CurrentUserName(), ddlCommand.data);
MarkObjectDistributed(&functionAddress); MarkObjectDistributed(&functionAddress);
@ -698,7 +698,7 @@ UpdateFunctionDistributionInfo(const ObjectAddress *distAddress,
table_close(pgDistObjectRel, NoLock); table_close(pgDistObjectRel, NoLock);
if (EnableDependencyCreation) if (EnableMetadataSync)
{ {
List *objectAddressList = list_make1((ObjectAddress *) distAddress); List *objectAddressList = list_make1((ObjectAddress *) distAddress);
List *distArgumentIndexList = NIL; List *distArgumentIndexList = NIL;
@ -1206,7 +1206,7 @@ ShouldPropagateCreateFunction(CreateFunctionStmt *stmt)
return false; return false;
} }
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* we are configured to disable object propagation, should not propagate anything * we are configured to disable object propagation, should not propagate anything
@ -1254,7 +1254,7 @@ ShouldPropagateAlterFunction(const ObjectAddress *address)
return false; return false;
} }
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* we are configured to disable object propagation, should not propagate anything * we are configured to disable object propagation, should not propagate anything
@ -1556,7 +1556,7 @@ PreprocessDropFunctionStmt(Node *node, const char *queryString,
return NIL; return NIL;
} }
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* we are configured to disable object propagation, should not propagate anything * we are configured to disable object propagation, should not propagate anything
@ -1657,7 +1657,7 @@ PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString,
return NIL; return NIL;
} }
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* we are configured to disable object propagation, should not propagate anything * we are configured to disable object propagation, should not propagate anything

View File

@ -241,7 +241,7 @@ PreprocessDropSequenceStmt(Node *node, const char *queryString,
return NIL; return NIL;
} }
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* we are configured to disable object propagation, should not propagate anything * we are configured to disable object propagation, should not propagate anything

View File

@ -437,8 +437,12 @@ AcquireDistributedLockOnRelations(List *relationIdList, LOCKMODE lockMode)
/* /*
* We only acquire distributed lock on relation if * We only acquire distributed lock on relation if
* the relation is sync'ed between mx nodes. * the relation is sync'ed between mx nodes.
*
* Even if users disable metadata sync, we cannot
* allow them not to acquire the remote locks.
* Hence, we have !IsCoordinator() check.
*/ */
if (ShouldSyncTableMetadata(relationId)) if (ShouldSyncTableMetadata(relationId) || !IsCoordinator())
{ {
char *qualifiedRelationName = generate_qualified_relation_name(relationId); char *qualifiedRelationName = generate_qualified_relation_name(relationId);
StringInfo lockRelationCommand = makeStringInfo(); StringInfo lockRelationCommand = makeStringInfo();

View File

@ -558,7 +558,7 @@ IsObjectAddressCollected(ObjectAddress findAddress,
bool bool
SupportedDependencyByCitus(const ObjectAddress *address) SupportedDependencyByCitus(const ObjectAddress *address)
{ {
if (!EnableDependencyCreation) if (!EnableMetadataSync)
{ {
/* /*
* If the user has disabled object propagation we need to fall back to the legacy * If the user has disabled object propagation we need to fall back to the legacy

View File

@ -172,7 +172,7 @@ MarkObjectDistributed(const ObjectAddress *distAddress)
ereport(ERROR, (errmsg("failed to insert object into citus.pg_dist_object"))); ereport(ERROR, (errmsg("failed to insert object into citus.pg_dist_object")));
} }
if (EnableDependencyCreation) if (EnableMetadataSync)
{ {
/* create a list by adding the address of value to not to have warning */ /* create a list by adding the address of value to not to have warning */
List *objectAddressList = list_make1((ObjectAddress *) distAddress); List *objectAddressList = list_make1((ObjectAddress *) distAddress);

View File

@ -105,7 +105,7 @@ static AccessPriv * GetAccessPrivObjectForGrantStmt(char *permission);
static RoleSpec * GetRoleSpecObjectForGrantStmt(Oid roleOid); static RoleSpec * GetRoleSpecObjectForGrantStmt(Oid roleOid);
static List * GenerateGrantOnSchemaQueriesFromAclItem(Oid schemaOid, static List * GenerateGrantOnSchemaQueriesFromAclItem(Oid schemaOid,
AclItem *aclItem); AclItem *aclItem);
static void SetLocalEnableDependencyCreation(bool state); static void SetLocalEnableMetadataSync(bool state);
static void SetLocalReplicateReferenceTablesOnActivate(bool state); static void SetLocalReplicateReferenceTablesOnActivate(bool state);
static char * GenerateSetRoleQuery(Oid roleOid); static char * GenerateSetRoleQuery(Oid roleOid);
static void MetadataSyncSigTermHandler(SIGNAL_ARGS); static void MetadataSyncSigTermHandler(SIGNAL_ARGS);
@ -417,7 +417,8 @@ ClusterHasKnownMetadataWorkers()
bool bool
ShouldSyncTableMetadata(Oid relationId) ShouldSyncTableMetadata(Oid relationId)
{ {
if (!OidIsValid(relationId) || !IsCitusTable(relationId)) if (!EnableMetadataSync ||
!OidIsValid(relationId) || !IsCitusTable(relationId))
{ {
return false; return false;
} }
@ -950,8 +951,8 @@ citus_internal_add_object_metadata(PG_FUNCTION_ARGS)
argsArray); argsArray);
/* First, disable propagation off to not to cause infinite propagation */ /* First, disable propagation off to not to cause infinite propagation */
bool prevDependencyCreationValue = EnableDependencyCreation; bool prevDependencyCreationValue = EnableMetadataSync;
SetLocalEnableDependencyCreation(false); SetLocalEnableMetadataSync(false);
MarkObjectDistributed(&objectAddress); MarkObjectDistributed(&objectAddress);
@ -978,7 +979,7 @@ citus_internal_add_object_metadata(PG_FUNCTION_ARGS)
forceDelegationAddress); forceDelegationAddress);
} }
SetLocalEnableDependencyCreation(prevDependencyCreationValue); SetLocalEnableMetadataSync(prevDependencyCreationValue);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
@ -1847,12 +1848,12 @@ GetRoleSpecObjectForGrantStmt(Oid roleOid)
/* /*
* SetLocalEnableDependencyCreation sets the enable_object_propagation locally * SetLocalEnableMetadataSync sets the enable_metadata_sync locally
*/ */
static void static void
SetLocalEnableDependencyCreation(bool state) SetLocalEnableMetadataSync(bool state)
{ {
set_config_option("citus.enable_object_propagation", state == true ? "on" : "off", set_config_option("citus.enable_metadata_sync", state == true ? "on" : "off",
(superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION, (superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION,
GUC_ACTION_LOCAL, true, 0, false); GUC_ACTION_LOCAL, true, 0, false);
} }

View File

@ -77,7 +77,7 @@ bool ReplicateReferenceTablesOnActivate = true;
/* did current transaction modify pg_dist_node? */ /* did current transaction modify pg_dist_node? */
bool TransactionModifiedNodeMetadata = false; bool TransactionModifiedNodeMetadata = false;
bool EnableMetadataSyncByDefault = true; bool EnableMetadataSync = true;
typedef struct NodeMetadata typedef struct NodeMetadata
{ {
@ -1095,9 +1095,9 @@ ActivateNode(char *nodeName, int nodePort)
BoolGetDatum(isActive)); BoolGetDatum(isActive));
/* TODO: Once all tests will be enabled for MX, we can remove sync by default check */ /* TODO: Once all tests will be enabled for MX, we can remove sync by default check */
bool syncMetadata = EnableMetadataSyncByDefault && NodeIsPrimary(workerNode); bool syncMetadata = EnableMetadataSync && NodeIsPrimary(workerNode);
if (syncMetadata && EnableDependencyCreation) if (syncMetadata)
{ {
/* /*
* We are going to sync the metadata anyway in this transaction, so do * We are going to sync the metadata anyway in this transaction, so do

View File

@ -556,8 +556,12 @@ BlockWritesToShardList(List *shardList)
Oid firstDistributedTableId = firstShardInterval->relationId; Oid firstDistributedTableId = firstShardInterval->relationId;
bool shouldSyncMetadata = ShouldSyncTableMetadata(firstDistributedTableId); bool shouldSyncMetadata = ShouldSyncTableMetadata(firstDistributedTableId);
if (shouldSyncMetadata) if (shouldSyncMetadata || !IsCoordinator())
{ {
/*
* Even if users disable metadata sync, we cannot allow them not to
* acquire the remote locks. Hence, we have !IsCoordinator() check.
*/
LockShardListMetadataOnWorkers(ExclusiveLock, shardList); LockShardListMetadataOnWorkers(ExclusiveLock, shardList);
} }
} }

View File

@ -911,21 +911,10 @@ RegisterCitusConfigVariables(void)
NULL, NULL, NULL); NULL, NULL, NULL);
DefineCustomBoolVariable( DefineCustomBoolVariable(
"citus.enable_metadata_sync_by_default", "citus.enable_metadata_sync",
gettext_noop("Enables MX in the new nodes by default"), gettext_noop("Enables object and metadata syncing."),
NULL, NULL,
&EnableMetadataSyncByDefault, &EnableMetadataSync,
true,
PGC_USERSET,
GUC_SUPERUSER_ONLY | GUC_NO_SHOW_ALL,
NULL, NULL, NULL);
DefineCustomBoolVariable(
"citus.enable_object_propagation",
gettext_noop("Enables propagating object creation for more complex objects, "
"schema's will always be created"),
NULL,
&EnableDependencyCreation,
true, true,
PGC_USERSET, PGC_USERSET,
GUC_NO_SHOW_ALL, GUC_NO_SHOW_ALL,

View File

@ -32,7 +32,6 @@ typedef enum
} PropSetCmdBehavior; } PropSetCmdBehavior;
extern PropSetCmdBehavior PropagateSetCommands; extern PropSetCmdBehavior PropagateSetCommands;
extern bool EnableDDLPropagation; extern bool EnableDDLPropagation;
extern bool EnableDependencyCreation;
extern bool EnableCreateTypePropagation; extern bool EnableCreateTypePropagation;
extern bool EnableAlterRolePropagation; extern bool EnableAlterRolePropagation;
extern bool EnableAlterRoleSetPropagation; extern bool EnableAlterRoleSetPropagation;

View File

@ -89,8 +89,8 @@ extern Oid GetAttributeTypeOid(Oid relationId, AttrNumber attnum);
#define DISABLE_DDL_PROPAGATION "SET citus.enable_ddl_propagation TO 'off'" #define DISABLE_DDL_PROPAGATION "SET citus.enable_ddl_propagation TO 'off'"
#define ENABLE_DDL_PROPAGATION "SET citus.enable_ddl_propagation TO 'on'" #define ENABLE_DDL_PROPAGATION "SET citus.enable_ddl_propagation TO 'on'"
#define DISABLE_OBJECT_PROPAGATION "SET citus.enable_object_propagation TO 'off'" #define DISABLE_METADATA_SYNC "SET citus.enable_metadata_sync TO 'off'"
#define ENABLE_OBJECT_PROPAGATION "SET citus.enable_object_propagation TO 'on'" #define ENABLE_METADATA_SYNC "SET citus.enable_metadata_sync TO 'on'"
#define WORKER_APPLY_SEQUENCE_COMMAND "SELECT worker_apply_sequence_command (%s,%s)" #define WORKER_APPLY_SEQUENCE_COMMAND "SELECT worker_apply_sequence_command (%s,%s)"
#define UPSERT_PLACEMENT \ #define UPSERT_PLACEMENT \
"INSERT INTO pg_dist_placement " \ "INSERT INTO pg_dist_placement " \
@ -108,6 +108,6 @@ extern Oid GetAttributeTypeOid(Oid relationId, AttrNumber attnum);
/* controlled via GUC */ /* controlled via GUC */
extern char *EnableManualMetadataChangesForUser; extern char *EnableManualMetadataChangesForUser;
extern bool EnableMetadataSyncByDefault; extern bool EnableMetadataSync;
#endif /* METADATA_SYNC_H */ #endif /* METADATA_SYNC_H */

View File

@ -1,5 +1,5 @@
SHOW citus.enable_metadata_sync_by_default; SHOW citus.enable_metadata_sync;
citus.enable_metadata_sync_by_default citus.enable_metadata_sync
--------------------------------------------------------------------- ---------------------------------------------------------------------
on on
(1 row) (1 row)

View File

@ -1,5 +1,5 @@
SET citus.next_shard_id TO 20030000; SET citus.next_shard_id TO 20030000;
SET citus.enable_object_propagation TO false; -- all tests here verify old behaviour without distributing types,functions,etc automatically SET citus.enable_metadata_sync TO false; -- all tests here verify old behaviour without distributing types,functions,etc automatically
CREATE USER typeowner_for_disabled_object_propagation_guc; CREATE USER typeowner_for_disabled_object_propagation_guc;
NOTICE: not propagating CREATE ROLE/USER commands to worker nodes NOTICE: not propagating CREATE ROLE/USER commands to worker nodes
HINT: Connect to worker nodes directly to manually create all necessary users and roles. HINT: Connect to worker nodes directly to manually create all necessary users and roles.
@ -65,7 +65,7 @@ SELECT create_distributed_table('t3', 'a');
-- verify ALTER TYPE statements are not propagated for types, even though they are marked distributed -- verify ALTER TYPE statements are not propagated for types, even though they are marked distributed
BEGIN; BEGIN;
-- object propagation is turned off after xact finished, type is already marked distributed by then -- object propagation is turned off after xact finished, type is already marked distributed by then
SET LOCAL citus.enable_object_propagation TO on; SET LOCAL citus.enable_metadata_sync TO on;
CREATE TYPE tt3 AS (a int, b int); CREATE TYPE tt3 AS (a int, b int);
CREATE TABLE t4 (a int PRIMARY KEY, b tt3); CREATE TABLE t4 (a int PRIMARY KEY, b tt3);
SELECT create_distributed_table('t4','a'); SELECT create_distributed_table('t4','a');
@ -120,7 +120,7 @@ $$);
-- suppress any warnings during cleanup -- suppress any warnings during cleanup
SET client_min_messages TO error; SET client_min_messages TO error;
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
DROP SCHEMA disabled_object_propagation CASCADE; DROP SCHEMA disabled_object_propagation CASCADE;
DROP SCHEMA disabled_object_propagation2 CASCADE; DROP SCHEMA disabled_object_propagation2 CASCADE;
DROP USER typeowner_for_disabled_object_propagation_guc; DROP USER typeowner_for_disabled_object_propagation_guc;

View File

@ -8,6 +8,7 @@ SELECT run_command_on_workers($$CREATE SCHEMA collation_conflict;$$);
\c - - - :worker_1_port \c - - - :worker_1_port
SET search_path TO collation_conflict; SET search_path TO collation_conflict;
SET citus.enable_metadata_sync TO off;
CREATE COLLATION caseinsensitive ( CREATE COLLATION caseinsensitive (
provider = icu, provider = icu,
locale = 'und-u-ks-level2' locale = 'und-u-ks-level2'
@ -45,6 +46,7 @@ SET search_path TO collation_conflict;
DROP TABLE tblcoll; DROP TABLE tblcoll;
DROP COLLATION caseinsensitive; DROP COLLATION caseinsensitive;
\c - - - :worker_1_port \c - - - :worker_1_port
SET citus.enable_metadata_sync TO off;
SET search_path TO collation_conflict; SET search_path TO collation_conflict;
CREATE COLLATION caseinsensitive ( CREATE COLLATION caseinsensitive (
provider = icu, provider = icu,

View File

@ -2,10 +2,10 @@ Parsed test spec with 1 sessions
starting permutation: check_mx starting permutation: check_mx
step check_mx: step check_mx:
SHOW citus.enable_metadata_sync_by_default; SHOW citus.enable_metadata_sync;
SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary'; SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary';
citus.enable_metadata_sync_by_default citus.enable_metadata_sync
--------------------------------------------------------------------- ---------------------------------------------------------------------
on on
(1 row) (1 row)

View File

@ -28,12 +28,19 @@ step s1-grant:
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and bool_and
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin: step s1-begin:
BEGIN; BEGIN;
SET ROLE test_user_1; SET ROLE test_user_1;
@ -65,12 +72,19 @@ step s1-grant:
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and bool_and
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin: step s1-begin:
BEGIN; BEGIN;
SET ROLE test_user_1; SET ROLE test_user_1;
@ -127,12 +141,19 @@ step s1-grant:
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and bool_and
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin: step s1-begin:
BEGIN; BEGIN;
SET ROLE test_user_1; SET ROLE test_user_1;
@ -166,12 +187,19 @@ step s1-grant:
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and bool_and
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin: step s1-begin:
BEGIN; BEGIN;
SET ROLE test_user_1; SET ROLE test_user_1;
@ -231,12 +259,19 @@ step s1-grant:
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and bool_and
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin: step s1-begin:
BEGIN; BEGIN;
SET ROLE test_user_1; SET ROLE test_user_1;
@ -267,12 +302,19 @@ step s1-grant:
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and bool_and
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin: step s1-begin:
BEGIN; BEGIN;
SET ROLE test_user_1; SET ROLE test_user_1;

View File

@ -2,7 +2,7 @@ Parsed test spec with 1 sessions
starting permutation: disable-mx-by-default reload stop-metadata-sync starting permutation: disable-mx-by-default reload stop-metadata-sync
step disable-mx-by-default: step disable-mx-by-default:
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF; ALTER SYSTEM SET citus.enable_metadata_sync TO OFF;
step reload: step reload:
SELECT pg_reload_conf(); SELECT pg_reload_conf();

View File

@ -2,7 +2,7 @@ Parsed test spec with 1 sessions
starting permutation: disable-mx-by-default reload stop-metadata-sync starting permutation: disable-mx-by-default reload stop-metadata-sync
step disable-mx-by-default: step disable-mx-by-default:
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF; ALTER SYSTEM SET citus.enable_metadata_sync TO OFF;
step reload: step reload:
SELECT pg_reload_conf(); SELECT pg_reload_conf();

View File

@ -2,7 +2,7 @@ Parsed test spec with 1 sessions
starting permutation: enable-mx-by-default reload start-metadata-sync starting permutation: enable-mx-by-default reload start-metadata-sync
step enable-mx-by-default: step enable-mx-by-default:
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON; ALTER SYSTEM SET citus.enable_metadata_sync TO ON;
step reload: step reload:
SELECT pg_reload_conf(); SELECT pg_reload_conf();

View File

@ -2,7 +2,7 @@ Parsed test spec with 1 sessions
starting permutation: enable-mx-by-default reload start-metadata-sync starting permutation: enable-mx-by-default reload start-metadata-sync
step enable-mx-by-default: step enable-mx-by-default:
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON; ALTER SYSTEM SET citus.enable_metadata_sync TO ON;
step reload: step reload:
SELECT pg_reload_conf(); SELECT pg_reload_conf();

View File

@ -64,14 +64,14 @@ CREATE FUNCTION add(integer, integer) RETURNS integer
-- Since deparse logic on workers can not work for if function -- Since deparse logic on workers can not work for if function
-- is distributed on workers, we are disabling object propagation -- is distributed on workers, we are disabling object propagation
-- first. Same trick has been applied multiple times in this test. -- first. Same trick has been applied multiple times in this test.
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('add(int,int)'); SELECT create_distributed_function('add(int,int)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION add CALLED ON NULL INPUT ALTER FUNCTION add CALLED ON NULL INPUT
$cmd$); $cmd$);
@ -540,7 +540,7 @@ CREATE FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"() RETURNS TEXT
CREATE FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"(text) RETURNS TEXT CREATE FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"(text) RETURNS TEXT
AS $$ SELECT 'Overloaded function called with param: ' || $1 $$ AS $$ SELECT 'Overloaded function called with param: ' || $1 $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"()'); SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"()');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -553,7 +553,7 @@ SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"(text)');
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"() SET SCHEMA "CiTUS.TEEN2" ALTER FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"() SET SCHEMA "CiTUS.TEEN2"
$cmd$); $cmd$);
@ -581,14 +581,14 @@ CONTEXT: PL/pgSQL function deparse_and_run_on_workers(text) line XX at RAISE
CREATE FUNCTION func_default_param(param INT DEFAULT 0) RETURNS TEXT CREATE FUNCTION func_default_param(param INT DEFAULT 0) RETURNS TEXT
AS $$ SELECT 'supplied param is : ' || param; $$ AS $$ SELECT 'supplied param is : ' || param; $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_default_param(INT)'); SELECT create_distributed_function('func_default_param(INT)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_default_param RENAME TO func_with_default_param; ALTER FUNCTION func_default_param RENAME TO func_with_default_param;
$cmd$); $cmd$);
@ -604,14 +604,14 @@ CONTEXT: PL/pgSQL function deparse_and_run_on_workers(text) line XX at RAISE
CREATE FUNCTION func_out_param(IN param INT, OUT result TEXT) CREATE FUNCTION func_out_param(IN param INT, OUT result TEXT)
AS $$ SELECT 'supplied param is : ' || param; $$ AS $$ SELECT 'supplied param is : ' || param; $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_out_param(INT)'); SELECT create_distributed_function('func_out_param(INT)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_out_param RENAME TO func_in_and_out_param; ALTER FUNCTION func_out_param RENAME TO func_in_and_out_param;
$cmd$); $cmd$);
@ -630,14 +630,14 @@ BEGIN
a := a * a; a := a * a;
END; $$ END; $$
LANGUAGE plpgsql; LANGUAGE plpgsql;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('square(NUMERIC)'); SELECT create_distributed_function('square(NUMERIC)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION square SET search_path TO DEFAULT; ALTER FUNCTION square SET search_path TO DEFAULT;
$cmd$); $cmd$);
@ -663,14 +663,14 @@ BEGIN
FROM generate_subscripts(list, 1) g(i); FROM generate_subscripts(list, 1) g(i);
END; $$ END; $$
LANGUAGE plpgsql; LANGUAGE plpgsql;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('sum_avg(NUMERIC[])'); SELECT create_distributed_function('sum_avg(NUMERIC[])');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION sum_avg COST 10000; ALTER FUNCTION sum_avg COST 10000;
$cmd$); $cmd$);
@ -689,14 +689,14 @@ RESET citus.enable_ddl_propagation;
CREATE FUNCTION func_custom_param(IN param intpair, OUT total INT) CREATE FUNCTION func_custom_param(IN param intpair, OUT total INT)
AS $$ SELECT param.x + param.y $$ AS $$ SELECT param.x + param.y $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_custom_param(intpair)'); SELECT create_distributed_function('func_custom_param(intpair)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_custom_param RENAME TO func_with_custom_param; ALTER FUNCTION func_custom_param RENAME TO func_with_custom_param;
$cmd$); $cmd$);
@ -713,14 +713,14 @@ CREATE FUNCTION func_returns_table(IN count INT)
RETURNS TABLE (x INT, y INT) RETURNS TABLE (x INT, y INT)
AS $$ SELECT i,i FROM generate_series(1,count) i $$ AS $$ SELECT i,i FROM generate_series(1,count) i $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_returns_table(INT)'); SELECT create_distributed_function('func_returns_table(INT)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_returns_table ROWS 100; ALTER FUNCTION func_returns_table ROWS 100;
$cmd$); $cmd$);

View File

@ -49,14 +49,14 @@ BEGIN
RAISE INFO 'information message %', $1; RAISE INFO 'information message %', $1;
END; END;
$proc$; $proc$;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('raise_info(text)'); SELECT create_distributed_function('raise_info(text)');
create_distributed_function create_distributed_function
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER PROCEDURE raise_info CALLED ON NULL INPUT ALTER PROCEDURE raise_info CALLED ON NULL INPUT
$cmd$); $cmd$);

View File

@ -105,7 +105,7 @@ ORDER BY 1, 2;
DROP EXTENSION citus; DROP EXTENSION citus;
\c \c
-- these tests switch between citus versions and call ddl's that require pg_dist_object to be created -- these tests switch between citus versions and call ddl's that require pg_dist_object to be created
SET citus.enable_object_propagation TO 'false'; SET citus.enable_metadata_sync TO 'false';
SET citus.enable_version_checks TO 'false'; SET citus.enable_version_checks TO 'false';
CREATE EXTENSION citus VERSION '8.0-1'; CREATE EXTENSION citus VERSION '8.0-1';
ALTER EXTENSION citus UPDATE TO '8.0-2'; ALTER EXTENSION citus UPDATE TO '8.0-2';
@ -492,7 +492,7 @@ SELECT * FROM multi_extension.print_extension_changes();
-- Test downgrade to 9.4-1 from 9.5-1 -- Test downgrade to 9.4-1 from 9.5-1
ALTER EXTENSION citus UPDATE TO '9.5-1'; ALTER EXTENSION citus UPDATE TO '9.5-1';
BEGIN; BEGIN;
SET citus.enable_object_propagation TO on; SET citus.enable_metadata_sync TO on;
SELECT master_add_node('localhost', :master_port, groupId=>0); SELECT master_add_node('localhost', :master_port, groupId=>0);
NOTICE: localhost:xxxxx is the coordinator and already contains metadata, skipping syncing the metadata NOTICE: localhost:xxxxx is the coordinator and already contains metadata, skipping syncing the metadata
master_add_node master_add_node
@ -508,7 +508,7 @@ NOTICE: create_citus_local_table is deprecated in favour of citus_add_local_tab
(1 row) (1 row)
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
-- downgrade from 9.5-1 to 9.4-1 should fail as we have a citus local table -- downgrade from 9.5-1 to 9.4-1 should fail as we have a citus local table
ALTER EXTENSION citus UPDATE TO '9.4-1'; ALTER EXTENSION citus UPDATE TO '9.4-1';
ERROR: citus local tables are introduced in Citus 9.5 ERROR: citus local tables are introduced in Citus 9.5

View File

@ -186,7 +186,7 @@ BEGIN;
-- it'd spawn a bg worker targeting this node -- it'd spawn a bg worker targeting this node
-- and that changes the connection count specific tests -- and that changes the connection count specific tests
-- here -- here
SET LOCAL citus.enable_metadata_sync_by_default TO OFF; SET LOCAL citus.enable_metadata_sync TO OFF;
-- cannot add workers with specific IP as long as I have a placeholder coordinator record -- cannot add workers with specific IP as long as I have a placeholder coordinator record
SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port); SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port);
ERROR: cannot add a worker node when the coordinator hostname is set to localhost ERROR: cannot add a worker node when the coordinator hostname is set to localhost
@ -198,7 +198,7 @@ BEGIN;
-- it'd spawn a bg worker targeting this node -- it'd spawn a bg worker targeting this node
-- and that changes the connection count specific tests -- and that changes the connection count specific tests
-- here -- here
SET LOCAL citus.enable_metadata_sync_by_default TO OFF; SET LOCAL citus.enable_metadata_sync TO OFF;
-- adding localhost workers is ok -- adding localhost workers is ok
SELECT 1 FROM master_add_node('localhost', :worker_1_port); SELECT 1 FROM master_add_node('localhost', :worker_1_port);
NOTICE: shards are still on the coordinator after adding the new node NOTICE: shards are still on the coordinator after adding the new node
@ -228,7 +228,7 @@ BEGIN;
-- it'd spawn a bg worker targeting this node -- it'd spawn a bg worker targeting this node
-- and that changes the connection count specific tests -- and that changes the connection count specific tests
-- here -- here
SET LOCAL citus.enable_metadata_sync_by_default TO OFF; SET LOCAL citus.enable_metadata_sync TO OFF;
-- adding workers with specific IP is ok now -- adding workers with specific IP is ok now
SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port); SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port);
NOTICE: shards are still on the coordinator after adding the new node NOTICE: shards are still on the coordinator after adding the new node

View File

@ -1,4 +1,4 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF; ALTER SYSTEM SET citus.enable_metadata_sync TO OFF;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
pg_reload_conf pg_reload_conf
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF; ALTER SYSTEM SET citus.enable_metadata_sync TO OFF;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
pg_reload_conf pg_reload_conf
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF; ALTER SYSTEM SET citus.enable_metadata_sync TO OFF;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
pg_reload_conf pg_reload_conf
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON; ALTER SYSTEM SET citus.enable_metadata_sync TO ON;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
pg_reload_conf pg_reload_conf
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON; ALTER SYSTEM SET citus.enable_metadata_sync TO ON;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
pg_reload_conf pg_reload_conf
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON; ALTER SYSTEM SET citus.enable_metadata_sync TO ON;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
pg_reload_conf pg_reload_conf
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -582,7 +582,7 @@ SET session_replication_role = DEFAULT;
-- disable test_user on the first worker -- disable test_user on the first worker
\c - :default_user - :worker_1_port \c - :default_user - :worker_1_port
SET citus.enable_object_propagation TO off; SET citus.enable_metadata_sync TO off;
ALTER USER test_user WITH nologin; ALTER USER test_user WITH nologin;
\c - test_user - :master_port \c - test_user - :master_port
@ -616,7 +616,7 @@ SELECT shardid, shardstate, nodename, nodeport
-- re-enable test_user on the first worker -- re-enable test_user on the first worker
\c - :default_user - :worker_1_port \c - :default_user - :worker_1_port
SET citus.enable_object_propagation TO off; SET citus.enable_metadata_sync TO off;
ALTER USER test_user WITH login; ALTER USER test_user WITH login;
\c - test_user - :master_port \c - test_user - :master_port

View File

@ -89,11 +89,11 @@ test: isolation_ref_update_delete_upsert_vs_all_on_mx
test: isolation_dis2ref_foreign_keys_on_mx test: isolation_dis2ref_foreign_keys_on_mx
test: isolation_metadata_sync_deadlock test: isolation_metadata_sync_deadlock
test: isolation_replicated_dist_on_mx test: isolation_replicated_dist_on_mx
test: isolation_replicate_reference_tables_to_coordinator
test: isolation_multiuser_locking
# MXless tests # MXless tests
test: isolation_check_mx test: isolation_check_mx
test: isolation_replicate_reference_tables_to_coordinator
test: isolation_turn_mx_off test: isolation_turn_mx_off
test: isolation_reference_copy_vs_all test: isolation_reference_copy_vs_all
test: isolation_ref2ref_foreign_keys test: isolation_ref2ref_foreign_keys
test: isolation_multiuser_locking

View File

@ -319,11 +319,8 @@ test: check_mx
test: distributed_functions distributed_functions_conflict test: distributed_functions distributed_functions_conflict
test: distributed_collations test: distributed_collations
test: distributed_procedure test: distributed_procedure
# blocked on #5583
test: turn_mx_off
test: distributed_collations_conflict test: distributed_collations_conflict
test: turn_mx_on test: check_mx
# --------- # ---------
# deparsing logic tests # deparsing logic tests

View File

@ -745,7 +745,7 @@ UPDATE pg_dist_shard_placement SET nodeport = :worker_1_port+10 WHERE shardid =
SET session_replication_role = DEFAULT; SET session_replication_role = DEFAULT;
-- disable test_user on the first worker -- disable test_user on the first worker
\c - :default_user - :worker_1_port \c - :default_user - :worker_1_port
SET citus.enable_object_propagation TO off; SET citus.enable_metadata_sync TO off;
ALTER USER test_user WITH nologin; ALTER USER test_user WITH nologin;
\c - test_user - :master_port \c - test_user - :master_port
-- reissue copy, and it should fail -- reissue copy, and it should fail
@ -804,7 +804,7 @@ SELECT shardid, shardstate, nodename, nodeport
-- re-enable test_user on the first worker -- re-enable test_user on the first worker
\c - :default_user - :worker_1_port \c - :default_user - :worker_1_port
SET citus.enable_object_propagation TO off; SET citus.enable_metadata_sync TO off;
ALTER USER test_user WITH login; ALTER USER test_user WITH login;
\c - test_user - :master_port \c - test_user - :master_port
DROP TABLE numbers_hash; DROP TABLE numbers_hash;

View File

@ -2,7 +2,7 @@ session "s1"
step "check_mx" step "check_mx"
{ {
SHOW citus.enable_metadata_sync_by_default; SHOW citus.enable_metadata_sync;
SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary'; SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary';
} }

View File

@ -1,5 +1,8 @@
setup setup
{ {
SELECT citus_internal.replace_isolation_tester_func();
SELECT citus_internal.refresh_isolation_tester_prepared_statement();
SET citus.shard_replication_factor TO 1; SET citus.shard_replication_factor TO 1;
CREATE USER test_user_1; CREATE USER test_user_1;
@ -16,6 +19,8 @@ setup
teardown teardown
{ {
SELECT citus_internal.restore_isolation_tester_func();
BEGIN; BEGIN;
DROP TABLE IF EXISTS test_table; DROP TABLE IF EXISTS test_table;
DROP USER test_user_1, test_user_2; DROP USER test_user_1, test_user_2;
@ -31,6 +36,7 @@ step "s1-grant"
SET ROLE test_user_1; SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2'); SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2; GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
} }
step "s1-begin" step "s1-begin"

View File

@ -2,7 +2,7 @@ session "s1"
step "disable-mx-by-default" step "disable-mx-by-default"
{ {
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF; ALTER SYSTEM SET citus.enable_metadata_sync TO OFF;
} }
step "reload" step "reload"

View File

@ -2,7 +2,7 @@ session "s1"
step "enable-mx-by-default" step "enable-mx-by-default"
{ {
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON; ALTER SYSTEM SET citus.enable_metadata_sync TO ON;
} }
step "reload" step "reload"

View File

@ -1,3 +1,3 @@
SHOW citus.enable_metadata_sync_by_default; SHOW citus.enable_metadata_sync;
SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary'; SELECT bool_and(metadatasynced) FROM pg_dist_node WHERE noderole = 'primary';

View File

@ -1,5 +1,5 @@
SET citus.next_shard_id TO 20030000; SET citus.next_shard_id TO 20030000;
SET citus.enable_object_propagation TO false; -- all tests here verify old behaviour without distributing types,functions,etc automatically SET citus.enable_metadata_sync TO false; -- all tests here verify old behaviour without distributing types,functions,etc automatically
CREATE USER typeowner_for_disabled_object_propagation_guc; CREATE USER typeowner_for_disabled_object_propagation_guc;
CREATE SCHEMA disabled_object_propagation; CREATE SCHEMA disabled_object_propagation;
@ -37,7 +37,7 @@ SELECT create_distributed_table('t3', 'a');
-- verify ALTER TYPE statements are not propagated for types, even though they are marked distributed -- verify ALTER TYPE statements are not propagated for types, even though they are marked distributed
BEGIN; BEGIN;
-- object propagation is turned off after xact finished, type is already marked distributed by then -- object propagation is turned off after xact finished, type is already marked distributed by then
SET LOCAL citus.enable_object_propagation TO on; SET LOCAL citus.enable_metadata_sync TO on;
CREATE TYPE tt3 AS (a int, b int); CREATE TYPE tt3 AS (a int, b int);
CREATE TABLE t4 (a int PRIMARY KEY, b tt3); CREATE TABLE t4 (a int PRIMARY KEY, b tt3);
SELECT create_distributed_table('t4','a'); SELECT create_distributed_table('t4','a');
@ -75,7 +75,7 @@ $$);
-- suppress any warnings during cleanup -- suppress any warnings during cleanup
SET client_min_messages TO error; SET client_min_messages TO error;
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
DROP SCHEMA disabled_object_propagation CASCADE; DROP SCHEMA disabled_object_propagation CASCADE;
DROP SCHEMA disabled_object_propagation2 CASCADE; DROP SCHEMA disabled_object_propagation2 CASCADE;
DROP USER typeowner_for_disabled_object_propagation_guc; DROP USER typeowner_for_disabled_object_propagation_guc;

View File

@ -4,6 +4,8 @@ SELECT run_command_on_workers($$CREATE SCHEMA collation_conflict;$$);
\c - - - :worker_1_port \c - - - :worker_1_port
SET search_path TO collation_conflict; SET search_path TO collation_conflict;
SET citus.enable_metadata_sync TO off;
CREATE COLLATION caseinsensitive ( CREATE COLLATION caseinsensitive (
provider = icu, provider = icu,
locale = 'und-u-ks-level2' locale = 'und-u-ks-level2'
@ -36,6 +38,8 @@ DROP TABLE tblcoll;
DROP COLLATION caseinsensitive; DROP COLLATION caseinsensitive;
\c - - - :worker_1_port \c - - - :worker_1_port
SET citus.enable_metadata_sync TO off;
SET search_path TO collation_conflict; SET search_path TO collation_conflict;
CREATE COLLATION caseinsensitive ( CREATE COLLATION caseinsensitive (

View File

@ -70,9 +70,9 @@ CREATE FUNCTION add(integer, integer) RETURNS integer
-- Since deparse logic on workers can not work for if function -- Since deparse logic on workers can not work for if function
-- is distributed on workers, we are disabling object propagation -- is distributed on workers, we are disabling object propagation
-- first. Same trick has been applied multiple times in this test. -- first. Same trick has been applied multiple times in this test.
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('add(int,int)'); SELECT create_distributed_function('add(int,int)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION add CALLED ON NULL INPUT ALTER FUNCTION add CALLED ON NULL INPUT
@ -276,10 +276,10 @@ CREATE FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"(text) RETURNS TEXT
AS $$ SELECT 'Overloaded function called with param: ' || $1 $$ AS $$ SELECT 'Overloaded function called with param: ' || $1 $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"()'); SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"()');
SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"(text)'); SELECT create_distributed_function('"CiTuS.TeeN"."TeeNFunCT10N.1!?!"(text)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"() SET SCHEMA "CiTUS.TEEN2" ALTER FUNCTION "CiTuS.TeeN"."TeeNFunCT10N.1!?!"() SET SCHEMA "CiTUS.TEEN2"
@ -294,9 +294,9 @@ $cmd$);
CREATE FUNCTION func_default_param(param INT DEFAULT 0) RETURNS TEXT CREATE FUNCTION func_default_param(param INT DEFAULT 0) RETURNS TEXT
AS $$ SELECT 'supplied param is : ' || param; $$ AS $$ SELECT 'supplied param is : ' || param; $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_default_param(INT)'); SELECT create_distributed_function('func_default_param(INT)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_default_param RENAME TO func_with_default_param; ALTER FUNCTION func_default_param RENAME TO func_with_default_param;
@ -306,9 +306,9 @@ $cmd$);
CREATE FUNCTION func_out_param(IN param INT, OUT result TEXT) CREATE FUNCTION func_out_param(IN param INT, OUT result TEXT)
AS $$ SELECT 'supplied param is : ' || param; $$ AS $$ SELECT 'supplied param is : ' || param; $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_out_param(INT)'); SELECT create_distributed_function('func_out_param(INT)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_out_param RENAME TO func_in_and_out_param; ALTER FUNCTION func_out_param RENAME TO func_in_and_out_param;
@ -321,9 +321,9 @@ BEGIN
a := a * a; a := a * a;
END; $$ END; $$
LANGUAGE plpgsql; LANGUAGE plpgsql;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('square(NUMERIC)'); SELECT create_distributed_function('square(NUMERIC)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION square SET search_path TO DEFAULT; ALTER FUNCTION square SET search_path TO DEFAULT;
@ -343,9 +343,9 @@ BEGIN
FROM generate_subscripts(list, 1) g(i); FROM generate_subscripts(list, 1) g(i);
END; $$ END; $$
LANGUAGE plpgsql; LANGUAGE plpgsql;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('sum_avg(NUMERIC[])'); SELECT create_distributed_function('sum_avg(NUMERIC[])');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION sum_avg COST 10000; ALTER FUNCTION sum_avg COST 10000;
@ -358,9 +358,9 @@ RESET citus.enable_ddl_propagation;
CREATE FUNCTION func_custom_param(IN param intpair, OUT total INT) CREATE FUNCTION func_custom_param(IN param intpair, OUT total INT)
AS $$ SELECT param.x + param.y $$ AS $$ SELECT param.x + param.y $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_custom_param(intpair)'); SELECT create_distributed_function('func_custom_param(intpair)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_custom_param RENAME TO func_with_custom_param; ALTER FUNCTION func_custom_param RENAME TO func_with_custom_param;
@ -372,9 +372,9 @@ CREATE FUNCTION func_returns_table(IN count INT)
RETURNS TABLE (x INT, y INT) RETURNS TABLE (x INT, y INT)
AS $$ SELECT i,i FROM generate_series(1,count) i $$ AS $$ SELECT i,i FROM generate_series(1,count) i $$
LANGUAGE SQL; LANGUAGE SQL;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('func_returns_table(INT)'); SELECT create_distributed_function('func_returns_table(INT)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER FUNCTION func_returns_table ROWS 100; ALTER FUNCTION func_returns_table ROWS 100;

View File

@ -56,9 +56,9 @@ BEGIN
RAISE INFO 'information message %', $1; RAISE INFO 'information message %', $1;
END; END;
$proc$; $proc$;
SET citus.enable_object_propagation TO OFF; SET citus.enable_metadata_sync TO OFF;
SELECT create_distributed_function('raise_info(text)'); SELECT create_distributed_function('raise_info(text)');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
SELECT deparse_and_run_on_workers($cmd$ SELECT deparse_and_run_on_workers($cmd$
ALTER PROCEDURE raise_info CALLED ON NULL INPUT ALTER PROCEDURE raise_info CALLED ON NULL INPUT

View File

@ -101,7 +101,7 @@ DROP EXTENSION citus;
\c \c
-- these tests switch between citus versions and call ddl's that require pg_dist_object to be created -- these tests switch between citus versions and call ddl's that require pg_dist_object to be created
SET citus.enable_object_propagation TO 'false'; SET citus.enable_metadata_sync TO 'false';
SET citus.enable_version_checks TO 'false'; SET citus.enable_version_checks TO 'false';
@ -212,11 +212,11 @@ SELECT * FROM multi_extension.print_extension_changes();
ALTER EXTENSION citus UPDATE TO '9.5-1'; ALTER EXTENSION citus UPDATE TO '9.5-1';
BEGIN; BEGIN;
SET citus.enable_object_propagation TO on; SET citus.enable_metadata_sync TO on;
SELECT master_add_node('localhost', :master_port, groupId=>0); SELECT master_add_node('localhost', :master_port, groupId=>0);
CREATE TABLE citus_local_table (a int); CREATE TABLE citus_local_table (a int);
SELECT create_citus_local_table('citus_local_table'); SELECT create_citus_local_table('citus_local_table');
RESET citus.enable_object_propagation; RESET citus.enable_metadata_sync;
-- downgrade from 9.5-1 to 9.4-1 should fail as we have a citus local table -- downgrade from 9.5-1 to 9.4-1 should fail as we have a citus local table
ALTER EXTENSION citus UPDATE TO '9.4-1'; ALTER EXTENSION citus UPDATE TO '9.4-1';

View File

@ -101,7 +101,7 @@ BEGIN;
-- it'd spawn a bg worker targeting this node -- it'd spawn a bg worker targeting this node
-- and that changes the connection count specific tests -- and that changes the connection count specific tests
-- here -- here
SET LOCAL citus.enable_metadata_sync_by_default TO OFF; SET LOCAL citus.enable_metadata_sync TO OFF;
-- cannot add workers with specific IP as long as I have a placeholder coordinator record -- cannot add workers with specific IP as long as I have a placeholder coordinator record
SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port); SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port);
COMMIT; COMMIT;
@ -111,7 +111,7 @@ BEGIN;
-- it'd spawn a bg worker targeting this node -- it'd spawn a bg worker targeting this node
-- and that changes the connection count specific tests -- and that changes the connection count specific tests
-- here -- here
SET LOCAL citus.enable_metadata_sync_by_default TO OFF; SET LOCAL citus.enable_metadata_sync TO OFF;
-- adding localhost workers is ok -- adding localhost workers is ok
SELECT 1 FROM master_add_node('localhost', :worker_1_port); SELECT 1 FROM master_add_node('localhost', :worker_1_port);
COMMIT; COMMIT;
@ -127,7 +127,7 @@ BEGIN;
-- it'd spawn a bg worker targeting this node -- it'd spawn a bg worker targeting this node
-- and that changes the connection count specific tests -- and that changes the connection count specific tests
-- here -- here
SET LOCAL citus.enable_metadata_sync_by_default TO OFF; SET LOCAL citus.enable_metadata_sync TO OFF;
-- adding workers with specific IP is ok now -- adding workers with specific IP is ok now
SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port); SELECT 1 FROM master_add_node('127.0.0.1', :worker_1_port);
COMMIT; COMMIT;

View File

@ -1,5 +0,0 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO OFF;
SELECT pg_reload_conf();
SET client_min_messages TO ERROR;
SELECT stop_metadata_sync_to_node(nodename, nodeport) FROM pg_dist_node WHERE isactive = 't' and noderole = 'primary';

View File

@ -1,6 +0,0 @@
ALTER SYSTEM SET citus.enable_metadata_sync_by_default TO ON;
SELECT pg_reload_conf();
SELECT pg_sleep(0.1);
SET client_min_messages TO ERROR;
SELECT start_metadata_sync_to_node(nodename, nodeport) FROM pg_dist_node WHERE isactive = 't' and noderole = 'primary';