mirror of https://github.com/citusdata/citus.git
Use coordinator instead of schema node in terminology
parent
72725ba30c
commit
ba940a1de9
|
@ -106,7 +106,7 @@ master_create_distributed_table(PG_FUNCTION_ARGS)
|
|||
char *distributionColumnName = text_to_cstring(distributionColumnText);
|
||||
char distributionMethod = LookupDistributionMethod(distributionMethodOid);
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
ConvertToDistributedTable(distributedRelationId, distributionColumnName,
|
||||
distributionMethod, INVALID_COLOCATION_ID);
|
||||
|
@ -132,7 +132,7 @@ create_distributed_table(PG_FUNCTION_ARGS)
|
|||
text *colocateWithTableNameText = NULL;
|
||||
char *colocateWithTableName = NULL;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
/* guard against a binary update without a function update */
|
||||
if (PG_NARGS() >= 4)
|
||||
|
@ -213,7 +213,7 @@ CreateReferenceTable(Oid relationId)
|
|||
int replicationFactor = list_length(workerNodeList);
|
||||
char *distributionColumnName = NULL;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
/* if there are no workers, error out */
|
||||
if (replicationFactor == 0)
|
||||
|
|
|
@ -38,7 +38,7 @@ master_drop_distributed_table_metadata(PG_FUNCTION_ARGS)
|
|||
char *schemaName = text_to_cstring(schemaNameText);
|
||||
char *tableName = text_to_cstring(tableNameText);
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
CheckTableSchemaNameForDrop(relationId, &schemaName, &tableName);
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
|||
/* we don't support copy to reference tables from workers */
|
||||
if (partitionMethod == DISTRIBUTE_BY_NONE)
|
||||
{
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
}
|
||||
|
||||
/* load the list of shards and verify that we have shards to copy into */
|
||||
|
|
|
@ -170,7 +170,7 @@ multi_ProcessUtility(Node *parsetree,
|
|||
DestReceiver *dest,
|
||||
char *completionTag)
|
||||
{
|
||||
bool schemaNode = SchemaNode();
|
||||
bool isCoordinator = IsCoordinator();
|
||||
bool commandMustRunAsOwner = false;
|
||||
Oid savedUserId = InvalidOid;
|
||||
int savedSecurityContext = 0;
|
||||
|
@ -228,7 +228,7 @@ multi_ProcessUtility(Node *parsetree,
|
|||
|
||||
/*
|
||||
* DDL commands are propagated to workers only if EnableDDLPropagation is
|
||||
* set to true and the current node is the schema node
|
||||
* set to true and the current node is the coordinator
|
||||
*/
|
||||
if (EnableDDLPropagation)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ multi_ProcessUtility(Node *parsetree,
|
|||
"move all tables.")));
|
||||
}
|
||||
}
|
||||
else if (!schemaNode)
|
||||
else if (!isCoordinator)
|
||||
{
|
||||
if (IsA(parsetree, AlterTableStmt))
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ multi_ProcessUtility(Node *parsetree,
|
|||
if (alterTableStmt->relkind == OBJECT_TABLE)
|
||||
{
|
||||
/*
|
||||
* When the schema node issues an ALTER TABLE ... ADD FOREIGN KEY
|
||||
* When the coordinator issues an ALTER TABLE ... ADD FOREIGN KEY
|
||||
* command, the validation step should be skipped on the distributed
|
||||
* table of the worker. Therefore, we check whether the given ALTER
|
||||
* TABLE statement is a FOREIGN KEY constraint and if so disable the
|
||||
|
@ -1975,7 +1975,7 @@ ExecuteDistributedDDLCommand(Oid relationId, const char *ddlCommandString,
|
|||
"modifications")));
|
||||
}
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
ShowNoticeIfNotUsing2PC();
|
||||
|
||||
if (shouldSyncMetadata)
|
||||
|
@ -2017,7 +2017,7 @@ ExecuteDistributedForeignKeyCommand(Oid leftRelationId, Oid rightRelationId,
|
|||
"modifications")));
|
||||
}
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
ShowNoticeIfNotUsing2PC();
|
||||
|
||||
/*
|
||||
|
|
|
@ -67,7 +67,7 @@ master_create_worker_shards(PG_FUNCTION_ARGS)
|
|||
|
||||
Oid distributedTableId = ResolveRelationId(tableNameText);
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
CreateShardsWithRoundRobinPolicy(distributedTableId, shardCount, replicationFactor);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ master_apply_delete_command(PG_FUNCTION_ARGS)
|
|||
char partitionMethod = 0;
|
||||
bool failOK = false;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
queryTreeNode = ParseTreeNode(queryString);
|
||||
if (!IsA(queryTreeNode, DeleteStmt))
|
||||
|
@ -208,7 +208,7 @@ master_drop_all_shards(PG_FUNCTION_ARGS)
|
|||
char *schemaName = text_to_cstring(schemaNameText);
|
||||
char *relationName = text_to_cstring(relationNameText);
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
CheckTableSchemaNameForDrop(relationId, &schemaName, &relationName);
|
||||
|
||||
|
@ -242,7 +242,7 @@ master_drop_sequences(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
/* iterate over sequence names to build single command to DROP them all */
|
||||
sequenceIterator = array_create_iterator(sequenceNamesArray, 0, NULL);
|
||||
|
|
|
@ -86,7 +86,7 @@ master_modify_multiple_shards(PG_FUNCTION_ARGS)
|
|||
List *taskList = NIL;
|
||||
int32 affectedTupleCount = 0;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
queryTreeNode = ParseTreeNode(queryString);
|
||||
if (IsA(queryTreeNode, DeleteStmt))
|
||||
|
|
|
@ -264,7 +264,7 @@ master_get_new_shardid(PG_FUNCTION_ARGS)
|
|||
uint64 shardId = 0;
|
||||
Datum shardIdDatum = 0;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
shardId = GetNextShardId();
|
||||
shardIdDatum = Int64GetDatum(shardId);
|
||||
|
@ -321,7 +321,7 @@ master_get_new_placementid(PG_FUNCTION_ARGS)
|
|||
uint64 placementId = 0;
|
||||
Datum placementIdDatum = 0;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
placementId = GetNextPlacementId();
|
||||
placementIdDatum = Int64GetDatum(placementId);
|
||||
|
@ -876,11 +876,11 @@ ShardStorageType(Oid relationId)
|
|||
|
||||
|
||||
/*
|
||||
* SchemaNode function returns true if this node is identified as the
|
||||
* IsCoordinator function returns true if this node is identified as the
|
||||
* schema/coordinator/master node of the cluster.
|
||||
*/
|
||||
bool
|
||||
SchemaNode(void)
|
||||
IsCoordinator(void)
|
||||
{
|
||||
return (GetLocalGroupId() == 0);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ master_copy_shard_placement(PG_FUNCTION_ARGS)
|
|||
"is only supported on Citus Enterprise")));
|
||||
}
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
/* RepairShardPlacement function repairs only given shard */
|
||||
RepairShardPlacement(shardId, sourceNodeName, sourceNodePort, targetNodeName,
|
||||
|
|
|
@ -83,7 +83,7 @@ start_metadata_sync_to_node(PG_FUNCTION_ARGS)
|
|||
List *dropMetadataCommandList = NIL;
|
||||
List *createMetadataCommandList = NIL;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
EnsureSuperUser();
|
||||
|
||||
PreventTransactionChain(true, "start_metadata_sync_to_node");
|
||||
|
@ -142,7 +142,7 @@ stop_metadata_sync_to_node(PG_FUNCTION_ARGS)
|
|||
char *nodeNameString = text_to_cstring(nodeName);
|
||||
WorkerNode *workerNode = NULL;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
EnsureSuperUser();
|
||||
|
||||
workerNode = FindWorkerNode(nodeNameString, nodePort);
|
||||
|
|
|
@ -669,7 +669,7 @@ InsertSelectQuerySupported(Query *queryTree, RangeTblEntry *insertRte,
|
|||
/* we only do this check for INSERT ... SELECT queries */
|
||||
AssertArg(InsertSelectQuery(queryTree));
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
/* we do not expect to see a view in modify target */
|
||||
foreach(rangeTableCell, queryTree->rtable)
|
||||
|
@ -1196,7 +1196,7 @@ ModifyQuerySupported(Query *queryTree)
|
|||
Oid distributedTableId = ExtractFirstDistributedTableId(queryTree);
|
||||
uint32 rangeTableId = 1;
|
||||
Var *partitionColumn = PartitionColumn(distributedTableId, rangeTableId);
|
||||
bool schemaNode = SchemaNode();
|
||||
bool isCoordinator = IsCoordinator();
|
||||
List *rangeTableList = NIL;
|
||||
ListCell *rangeTableCell = NULL;
|
||||
bool hasValuesScan = false;
|
||||
|
@ -1254,13 +1254,13 @@ ModifyQuerySupported(Query *queryTree)
|
|||
referenceTable = true;
|
||||
}
|
||||
|
||||
if (referenceTable && !schemaNode)
|
||||
if (referenceTable && !isCoordinator)
|
||||
{
|
||||
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
||||
"cannot perform distributed planning for the given"
|
||||
" modification",
|
||||
"Modifications to reference tables are "
|
||||
"supported only from the schema node.",
|
||||
"supported only from the coordinator.",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ mark_tables_colocated(PG_FUNCTION_ARGS)
|
|||
"operation")));
|
||||
}
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
relationIdDatumArray = DeconstructArrayObject(relationIdArrayObject);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ static bool workerNodeHashValid = false;
|
|||
|
||||
static bool invalidationRegistered = false;
|
||||
|
||||
/* default value is -1, for schema node it's 0 and for worker nodes > 0 */
|
||||
/* default value is -1, for coordinator it's 0 and for worker nodes > 0 */
|
||||
static int LocalGroupId = -1;
|
||||
|
||||
/* built first time through in InitializePartitionCache */
|
||||
|
|
|
@ -345,7 +345,7 @@ RemoveNodeFromCluster(char *nodeName, int32 nodePort, bool forceRemove)
|
|||
List *referenceTableList = NIL;
|
||||
uint32 deletedNodeId = INVALID_PLACEMENT_ID;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
EnsureSuperUser();
|
||||
|
||||
workerNode = FindWorkerNode(nodeName, nodePort);
|
||||
|
@ -424,7 +424,7 @@ AddNodeMetadata(char *nodeName, int32 nodePort, int32 groupId, char *nodeRack,
|
|||
char *nodeInsertCommand = NULL;
|
||||
List *workerNodeList = NIL;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
EnsureSuperUser();
|
||||
|
||||
*nodeAlreadyExists = false;
|
||||
|
@ -628,18 +628,18 @@ GetNextNodeId()
|
|||
|
||||
|
||||
/*
|
||||
* EnsureSchemaNode checks if the current node is the schema node. If it does not,
|
||||
* EnsureCoordinator checks if the current node is the coordinator. If it does not,
|
||||
* the function errors out.
|
||||
*/
|
||||
void
|
||||
EnsureSchemaNode(void)
|
||||
EnsureCoordinator(void)
|
||||
{
|
||||
int localGroupId = GetLocalGroupId();
|
||||
|
||||
if (localGroupId != 0)
|
||||
{
|
||||
ereport(ERROR, (errmsg("operation is not allowed on this node"),
|
||||
errhint("Connect to the schema node and run it again.")));
|
||||
errhint("Connect to the coordinator and run it again.")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ upgrade_to_reference_table(PG_FUNCTION_ARGS)
|
|||
uint64 shardId = INVALID_SHARD_ID;
|
||||
DistTableCacheEntry *tableEntry = NULL;
|
||||
|
||||
EnsureSchemaNode();
|
||||
EnsureCoordinator();
|
||||
|
||||
if (!IsDistributedTable(relationId))
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ extern int ShardMaxSize;
|
|||
extern int ShardPlacementPolicy;
|
||||
|
||||
|
||||
extern bool SchemaNode(void);
|
||||
extern bool IsCoordinator(void);
|
||||
|
||||
/* Function declarations local to the distributed module */
|
||||
extern bool CStoreTable(Oid relationId);
|
||||
|
|
|
@ -62,7 +62,7 @@ extern uint32 WorkerGetLiveNodeCount(void);
|
|||
extern List * WorkerNodeList(void);
|
||||
extern WorkerNode * FindWorkerNode(char *nodeName, int32 nodePort);
|
||||
extern List * ReadWorkerNodes(void);
|
||||
extern void EnsureSchemaNode(void);
|
||||
extern void EnsureCoordinator(void);
|
||||
|
||||
/* Function declarations for worker node utilities */
|
||||
extern int CompareWorkerNodes(const void *leftElement, const void *rightElement);
|
||||
|
|
|
@ -30,7 +30,7 @@ SELECT master_modify_multiple_shards('UPDATE mx_ddl_table SET version=0.1 WHERE
|
|||
|
||||
-- SET NOT NULL
|
||||
ALTER TABLE mx_ddl_table ALTER COLUMN version SET NOT NULL;
|
||||
-- See that the changes are applied on schema node, worker tables and shards
|
||||
-- See that the changes are applied on coordinator, worker tables and shards
|
||||
\d mx_ddl_table
|
||||
Table "public.mx_ddl_table"
|
||||
Column | Type | Modifiers
|
||||
|
@ -70,7 +70,7 @@ Indexes:
|
|||
\d mx_ddl_table_1600001
|
||||
INSERT INTO mx_ddl_table VALUES (37, 78, 2);
|
||||
INSERT INTO mx_ddl_table VALUES (38, 78);
|
||||
-- Switch to the schema node
|
||||
-- Switch to the coordinator
|
||||
\c - - - :master_port
|
||||
-- SET DATA TYPE
|
||||
ALTER TABLE mx_ddl_table ALTER COLUMN version SET DATA TYPE double precision;
|
||||
|
@ -94,7 +94,7 @@ SELECT * FROM mx_ddl_table ORDER BY key;
|
|||
78 | 83 | 2.1
|
||||
(11 rows)
|
||||
|
||||
-- Switch to the schema node
|
||||
-- Switch to the coordinator
|
||||
\c - - - :master_port
|
||||
-- DROP INDEX
|
||||
DROP INDEX ddl_test_index;
|
||||
|
@ -106,7 +106,7 @@ ALTER TABLE mx_ddl_table ALTER COLUMN version DROP DEFAULT;
|
|||
ALTER TABLE mx_ddl_table ALTER COLUMN version DROP NOT NULL;
|
||||
-- DROP COLUMN
|
||||
ALTER TABLE mx_ddl_table DROP COLUMN version;
|
||||
-- See that the changes are applied on schema node, worker tables and shards
|
||||
-- See that the changes are applied on coordinator, worker tables and shards
|
||||
\d mx_ddl_table
|
||||
Table "public.mx_ddl_table"
|
||||
Column | Type | Modifiers
|
||||
|
|
|
@ -187,7 +187,7 @@ SELECT create_distributed_table('objects_for_xacts2', 'id');
|
|||
(1 row)
|
||||
|
||||
ROLLBACK;
|
||||
-- show that the table not exists on the schema node
|
||||
-- show that the table not exists on the coordinator
|
||||
SELECT count(*) FROM pg_tables WHERE tablename = 'objects_for_xacts2' and schemaname = 'citus_mx_schema_for_xacts';
|
||||
count
|
||||
-------
|
||||
|
@ -212,7 +212,7 @@ SELECT count(*) FROM pg_tables WHERE tablename LIKE 'objects_for_xacts2_%' and s
|
|||
-- make sure that master_drop_all_shards does not work from the worker nodes
|
||||
SELECT master_drop_all_shards('citus_mx_schema_for_xacts.objects_for_xacts'::regclass, 'citus_mx_schema_for_xacts', 'objects_for_xacts');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
-- Ensure pg_dist_transaction is empty for test
|
||||
SELECT recover_prepared_transactions();
|
||||
recover_prepared_transactions
|
||||
|
|
|
@ -113,7 +113,7 @@ DETAIL: Multi-row INSERTs to distributed tables are not supported.
|
|||
-- INSERT ... SELECT ... FROM commands are unsupported from workers
|
||||
INSERT INTO limit_orders_mx SELECT * FROM limit_orders_mx;
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
-- connect back to the other node
|
||||
\c - - - :worker_1_port
|
||||
-- commands containing a CTE are unsupported
|
||||
|
@ -278,7 +278,7 @@ UPDATE limit_orders_mx SET symbol = UPPER(symbol) WHERE id = 246 RETURNING id, L
|
|||
246 | gm | GM
|
||||
(1 row)
|
||||
|
||||
-- connect schema node to run the DDL
|
||||
-- connect coordinator to run the DDL
|
||||
\c - - - :master_port
|
||||
ALTER TABLE limit_orders_mx ADD COLUMN array_of_values integer[];
|
||||
NOTICE: using one-phase commit for distributed DDL commands
|
||||
|
@ -320,7 +320,7 @@ SELECT array_of_values FROM limit_orders_mx WHERE id = 246;
|
|||
{1,2}
|
||||
(1 row)
|
||||
|
||||
-- connect schema node to run the DDL
|
||||
-- connect coordinator to run the DDL
|
||||
\c - - - :master_port
|
||||
ALTER TABLE limit_orders_mx DROP array_of_values;
|
||||
NOTICE: using one-phase commit for distributed DDL commands
|
||||
|
|
|
@ -8,7 +8,7 @@ INSERT INTO researchers_mx VALUES (1, 1, 'Donald Knuth');
|
|||
INSERT INTO researchers_mx VALUES (2, 1, 'Niklaus Wirth');
|
||||
INSERT INTO researchers_mx VALUES (3, 2, 'Tony Hoare');
|
||||
INSERT INTO researchers_mx VALUES (4, 2, 'Kenneth Iverson');
|
||||
-- replace a researcher, reusing their id on the schema node
|
||||
-- replace a researcher, reusing their id on the coordinator
|
||||
BEGIN;
|
||||
DELETE FROM researchers_mx WHERE lab_id = 1 AND id = 2;
|
||||
INSERT INTO researchers_mx VALUES (2, 1, 'John Backus');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1310000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1310000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1290000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1290000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1280000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1280000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1270000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1270000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- coming from postgresql.conf or multi_task_tracker_executor.conf.
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1260000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1260000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
SELECT
|
||||
l_orderkey,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1250000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1250000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1230000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1230000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem AND orders tables as large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1240000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1240000;
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
-- Change configuration to treat lineitem AND orders tables AS large
|
||||
SET citus.large_table_shard_count TO 2;
|
||||
|
@ -121,7 +121,7 @@ ORDER BY
|
|||
GERMANY | FRANCE | 1995 | 2399.2948
|
||||
(1 row)
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :worker_2_port
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1240000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1240000;
|
||||
|
|
|
@ -73,15 +73,15 @@ CREATE TABLE mx_table_worker(col_1 text);
|
|||
-- master_create_distributed_table
|
||||
SELECT master_create_distributed_table('mx_table_worker', 'col_1', 'hash');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
-- create_distributed_table
|
||||
SELECT create_distributed_table('mx_table_worker', 'col_1');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
-- create_reference_table
|
||||
SELECT create_reference_table('mx_table_worker');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM pg_dist_partition WHERE logicalrelid='mx_table_worker'::regclass;
|
||||
count
|
||||
-------
|
||||
|
@ -95,7 +95,7 @@ SELECT * FROM pg_dist_shard WHERE logicalrelid = 'mx_table'::regclass;
|
|||
DELETE FROM pg_dist_shard WHERE logicalrelid = 'mx_table'::regclass;
|
||||
SELECT master_create_worker_shards('mx_table', 5, 1);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='mx_table'::regclass;
|
||||
count
|
||||
-------
|
||||
|
@ -120,16 +120,16 @@ SELECT * FROM mx_ref_table ORDER BY col_1;
|
|||
|
||||
INSERT INTO mx_ref_table (col_1, col_2) VALUES (-6, 'vestibulum');
|
||||
ERROR: cannot perform distributed planning for the given modification
|
||||
DETAIL: Modifications to reference tables are supported only from the schema node.
|
||||
DETAIL: Modifications to reference tables are supported only from the coordinator.
|
||||
UPDATE mx_ref_table SET col_2 = 'habitant' WHERE col_1 = -37;
|
||||
ERROR: cannot perform distributed planning for the given modification
|
||||
DETAIL: Modifications to reference tables are supported only from the schema node.
|
||||
DETAIL: Modifications to reference tables are supported only from the coordinator.
|
||||
DELETE FROM mx_ref_table WHERE col_1 = -78;
|
||||
ERROR: cannot perform distributed planning for the given modification
|
||||
DETAIL: Modifications to reference tables are supported only from the schema node.
|
||||
DETAIL: Modifications to reference tables are supported only from the coordinator.
|
||||
COPY mx_ref_table (col_1, col_2) FROM STDIN WITH (FORMAT 'csv');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT * FROM mx_ref_table ORDER BY col_1;
|
||||
col_1 | col_2
|
||||
-------+--------
|
||||
|
@ -152,13 +152,13 @@ DROP TABLE mx_ref_table;
|
|||
|
||||
CREATE INDEX mx_test_index ON mx_table(col_1);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
ALTER TABLE mx_table ADD COLUMN col_4 int;
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
ALTER TABLE mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col_1) REFERENCES mx_table(col_1);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
\d mx_table
|
||||
Table "public.mx_table"
|
||||
Column | Type | Modifiers
|
||||
|
@ -170,7 +170,7 @@ HINT: Connect to the schema node and run it again.
|
|||
-- master_modify_multiple_shards
|
||||
SELECT master_modify_multiple_shards('UPDATE mx_table SET col_2=''none''');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM mx_table WHERE col_2='none';
|
||||
count
|
||||
-------
|
||||
|
@ -185,7 +185,7 @@ SELECT count(*) FROM mx_table WHERE col_2!='none';
|
|||
|
||||
SELECT master_modify_multiple_shards('DELETE FROM mx_table');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM mx_table;
|
||||
count
|
||||
-------
|
||||
|
@ -195,7 +195,7 @@ SELECT count(*) FROM mx_table;
|
|||
-- master_drop_all_shards
|
||||
SELECT master_drop_all_shards('mx_table'::regclass, 'public', 'mx_table');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM pg_dist_shard NATURAL JOIN pg_dist_shard_placement WHERE logicalrelid='mx_table'::regclass;
|
||||
count
|
||||
-------
|
||||
|
@ -205,7 +205,7 @@ SELECT count(*) FROM pg_dist_shard NATURAL JOIN pg_dist_shard_placement WHERE lo
|
|||
-- master_apply_delete_command
|
||||
SELECT master_apply_delete_command('DELETE FROM mx_table');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM mx_table;
|
||||
count
|
||||
-------
|
||||
|
@ -215,7 +215,7 @@ SELECT count(*) FROM mx_table;
|
|||
-- master_add_node
|
||||
SELECT master_add_node('localhost', 5432);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
||||
nodeid | groupid | nodename | nodeport | noderack | hasmetadata
|
||||
--------+---------+----------+----------+----------+-------------
|
||||
|
@ -232,7 +232,7 @@ SELECT master_add_node('localhost', 5432);
|
|||
\c - - - :worker_1_port
|
||||
SELECT master_remove_node('localhost', 5432);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
||||
nodeid | groupid | nodename | nodeport | noderack | hasmetadata
|
||||
---------+---------+-----------+----------+----------+-------------
|
||||
|
@ -250,7 +250,7 @@ SELECT master_remove_node('localhost', 5432);
|
|||
\c - - - :worker_1_port
|
||||
TRUNCATE mx_table;
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
CONTEXT: SQL statement "SELECT master_modify_multiple_shards(commandText)"
|
||||
PL/pgSQL function citus_truncate_trigger() line 17 at PERFORM
|
||||
SELECT count(*) FROM mx_table;
|
||||
|
@ -262,7 +262,7 @@ SELECT count(*) FROM mx_table;
|
|||
-- INSERT / SELECT
|
||||
INSERT INTO mx_table_2 SELECT * FROM mx_table;
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM mx_table_2;
|
||||
count
|
||||
-------
|
||||
|
@ -273,7 +273,7 @@ SELECT count(*) FROM mx_table_2;
|
|||
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
|
||||
SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT colocationid FROM pg_dist_partition WHERE logicalrelid='mx_table_2'::regclass;
|
||||
colocationid
|
||||
--------------
|
||||
|
@ -289,7 +289,7 @@ WHERE logicalrelid='mx_table_2'::regclass;
|
|||
-- start_metadata_sync_to_node
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT hasmetadata FROM pg_dist_node WHERE nodeport=:worker_2_port;
|
||||
hasmetadata
|
||||
-------------
|
||||
|
@ -307,7 +307,7 @@ SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
|||
\c - - - :worker_1_port
|
||||
SELECT stop_metadata_sync_to_node('localhost', :worker_2_port);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
\c - - - :master_port
|
||||
SELECT hasmetadata FROM pg_dist_node WHERE nodeport=:worker_2_port;
|
||||
hasmetadata
|
||||
|
@ -340,7 +340,7 @@ SELECT worker_drop_distributed_table(logicalrelid) FROM pg_dist_partition;
|
|||
-- DROP TABLE
|
||||
DROP TABLE mx_table;
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
CONTEXT: SQL statement "SELECT master_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name)"
|
||||
PL/pgSQL function citus_drop_trigger() line 21 at PERFORM
|
||||
SELECT count(*) FROM mx_table;
|
||||
|
@ -352,7 +352,7 @@ SELECT count(*) FROM mx_table;
|
|||
-- master_drop_distributed_table_metadata
|
||||
SELECT master_drop_distributed_table_metadata('mx_table'::regclass, 'public', 'mx_table');
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT count(*) FROM mx_table;
|
||||
count
|
||||
-------
|
||||
|
@ -369,7 +369,7 @@ INSERT INTO pg_dist_shard_placement (nodename, nodeport, shardid, shardstate, sh
|
|||
VALUES ('localhost', :worker_2_port, :testshardid, 3, 0);
|
||||
SELECT master_copy_shard_placement(:testshardid, 'localhost', :worker_1_port, 'localhost', :worker_2_port);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
SELECT shardid, nodename, nodeport, shardstate
|
||||
FROM pg_dist_shard_placement
|
||||
WHERE shardid = :testshardid
|
||||
|
@ -384,7 +384,7 @@ DELETE FROM pg_dist_shard_placement WHERE nodeport = :worker_2_port AND shardid
|
|||
-- master_get_new_placementid
|
||||
SELECT master_get_new_placementid();
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the schema node and run it again.
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
-- Cleanup
|
||||
\c - - - :master_port
|
||||
DROP TABLE mx_table;
|
||||
|
|
|
@ -20,7 +20,7 @@ SELECT master_modify_multiple_shards('UPDATE mx_ddl_table SET version=0.1 WHERE
|
|||
ALTER TABLE mx_ddl_table ALTER COLUMN version SET NOT NULL;
|
||||
|
||||
|
||||
-- See that the changes are applied on schema node, worker tables and shards
|
||||
-- See that the changes are applied on coordinator, worker tables and shards
|
||||
\d mx_ddl_table
|
||||
|
||||
\c - - - :worker_1_port
|
||||
|
@ -38,7 +38,7 @@ ALTER TABLE mx_ddl_table ALTER COLUMN version SET NOT NULL;
|
|||
INSERT INTO mx_ddl_table VALUES (37, 78, 2);
|
||||
INSERT INTO mx_ddl_table VALUES (38, 78);
|
||||
|
||||
-- Switch to the schema node
|
||||
-- Switch to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ INSERT INTO mx_ddl_table VALUES (78, 83, 2.1);
|
|||
\c - - - :worker_1_port
|
||||
SELECT * FROM mx_ddl_table ORDER BY key;
|
||||
|
||||
-- Switch to the schema node
|
||||
-- Switch to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- DROP INDEX
|
||||
|
@ -66,7 +66,7 @@ ALTER TABLE mx_ddl_table ALTER COLUMN version DROP NOT NULL;
|
|||
ALTER TABLE mx_ddl_table DROP COLUMN version;
|
||||
|
||||
|
||||
-- See that the changes are applied on schema node, worker tables and shards
|
||||
-- See that the changes are applied on coordinator, worker tables and shards
|
||||
\d mx_ddl_table
|
||||
|
||||
\c - - - :worker_1_port
|
||||
|
|
|
@ -117,7 +117,7 @@ SELECT create_distributed_table('objects_for_xacts2', 'id');
|
|||
|
||||
ROLLBACK;
|
||||
|
||||
-- show that the table not exists on the schema node
|
||||
-- show that the table not exists on the coordinator
|
||||
SELECT count(*) FROM pg_tables WHERE tablename = 'objects_for_xacts2' and schemaname = 'citus_mx_schema_for_xacts';
|
||||
|
||||
\c - - - :worker_1_port
|
||||
|
|
|
@ -183,7 +183,7 @@ SELECT symbol, bidder_id FROM limit_orders_mx WHERE id = 246;
|
|||
-- IMMUTABLE functions are allowed -- even in returning
|
||||
UPDATE limit_orders_mx SET symbol = UPPER(symbol) WHERE id = 246 RETURNING id, LOWER(symbol), symbol;
|
||||
|
||||
-- connect schema node to run the DDL
|
||||
-- connect coordinator to run the DDL
|
||||
\c - - - :master_port
|
||||
ALTER TABLE limit_orders_mx ADD COLUMN array_of_values integer[];
|
||||
|
||||
|
@ -219,7 +219,7 @@ UPDATE limit_orders_mx SET bidder_id = temp_strict_func(1, null) WHERE id = 246;
|
|||
|
||||
SELECT array_of_values FROM limit_orders_mx WHERE id = 246;
|
||||
|
||||
-- connect schema node to run the DDL
|
||||
-- connect coordinator to run the DDL
|
||||
\c - - - :master_port
|
||||
ALTER TABLE limit_orders_mx DROP array_of_values;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ INSERT INTO researchers_mx VALUES (2, 1, 'Niklaus Wirth');
|
|||
INSERT INTO researchers_mx VALUES (3, 2, 'Tony Hoare');
|
||||
INSERT INTO researchers_mx VALUES (4, 2, 'Kenneth Iverson');
|
||||
|
||||
-- replace a researcher, reusing their id on the schema node
|
||||
-- replace a researcher, reusing their id on the coordinator
|
||||
BEGIN;
|
||||
DELETE FROM researchers_mx WHERE lab_id = 1 AND id = 2;
|
||||
INSERT INTO researchers_mx VALUES (2, 1, 'John Backus');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1310000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1310000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1290000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1290000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1280000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1280000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1270000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1270000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1260000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1260000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
SELECT
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1250000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1250000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem and orders tables as large
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1230000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1230000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem AND orders tables as large
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1240000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1240000;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :master_port
|
||||
|
||||
-- Change configuration to treat lineitem AND orders tables AS large
|
||||
|
@ -125,7 +125,7 @@ ORDER BY
|
|||
cust_nation,
|
||||
l_year;
|
||||
|
||||
-- connect to the schema node
|
||||
-- connect to the coordinator
|
||||
\c - - - :worker_2_port
|
||||
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1240000;
|
||||
|
|
Loading…
Reference in New Issue