mirror of https://github.com/citusdata/citus.git
Merge pull request #1782 from citusdata/warn_on_cluster_command
Warn on CLUSTER command for distributed tablespull/1790/head
commit
a4d3002b04
|
@ -568,6 +568,37 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
|||
ProcessVacuumStmt(vacuumStmt, queryString);
|
||||
}
|
||||
|
||||
/* warn for CLUSTER command on distributed tables */
|
||||
if (IsA(parsetree, ClusterStmt))
|
||||
{
|
||||
ClusterStmt *clusterStmt = (ClusterStmt *) parsetree;
|
||||
bool showPropagationWarning = false;
|
||||
|
||||
/* CLUSTER all */
|
||||
if (clusterStmt->relation == NULL)
|
||||
{
|
||||
showPropagationWarning = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Oid relationId = InvalidOid;
|
||||
bool missingOK = false;
|
||||
|
||||
relationId = RangeVarGetRelid(clusterStmt->relation, AccessShareLock,
|
||||
missingOK);
|
||||
|
||||
if (OidIsValid(relationId))
|
||||
{
|
||||
showPropagationWarning = IsDistributedTable(relationId);
|
||||
}
|
||||
}
|
||||
|
||||
if (showPropagationWarning)
|
||||
{
|
||||
ereport(WARNING, (errmsg("not propagating CLUSTER command to worker nodes")));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure value is valid, we can't do some checks during CREATE
|
||||
* EXTENSION. This is important to register some invalidation callbacks.
|
||||
|
|
|
@ -92,9 +92,16 @@ CREATE INDEX IF NOT EXISTS lineitem_orderkey_index on index_test_hash(a);
|
|||
NOTICE: relation "lineitem_orderkey_index" already exists, skipping
|
||||
-- Verify that we can create indexes concurrently
|
||||
CREATE INDEX CONCURRENTLY lineitem_concurrently_index ON lineitem (l_orderkey);
|
||||
-- Verify that we warn out on CLUSTER command for distributed tables and no parameter
|
||||
CLUSTER index_test_hash USING index_test_hash_index_a;
|
||||
WARNING: not propagating CLUSTER command to worker nodes
|
||||
CLUSTER;
|
||||
WARNING: not propagating CLUSTER command to worker nodes
|
||||
-- Verify that no-name local CREATE INDEX CONCURRENTLY works
|
||||
CREATE TABLE local_table (id integer, name text);
|
||||
CREATE INDEX CONCURRENTLY ON local_table(id);
|
||||
CREATE INDEX CONCURRENTLY local_table_index ON local_table(id);
|
||||
-- Vefify we don't warn out on CLUSTER command for local tables
|
||||
CLUSTER local_table USING local_table_index;
|
||||
DROP TABLE local_table;
|
||||
-- Verify that all indexes got created on the master node and one of the workers
|
||||
SELECT * FROM pg_indexes WHERE tablename = 'lineitem' or tablename like 'index_test_%' ORDER BY indexname;
|
||||
|
|
|
@ -66,9 +66,17 @@ CREATE INDEX IF NOT EXISTS lineitem_orderkey_index on index_test_hash(a);
|
|||
-- Verify that we can create indexes concurrently
|
||||
CREATE INDEX CONCURRENTLY lineitem_concurrently_index ON lineitem (l_orderkey);
|
||||
|
||||
-- Verify that we warn out on CLUSTER command for distributed tables and no parameter
|
||||
CLUSTER index_test_hash USING index_test_hash_index_a;
|
||||
CLUSTER;
|
||||
|
||||
-- Verify that no-name local CREATE INDEX CONCURRENTLY works
|
||||
CREATE TABLE local_table (id integer, name text);
|
||||
CREATE INDEX CONCURRENTLY ON local_table(id);
|
||||
CREATE INDEX CONCURRENTLY local_table_index ON local_table(id);
|
||||
|
||||
-- Vefify we don't warn out on CLUSTER command for local tables
|
||||
CLUSTER local_table USING local_table_index;
|
||||
|
||||
DROP TABLE local_table;
|
||||
|
||||
-- Verify that all indexes got created on the master node and one of the workers
|
||||
|
|
Loading…
Reference in New Issue