diff --git a/src/backend/distributed/operations/delete_protocol.c b/src/backend/distributed/operations/delete_protocol.c index abac684a9..15192746e 100644 --- a/src/backend/distributed/operations/delete_protocol.c +++ b/src/backend/distributed/operations/delete_protocol.c @@ -69,11 +69,6 @@ /* Local functions forward declarations */ -static void CheckTableCount(Query *deleteQuery); -static void CheckDeleteCriteria(Node *deleteCriteria); -static void CheckPartitionColumn(Oid relationId, Node *whereClause); -static List * ShardsMatchingDeleteCriteria(Oid relationId, List *shardList, - Node *deleteCriteria); static int DropShards(Oid relationId, char *schemaName, char *relationName, List *deletableShardIntervalList, bool dropShardsMetadataOnly); static List * DropTaskList(Oid relationId, char *schemaName, char *relationName, @@ -94,118 +89,22 @@ PG_FUNCTION_INFO_V1(master_drop_sequences); /* - * master_apply_delete_command takes in a delete command, finds shards that - * match the criteria defined in the delete command, drops the found shards from - * the worker nodes, and updates the corresponding metadata on the master node. - * This function drops a shard if and only if all rows in the shard satisfy - * the conditions in the delete command. Note that this function only accepts - * conditions on the partition key and if no condition is provided then all - * shards are deleted. - * - * We mark shard placements that we couldn't drop as to be deleted later. If a - * shard satisfies the given conditions, we delete it from shard metadata table - * even though related shard placements are not deleted. + * master_apply_delete_command is a deprecated function for dropping shards + * in an append-distributed tables. */ Datum master_apply_delete_command(PG_FUNCTION_ARGS) { - CheckCitusVersion(ERROR); - EnsureCoordinator(); - - text *queryText = PG_GETARG_TEXT_P(0); - char *queryString = text_to_cstring(queryText); - List *deletableShardIntervalList = NIL; - bool failOK = false; - RawStmt *rawStmt = (RawStmt *) ParseTreeRawStmt(queryString); - Node *queryTreeNode = rawStmt->stmt; - - if (!IsA(queryTreeNode, DeleteStmt)) - { - ereport(ERROR, (errmsg("query \"%s\" is not a delete statement", - ApplyLogRedaction(queryString)))); - } - - DeleteStmt *deleteStatement = (DeleteStmt *) queryTreeNode; - - char *schemaName = deleteStatement->relation->schemaname; - char *relationName = deleteStatement->relation->relname; - - /* - * We take an exclusive lock while dropping shards to prevent concurrent - * writes. We don't want to block SELECTs, which means queries might fail - * if they access a shard that has just been dropped. - */ - LOCKMODE lockMode = ExclusiveLock; - - Oid relationId = RangeVarGetRelid(deleteStatement->relation, lockMode, failOK); - - /* schema-prefix if it is not specified already */ - if (schemaName == NULL) - { - Oid schemaId = get_rel_namespace(relationId); - schemaName = get_namespace_name(schemaId); - } - - CheckDistributedTable(relationId); - EnsureTablePermissions(relationId, ACL_DELETE); - - List *queryTreeList = pg_analyze_and_rewrite(rawStmt, queryString, NULL, 0, NULL); - Query *deleteQuery = (Query *) linitial(queryTreeList); - CheckTableCount(deleteQuery); - - /* get where clause and flatten it */ - Node *whereClause = (Node *) deleteQuery->jointree->quals; - Node *deleteCriteria = eval_const_expressions(NULL, whereClause); - - if (IsCitusTableType(relationId, HASH_DISTRIBUTED)) - { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot delete from hash distributed table with this " - "command"), - errdetail("Delete statements on hash-partitioned tables " - "are not supported with master_apply_delete_command."), - errhint("Use the DELETE command instead."))); - } - else if (IsCitusTableType(relationId, CITUS_TABLE_WITH_NO_DIST_KEY)) - { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot delete from table"), - errdetail("Delete statements on reference and " - "local tables are not supported."))); - } - - - CheckDeleteCriteria(deleteCriteria); - CheckPartitionColumn(relationId, deleteCriteria); - - List *shardIntervalList = LoadShardIntervalList(relationId); - - /* drop all shards if where clause is not present */ - if (deleteCriteria == NULL) - { - deletableShardIntervalList = shardIntervalList; - ereport(DEBUG2, (errmsg("dropping all shards for \"%s\"", relationName))); - } - else - { - deletableShardIntervalList = ShardsMatchingDeleteCriteria(relationId, - shardIntervalList, - deleteCriteria); - } - - bool dropShardsMetadataOnly = false; - int droppedShardCount = DropShards(relationId, schemaName, relationName, - deletableShardIntervalList, - dropShardsMetadataOnly); - - PG_RETURN_INT32(droppedShardCount); + ereport(ERROR, (errmsg("master_apply_delete_command has been deprecated"))); } /* * citus_drop_all_shards attempts to drop all shards for a given relation. - * Unlike master_apply_delete_command, this function can be called even - * if the table has already been dropped. + * This function can be called even if the table has already been dropped. + * In that case, the schema name and relation name arguments are used to + * determine that table name. Otherwise, the relation ID is used and the + * other arguments are ignored. */ Datum citus_drop_all_shards(PG_FUNCTION_ARGS) @@ -584,151 +483,3 @@ CreateDropShardPlacementCommand(const char *schemaName, const char *shardRelatio return workerDropQuery->data; } - - -/* Checks that delete is only on one table. */ -static void -CheckTableCount(Query *deleteQuery) -{ - int rangeTableCount = list_length(deleteQuery->rtable); - if (rangeTableCount > 1) - { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot delete from distributed table"), - errdetail("Delete on multiple tables is not supported"))); - } -} - - -/* Checks that delete criteria only consists of simple operator expressions. */ -static void -CheckDeleteCriteria(Node *deleteCriteria) -{ - bool simpleOpExpression = true; - - if (deleteCriteria == NULL) - { - return; - } - - if (is_opclause(deleteCriteria)) - { - simpleOpExpression = SimpleOpExpression((Expr *) deleteCriteria); - } - else if (IsA(deleteCriteria, BoolExpr)) - { - BoolExpr *deleteCriteriaExpression = (BoolExpr *) deleteCriteria; - List *opExpressionList = deleteCriteriaExpression->args; - Expr *opExpression = NULL; - foreach_ptr(opExpression, opExpressionList) - { - if (!SimpleOpExpression(opExpression)) - { - simpleOpExpression = false; - break; - } - } - } - else - { - simpleOpExpression = false; - } - - if (!simpleOpExpression) - { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot delete from distributed table"), - errdetail("Delete query has a complex operator expression"))); - } -} - - -/* - * CheckPartitionColumn checks that the given where clause is based only on the - * partition key of the given relation id. - */ -static void -CheckPartitionColumn(Oid relationId, Node *whereClause) -{ - Var *partitionColumn = DistPartitionKeyOrError(relationId); - - List *columnList = pull_var_clause_default(whereClause); - Var *var = NULL; - foreach_ptr(var, columnList) - { - if (var->varattno != partitionColumn->varattno) - { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot delete from distributed table"), - errdetail("Where clause includes a column other than " - "partition column"))); - } - } -} - - -/* - * ShardsMatchingDeleteCriteria selects shards to be deleted from the shard - * interval list based on the delete criteria, and returns selected shards in - * another list. We add a shard to the list if and only if all rows in the shard - * satisfy the delete criteria. Note that this function does not expect - * deleteCriteria to be NULL. - */ -static List * -ShardsMatchingDeleteCriteria(Oid relationId, List *shardIntervalList, - Node *deleteCriteria) -{ - List *dropShardIntervalList = NIL; - - /* build the base expression for constraint */ - Index rangeTableIndex = 1; - Var *partitionColumn = PartitionColumn(relationId, rangeTableIndex); - Node *baseConstraint = BuildBaseConstraint(partitionColumn); - - Assert(deleteCriteria != NULL); - List *deleteCriteriaList = list_make1(deleteCriteria); - - - /* walk over shard list and check if shards can be dropped */ - ShardInterval *shardInterval = NULL; - foreach_ptr(shardInterval, shardIntervalList) - { - if (shardInterval->minValueExists && shardInterval->maxValueExists) - { - List *restrictInfoList = NIL; - - /* set the min/max values in the base constraint */ - UpdateConstraint(baseConstraint, shardInterval); - - BoolExpr *andExpr = (BoolExpr *) baseConstraint; - Expr *lessThanExpr = (Expr *) linitial(andExpr->args); - Expr *greaterThanExpr = (Expr *) lsecond(andExpr->args); - - /* - * passing NULL for plannerInfo will be problematic if we have placeholder - * vars. However, it won't be the case here because we are building - * the expression from shard intervals which don't have placeholder vars. - * Note that this is only the case with PG14 as the parameter doesn't exist - * prior to that. - */ - RestrictInfo *lessThanRestrictInfo = make_simple_restrictinfo_compat(NULL, - lessThanExpr); - RestrictInfo *greaterThanRestrictInfo = make_simple_restrictinfo_compat(NULL, - greaterThanExpr); - - restrictInfoList = lappend(restrictInfoList, lessThanRestrictInfo); - restrictInfoList = lappend(restrictInfoList, greaterThanRestrictInfo); - - bool dropShard = predicate_implied_by(deleteCriteriaList, restrictInfoList, - false); - if (dropShard) - { - dropShardIntervalList = lappend(dropShardIntervalList, shardInterval); - ereport(DEBUG2, (errmsg("delete criteria includes shardId " - UINT64_FORMAT, shardInterval->shardId))); - } - } - } - - return dropShardIntervalList; -} diff --git a/src/backend/distributed/sql/citus--10.2-3--11.0-1.sql b/src/backend/distributed/sql/citus--10.2-3--11.0-1.sql index 3142ea088..570715f7b 100644 --- a/src/backend/distributed/sql/citus--10.2-3--11.0-1.sql +++ b/src/backend/distributed/sql/citus--10.2-3--11.0-1.sql @@ -5,3 +5,5 @@ #include "udfs/fix_partition_shard_index_names/11.0-1.sql" #include "udfs/fix_all_partition_shard_index_names/11.0-1.sql" #include "udfs/worker_fix_partition_shard_index_names/11.0-1.sql" + +DROP FUNCTION IF EXISTS pg_catalog.master_apply_delete_command(text); diff --git a/src/backend/distributed/sql/downgrades/citus--11.0-1--10.2-3.sql b/src/backend/distributed/sql/downgrades/citus--11.0-1--10.2-3.sql index 10d0588c4..eb5be3465 100644 --- a/src/backend/distributed/sql/downgrades/citus--11.0-1--10.2-3.sql +++ b/src/backend/distributed/sql/downgrades/citus--11.0-1--10.2-3.sql @@ -3,3 +3,12 @@ DROP FUNCTION pg_catalog.fix_all_partition_shard_index_names(); DROP FUNCTION pg_catalog.fix_partition_shard_index_names(regclass); DROP FUNCTION pg_catalog.worker_fix_partition_shard_index_names(regclass, text, text); + +CREATE FUNCTION pg_catalog.master_apply_delete_command(text) + RETURNS integer + LANGUAGE C STRICT + AS 'MODULE_PATHNAME', $$master_apply_delete_command$$; +COMMENT ON FUNCTION pg_catalog.master_apply_delete_command(text) + IS 'drop shards matching delete criteria and update metadata'; + + diff --git a/src/include/distributed/coordinator_protocol.h b/src/include/distributed/coordinator_protocol.h index 3c9bf8ad6..9bf2e3275 100644 --- a/src/include/distributed/coordinator_protocol.h +++ b/src/include/distributed/coordinator_protocol.h @@ -270,7 +270,6 @@ extern Datum master_stage_shard_placement_row(PG_FUNCTION_ARGS); extern Datum master_create_empty_shard(PG_FUNCTION_ARGS); extern Datum master_append_table_to_shard(PG_FUNCTION_ARGS); extern Datum master_update_shard_statistics(PG_FUNCTION_ARGS); -extern Datum master_apply_delete_command(PG_FUNCTION_ARGS); extern Datum master_drop_sequences(PG_FUNCTION_ARGS); extern Datum master_modify_multiple_shards(PG_FUNCTION_ARGS); extern Datum lock_relation_if_exists(PG_FUNCTION_ARGS); diff --git a/src/test/regress/expected/.gitignore b/src/test/regress/expected/.gitignore index 594cdd475..5ba403db7 100644 --- a/src/test/regress/expected/.gitignore +++ b/src/test/regress/expected/.gitignore @@ -15,7 +15,6 @@ /multi_load_data_superuser.out /multi_load_large_records.out /multi_load_more_data.out -/multi_master_delete_protocol.out /multi_mx_copy_data.out /multi_outer_join.out /multi_outer_join_reference.out diff --git a/src/test/regress/expected/citus_local_tables.out b/src/test/regress/expected/citus_local_tables.out index 17e28a12e..e1752fccb 100644 --- a/src/test/regress/expected/citus_local_tables.out +++ b/src/test/regress/expected/citus_local_tables.out @@ -696,8 +696,6 @@ SELECT update_distributed_table_colocation('citus_local_table_4', colocate_with ERROR: relation citus_local_table_4 should be a hash distributed table SELECT master_create_empty_shard('citus_local_table_4'); ERROR: relation "citus_local_table_4" is a local table -SELECT master_apply_delete_command('DELETE FROM citus_local_table_4'); -ERROR: cannot delete from table CREATE TABLE postgres_local_table (a int); SELECT master_append_table_to_shard(shardId, 'postgres_local_table', 'localhost', :master_port) FROM (SELECT shardid FROM pg_dist_shard WHERE logicalrelid='citus_local_table_4'::regclass) as shardid; @@ -959,7 +957,7 @@ select count(*) from pg_constraint where conname = 'fkey_test_drop'; select inhrelid::regclass from pg_inherits where (select inhparent::regclass::text) ~ '^parent_1_\d{7}$' order by 1; inhrelid --------------------------------------------------------------------- - parent_1_child_1_1190085 + parent_1_child_1_1190084 (1 row) -- check the shell partition diff --git a/src/test/regress/expected/isolation_append_copy_vs_all.out b/src/test/regress/expected/isolation_append_copy_vs_all.out index cf5fa1176..4176289b4 100644 --- a/src/test/regress/expected/isolation_append_copy_vs_all.out +++ b/src/test/regress/expected/isolation_append_copy_vs_all.out @@ -385,30 +385,6 @@ count (1 row) -starting permutation: s1-initialize s1-begin s1-copy s2-master-apply-delete-command s1-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY append_copy FROM PROGRAM 'echo 0, a, 0 && echo 1, b, 1 && echo 2, c, 2 && echo 3, d, 3 && echo 4, e, 4' WITH CSV; -step s1-begin: BEGIN; -step s1-copy: COPY append_copy FROM PROGRAM 'echo 5, f, 5 && echo 6, g, 6 && echo 7, h, 7 && echo 8, i, 8 && echo 9, j, 9' WITH CSV; -step s2-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM append_copy WHERE id <= 4;'); -step s1-commit: COMMIT; -step s2-master-apply-delete-command: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-select-count: SELECT COUNT(*) FROM append_copy; -count ---------------------------------------------------------------------- - 5 -(1 row) - - starting permutation: s1-initialize s1-begin s1-copy s2-master-drop-all-shards s1-commit s1-select-count create_distributed_table --------------------------------------------------------------------- @@ -801,30 +777,6 @@ count (1 row) -starting permutation: s1-initialize s1-begin s1-master-apply-delete-command s2-copy s1-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY append_copy FROM PROGRAM 'echo 0, a, 0 && echo 1, b, 1 && echo 2, c, 2 && echo 3, d, 3 && echo 4, e, 4' WITH CSV; -step s1-begin: BEGIN; -step s1-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM append_copy WHERE id <= 4;'); -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s2-copy: COPY append_copy FROM PROGRAM 'echo 5, f, 5 && echo 6, g, 6 && echo 7, h, 7 && echo 8, i, 8 && echo 9, j, 9' WITH CSV; -step s1-commit: COMMIT; -step s2-copy: <... completed> -step s1-select-count: SELECT COUNT(*) FROM append_copy; -count ---------------------------------------------------------------------- - 5 -(1 row) - - starting permutation: s1-initialize s1-begin s1-master-drop-all-shards s2-copy s1-commit s1-select-count create_distributed_table --------------------------------------------------------------------- diff --git a/src/test/regress/expected/isolation_drop_shards.out b/src/test/regress/expected/isolation_drop_shards.out index 9dcce0bc3..41278a63c 100644 --- a/src/test/regress/expected/isolation_drop_shards.out +++ b/src/test/regress/expected/isolation_drop_shards.out @@ -25,36 +25,6 @@ step s1-commit: step s2-truncate: <... completed> -starting permutation: s1-begin s1-drop-all-shards s2-apply-delete-command s1-commit -?column? ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-begin: - BEGIN; - -step s1-drop-all-shards: - SELECT citus_drop_all_shards('append_table', 'public', 'append_table'); - -citus_drop_all_shards ---------------------------------------------------------------------- - 16 -(1 row) - -step s2-apply-delete-command: - SELECT master_apply_delete_command('DELETE FROM append_table'); - -step s1-commit: - COMMIT; - -step s2-apply-delete-command: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - - starting permutation: s1-begin s1-drop-all-shards s2-drop-all-shards s1-commit ?column? --------------------------------------------------------------------- @@ -114,91 +84,6 @@ test_id|data (0 rows) -starting permutation: s1-begin s1-apply-delete-command s2-truncate s1-commit -?column? ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-begin: - BEGIN; - -step s1-apply-delete-command: - SELECT master_apply_delete_command('DELETE FROM append_table'); - -master_apply_delete_command ---------------------------------------------------------------------- - 16 -(1 row) - -step s2-truncate: - TRUNCATE append_table; - -step s1-commit: - COMMIT; - -step s2-truncate: <... completed> - -starting permutation: s1-begin s1-apply-delete-command s2-apply-delete-command s1-commit -?column? ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-begin: - BEGIN; - -step s1-apply-delete-command: - SELECT master_apply_delete_command('DELETE FROM append_table'); - -master_apply_delete_command ---------------------------------------------------------------------- - 16 -(1 row) - -step s2-apply-delete-command: - SELECT master_apply_delete_command('DELETE FROM append_table'); - -step s1-commit: - COMMIT; - -step s2-apply-delete-command: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - - -starting permutation: s1-begin s1-apply-delete-command s2-drop-all-shards s1-commit -?column? ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-begin: - BEGIN; - -step s1-apply-delete-command: - SELECT master_apply_delete_command('DELETE FROM append_table'); - -master_apply_delete_command ---------------------------------------------------------------------- - 16 -(1 row) - -step s2-drop-all-shards: - SELECT citus_drop_all_shards('append_table', 'public', 'append_table'); - -step s1-commit: - COMMIT; - -step s2-drop-all-shards: <... completed> -citus_drop_all_shards ---------------------------------------------------------------------- - 0 -(1 row) - - starting permutation: s1-begin s1-truncate s2-truncate s1-commit ?column? --------------------------------------------------------------------- @@ -219,31 +104,6 @@ step s1-commit: step s2-truncate: <... completed> -starting permutation: s1-begin s1-truncate s2-apply-delete-command s1-commit -?column? ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-begin: - BEGIN; - -step s1-truncate: - TRUNCATE append_table; - -step s2-apply-delete-command: - SELECT master_apply_delete_command('DELETE FROM append_table'); - -step s1-commit: - COMMIT; - -step s2-apply-delete-command: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - - starting permutation: s1-begin s1-truncate s2-drop-all-shards s1-commit ?column? --------------------------------------------------------------------- diff --git a/src/test/regress/expected/isolation_master_apply_delete.out b/src/test/regress/expected/isolation_master_apply_delete.out deleted file mode 100644 index e53e3d52d..000000000 --- a/src/test/regress/expected/isolation_master_apply_delete.out +++ /dev/null @@ -1,125 +0,0 @@ -Parsed test spec with 2 sessions - -starting permutation: s1-begin s2-begin s1-master_apply_delete_command_all_shard s2-master_apply_delete_command_all_shard s1-commit s2-commit -step s1-begin: - BEGIN; - -step s2-begin: - BEGIN; - -step s1-master_apply_delete_command_all_shard: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$); - -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s2-master_apply_delete_command_all_shard: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$); - -step s1-commit: - COMMIT; - -step s2-master_apply_delete_command_all_shard: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - -step s2-commit: - COMMIT; - - -starting permutation: s1-begin s2-begin s1-master_apply_delete_command_all_shard s2-master_apply_delete_command_row s1-commit s2-commit -step s1-begin: - BEGIN; - -step s2-begin: - BEGIN; - -step s1-master_apply_delete_command_all_shard: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$); - -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s2-master_apply_delete_command_row: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$); - -step s1-commit: - COMMIT; - -step s2-master_apply_delete_command_row: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - -step s2-commit: - COMMIT; - - -starting permutation: s1-begin s2-begin s1-master_apply_delete_command_row s2-master_apply_delete_command_all_shard s1-commit s2-commit -step s1-begin: - BEGIN; - -step s2-begin: - BEGIN; - -step s1-master_apply_delete_command_row: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$); - -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - -step s2-master_apply_delete_command_all_shard: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$); - -step s1-commit: - COMMIT; - -step s2-master_apply_delete_command_all_shard: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s2-commit: - COMMIT; - - -starting permutation: s1-begin s2-begin s1-master_apply_delete_command_row s2-master_apply_delete_command_row s1-commit s2-commit -step s1-begin: - BEGIN; - -step s2-begin: - BEGIN; - -step s1-master_apply_delete_command_row: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$); - -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - -step s2-master_apply_delete_command_row: - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$); - -step s1-commit: - COMMIT; - -step s2-master_apply_delete_command_row: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - -step s2-commit: - COMMIT; - diff --git a/src/test/regress/expected/isolation_range_copy_vs_all.out b/src/test/regress/expected/isolation_range_copy_vs_all.out index 2490d9547..d66a63cf6 100644 --- a/src/test/regress/expected/isolation_range_copy_vs_all.out +++ b/src/test/regress/expected/isolation_range_copy_vs_all.out @@ -403,30 +403,6 @@ count (1 row) -starting permutation: s1-initialize s1-begin s1-copy s2-master-apply-delete-command s1-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY range_copy FROM PROGRAM 'echo 0, a, 0 && echo 1, b, 1 && echo 2, c, 2 && echo 3, d, 3 && echo 4, e, 4' WITH CSV; -step s1-begin: BEGIN; -step s1-copy: COPY range_copy FROM PROGRAM 'echo 5, f, 5 && echo 6, g, 6 && echo 7, h, 7 && echo 8, i, 8 && echo 9, j, 9' WITH CSV; -step s2-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM range_copy WHERE id <= 4;'); -step s1-commit: COMMIT; -step s2-master-apply-delete-command: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-select-count: SELECT COUNT(*) FROM range_copy; -count ---------------------------------------------------------------------- - 5 -(1 row) - - starting permutation: s1-initialize s1-begin s1-copy s2-master-drop-all-shards s1-commit s1-select-count create_distributed_table --------------------------------------------------------------------- @@ -837,30 +813,6 @@ count (1 row) -starting permutation: s1-initialize s1-begin s1-master-apply-delete-command s2-copy s1-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY range_copy FROM PROGRAM 'echo 0, a, 0 && echo 1, b, 1 && echo 2, c, 2 && echo 3, d, 3 && echo 4, e, 4' WITH CSV; -step s1-begin: BEGIN; -step s1-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM range_copy WHERE id <= 4;'); -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s2-copy: COPY range_copy FROM PROGRAM 'echo 5, f, 5 && echo 6, g, 6 && echo 7, h, 7 && echo 8, i, 8 && echo 9, j, 9' WITH CSV; -step s1-commit: COMMIT; -step s2-copy: <... completed> -step s1-select-count: SELECT COUNT(*) FROM range_copy; -count ---------------------------------------------------------------------- - 5 -(1 row) - - starting permutation: s1-initialize s1-begin s1-master-drop-all-shards s2-copy s1-commit s1-select-count create_distributed_table --------------------------------------------------------------------- diff --git a/src/test/regress/expected/isolation_select_vs_all.out b/src/test/regress/expected/isolation_select_vs_all.out index fb67cfb2a..734ff7a5f 100644 --- a/src/test/regress/expected/isolation_select_vs_all.out +++ b/src/test/regress/expected/isolation_select_vs_all.out @@ -810,33 +810,6 @@ restore_isolation_tester_func (1 row) -starting permutation: s1-initialize s1-begin s2-master-apply-delete-command s1-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY select_append FROM PROGRAM 'echo 0, a, 0 && echo 1, b, 1 && echo 2, c, 2 && echo 3, d, 3 && echo 4, e, 4' WITH CSV; -step s1-begin: BEGIN; -step s2-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM select_append WHERE id <= 4;'); -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-commit: COMMIT; -step s1-select-count: SELECT COUNT(*) FROM select_append; -count ---------------------------------------------------------------------- - 0 -(1 row) - -restore_isolation_tester_func ---------------------------------------------------------------------- - -(1 row) - - starting permutation: s1-initialize s1-begin s2-master-drop-all-shards s1-commit s1-select-count create_distributed_table --------------------------------------------------------------------- @@ -1300,33 +1273,6 @@ restore_isolation_tester_func (1 row) -starting permutation: s1-initialize s1-begin s1-master-apply-delete-command s1-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY select_append FROM PROGRAM 'echo 0, a, 0 && echo 1, b, 1 && echo 2, c, 2 && echo 3, d, 3 && echo 4, e, 4' WITH CSV; -step s1-begin: BEGIN; -step s1-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM select_append WHERE id <= 4;'); -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s1-commit: COMMIT; -step s1-select-count: SELECT COUNT(*) FROM select_append; -count ---------------------------------------------------------------------- - 0 -(1 row) - -restore_isolation_tester_func ---------------------------------------------------------------------- - -(1 row) - - starting permutation: s1-initialize s1-begin s1-master-drop-all-shards s1-commit s1-select-count create_distributed_table --------------------------------------------------------------------- diff --git a/src/test/regress/expected/isolation_truncate_vs_all.out b/src/test/regress/expected/isolation_truncate_vs_all.out index 36b27b4c1..17cf1f603 100644 --- a/src/test/regress/expected/isolation_truncate_vs_all.out +++ b/src/test/regress/expected/isolation_truncate_vs_all.out @@ -329,37 +329,6 @@ restore_isolation_tester_func (1 row) -starting permutation: s1-initialize s1-begin s2-begin s1-truncate s2-master-apply-delete-command s1-commit s2-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY truncate_append FROM PROGRAM 'echo 0, a && echo 1, b && echo 2, c && echo 3, d && echo 4, e' WITH CSV; -step s1-begin: BEGIN; -step s2-begin: BEGIN; -step s1-truncate: TRUNCATE truncate_append; -step s2-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM truncate_append WHERE id <= 4;'); -step s1-commit: COMMIT; -step s2-master-apply-delete-command: <... completed> -master_apply_delete_command ---------------------------------------------------------------------- - 0 -(1 row) - -step s2-commit: COMMIT; -step s1-select-count: SELECT COUNT(*) FROM truncate_append; -count ---------------------------------------------------------------------- - 0 -(1 row) - -restore_isolation_tester_func ---------------------------------------------------------------------- - -(1 row) - - starting permutation: s1-initialize s1-begin s2-begin s1-truncate s2-master-drop-all-shards s1-commit s2-commit s1-select-count create_distributed_table --------------------------------------------------------------------- @@ -695,37 +664,6 @@ restore_isolation_tester_func (1 row) -starting permutation: s1-initialize s1-begin s2-begin s1-master-apply-delete-command s2-truncate s1-commit s2-commit s1-select-count -create_distributed_table ---------------------------------------------------------------------- - -(1 row) - -step s1-initialize: COPY truncate_append FROM PROGRAM 'echo 0, a && echo 1, b && echo 2, c && echo 3, d && echo 4, e' WITH CSV; -step s1-begin: BEGIN; -step s2-begin: BEGIN; -step s1-master-apply-delete-command: SELECT master_apply_delete_command('DELETE FROM truncate_append WHERE id <= 4;'); -master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - -step s2-truncate: TRUNCATE truncate_append; -step s1-commit: COMMIT; -step s2-truncate: <... completed> -step s2-commit: COMMIT; -step s1-select-count: SELECT COUNT(*) FROM truncate_append; -count ---------------------------------------------------------------------- - 0 -(1 row) - -restore_isolation_tester_func ---------------------------------------------------------------------- - -(1 row) - - starting permutation: s1-initialize s1-begin s2-begin s1-master-drop-all-shards s2-truncate s1-commit s2-commit s1-select-count create_distributed_table --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_extension.out b/src/test/regress/expected/multi_extension.out index 3c9328320..0fd5edd0f 100644 --- a/src/test/regress/expected/multi_extension.out +++ b/src/test/regress/expected/multi_extension.out @@ -892,12 +892,13 @@ SELECT * FROM multi_extension.print_extension_changes(); -- Snapshot of state at 11.0-1 ALTER EXTENSION citus UPDATE TO '11.0-1'; SELECT * FROM multi_extension.print_extension_changes(); - previous_object | current_object + previous_object | current_object --------------------------------------------------------------------- - | function fix_all_partition_shard_index_names() SETOF regclass - | function fix_partition_shard_index_names(regclass) void - | function worker_fix_partition_shard_index_names(regclass,text,text) void -(3 rows) + function master_apply_delete_command(text) integer | + | function fix_all_partition_shard_index_names() SETOF regclass + | function fix_partition_shard_index_names(regclass) void + | function worker_fix_partition_shard_index_names(regclass,text,text) void +(4 rows) DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff; -- show running version diff --git a/src/test/regress/expected/multi_reference_table.out b/src/test/regress/expected/multi_reference_table.out index 34453ede8..56d3577ef 100644 --- a/src/test/regress/expected/multi_reference_table.out +++ b/src/test/regress/expected/multi_reference_table.out @@ -1401,10 +1401,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_sche ALTER TABLE reference_schema.reference_table_ddl RENAME TO reference_table_ddl_test; ALTER TABLE reference_schema.reference_table_ddl_test RENAME TO reference_table_ddl; -- now test reference tables against some helper UDFs that Citus provides --- cannot delete / drop shards from a reference table -SELECT master_apply_delete_command('DELETE FROM reference_schema.reference_table_ddl'); -ERROR: cannot delete from table -DETAIL: Delete statements on reference and local tables are not supported. -- cannot add shards SELECT master_create_empty_shard('reference_schema.reference_table_ddl'); ERROR: relation "reference_schema.reference_table_ddl" is a reference table diff --git a/src/test/regress/expected/multi_schema_support.out b/src/test/regress/expected/multi_schema_support.out index 79717aff9..debed430e 100644 --- a/src/test/regress/expected/multi_schema_support.out +++ b/src/test/regress/expected/multi_schema_support.out @@ -443,7 +443,7 @@ CREATE TABLE test_schema_support.nation_hash_collation( n_comment varchar(152) ); SELECT master_get_table_ddl_events('test_schema_support.nation_hash_collation') ORDER BY 1; - master_get_table_ddl_events + master_get_table_ddl_events --------------------------------------------------------------------- ALTER TABLE test_schema_support.nation_hash_collation OWNER TO postgres CREATE TABLE test_schema_support.nation_hash_collation (n_nationkey integer NOT NULL, n_name character(25) NOT NULL COLLATE test_schema_support.english, n_regionkey integer NOT NULL, n_comment character varying(152)) @@ -759,31 +759,6 @@ SELECT shardstate, nodename, nodeport FROM pg_dist_shard_placement WHERE shardid 1 | localhost | 57638 (2 rows) --- test master_apply_delete_command with schemas -SET search_path TO public; -SELECT master_apply_delete_command('DELETE FROM test_schema_support.nation_append') ; - master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - --- verify shard is dropped -\c - - - :worker_1_port -\d test_schema_support.nation_append_119* -\c - - - :master_port --- test with search_path is set -SET search_path TO test_schema_support; -\copy nation_append FROM STDIN with delimiter '|'; -SELECT master_apply_delete_command('DELETE FROM nation_append') ; - master_apply_delete_command ---------------------------------------------------------------------- - 1 -(1 row) - --- verify shard is dropped -\c - - - :worker_1_port -\d test_schema_support.nation_append_119* -\c - - - :master_port -- check joins of tables which are in schemas other than public -- we create new tables with replication factor of 1 -- so that we guarantee to have repartitions when necessary diff --git a/src/test/regress/expected/multi_transactional_drop_shards.out b/src/test/regress/expected/multi_transactional_drop_shards.out index a163823be..4304df10c 100644 --- a/src/test/regress/expected/multi_transactional_drop_shards.out +++ b/src/test/regress/expected/multi_transactional_drop_shards.out @@ -120,10 +120,10 @@ SELECT master_create_empty_shard('transactional_drop_shards'); (1 row) BEGIN; -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); - master_apply_delete_command +SELECT citus_drop_all_shards('transactional_drop_shards','',''); + citus_drop_all_shards --------------------------------------------------------------------- - 1 + 1 (1 row) ROLLBACK; @@ -160,10 +160,10 @@ ORDER BY \c - - - :master_port -- test master_delete_protocol in transaction, then COMMIT BEGIN; -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); - master_apply_delete_command +SELECT citus_drop_all_shards('transactional_drop_shards','',''); + citus_drop_all_shards --------------------------------------------------------------------- - 1 + 1 (1 row) COMMIT; @@ -244,13 +244,13 @@ ORDER BY (1 row) \c - - - :master_port --- test master_apply_delete_command in a transaction after insertion +-- test citus_drop_all_shards in a transaction after insertion BEGIN; INSERT INTO transactional_drop_shards VALUES (1); -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); - master_apply_delete_command +SELECT citus_drop_all_shards('transactional_drop_shards','',''); + citus_drop_all_shards --------------------------------------------------------------------- - 1 + 1 (1 row) ROLLBACK; @@ -386,9 +386,9 @@ ORDER BY (1 row) \c - - - :master_port --- test master_apply_delete_command table with failing worker +-- test citus_drop_all_shards table with failing worker \set VERBOSITY terse -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); +SELECT citus_drop_all_shards('transactional_drop_shards','',''); ERROR: illegal value \set VERBOSITY default -- verify metadata is not deleted diff --git a/src/test/regress/expected/multi_unsupported_worker_operations.out b/src/test/regress/expected/multi_unsupported_worker_operations.out index aa26d115d..9317b0e9e 100644 --- a/src/test/regress/expected/multi_unsupported_worker_operations.out +++ b/src/test/regress/expected/multi_unsupported_worker_operations.out @@ -172,16 +172,6 @@ SELECT count(*) FROM pg_dist_shard NATURAL JOIN pg_dist_shard_placement WHERE lo 5 (1 row) --- 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 coordinator and run it again. -SELECT count(*) FROM mx_table; - count ---------------------------------------------------------------------- - 5 -(1 row) - -- master_add_inactive_node SELECT 1 FROM master_add_inactive_node('localhost', 5432); ERROR: operation is not allowed on this node diff --git a/src/test/regress/expected/multi_utilities.out b/src/test/regress/expected/multi_utilities.out index 91b21e7d8..2e4666e46 100644 --- a/src/test/regress/expected/multi_utilities.out +++ b/src/test/regress/expected/multi_utilities.out @@ -59,16 +59,13 @@ EXECUTE sharded_query; --------------------------------------------------------------------- (0 rows) --- try to drop shards with where clause -SELECT master_apply_delete_command('DELETE FROM sharded_table WHERE id > 0'); -ERROR: cannot delete from hash distributed table with this command -DETAIL: Delete statements on hash-partitioned tables are not supported with master_apply_delete_command. -HINT: Use the DELETE command instead. -- drop all shards -SELECT master_apply_delete_command('DELETE FROM sharded_table'); -ERROR: cannot delete from hash distributed table with this command -DETAIL: Delete statements on hash-partitioned tables are not supported with master_apply_delete_command. -HINT: Use the DELETE command instead. +SELECT citus_drop_all_shards('sharded_table','',''); + citus_drop_all_shards +--------------------------------------------------------------------- + 2 +(1 row) + SET citus.shard_count TO 4; SET citus.next_shard_id TO 999001; ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1400000; diff --git a/src/test/regress/expected/upgrade_list_citus_objects.out b/src/test/regress/expected/upgrade_list_citus_objects.out index c05821666..d3516af51 100644 --- a/src/test/regress/expected/upgrade_list_citus_objects.out +++ b/src/test/regress/expected/upgrade_list_citus_objects.out @@ -14,7 +14,7 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND deptype = 'e' AND e.extname='citus' ORDER BY 1; - description + description --------------------------------------------------------------------- access method columnar event trigger citus_cascade_to_partition @@ -147,7 +147,6 @@ ORDER BY 1; function master_add_node(text,integer,integer,noderole,name) function master_add_secondary_node(text,integer,text,integer,name) function master_append_table_to_shard(bigint,text,text,integer) - function master_apply_delete_command(text) function master_copy_shard_placement(bigint,text,integer,text,integer,boolean,citus.shard_transfer_mode) function master_create_empty_shard(text) function master_disable_node(text,integer) @@ -204,7 +203,7 @@ ORDER BY 1; function worker_drop_distributed_table(text) function worker_fetch_foreign_file(text,text,bigint,text[],integer[]) function worker_fetch_partition_file(bigint,integer,integer,integer,text,integer) - function worker_fix_partition_shard_index_names(regclass, text, text) + function worker_fix_partition_shard_index_names(regclass,text,text) function worker_fix_pre_citus10_partitioned_table_constraint_names(regclass,bigint,text) function worker_hash("any") function worker_hash_partition_table(bigint,integer,text,text,oid,anyarray) @@ -261,5 +260,5 @@ ORDER BY 1; view citus_worker_stat_activity view pg_dist_shard_placement view time_partitions -(245 rows) +(244 rows) diff --git a/src/test/regress/input/multi_alter_table_statements.source b/src/test/regress/input/multi_alter_table_statements.source index 0db98bbe1..d10ecca4b 100644 --- a/src/test/regress/input/multi_alter_table_statements.source +++ b/src/test/regress/input/multi_alter_table_statements.source @@ -527,7 +527,6 @@ DROP TABLESPACE super_fast_ssd; -- Cleanup the table and its shards SET citus.enable_ddl_propagation to true; -SELECT master_apply_delete_command('DELETE FROM lineitem_alter'); DROP TABLE lineitem_alter; -- check that nothing's left over on workers, other than the leftover shard created -- during the unsuccessful COPY diff --git a/src/test/regress/input/multi_append_table_to_shard.source b/src/test/regress/input/multi_append_table_to_shard.source index 74c79f50f..37e6203cf 100644 --- a/src/test/regress/input/multi_append_table_to_shard.source +++ b/src/test/regress/input/multi_append_table_to_shard.source @@ -65,7 +65,6 @@ FROM WHERE 'multi_append_table_to_shard_right_reference_hash'::regclass::oid = logicalrelid; -- Clean up after test -SELECT master_apply_delete_command('DELETE FROM multi_append_table_to_shard_left'); DROP TABLE multi_append_table_to_shard_stage; DROP TABLE multi_append_table_to_shard_right_reference; DROP TABLE multi_append_table_to_shard_left; diff --git a/src/test/regress/input/multi_master_delete_protocol.source b/src/test/regress/input/multi_master_delete_protocol.source deleted file mode 100644 index c3bd379f3..000000000 --- a/src/test/regress/input/multi_master_delete_protocol.source +++ /dev/null @@ -1,56 +0,0 @@ --- --- MULTI_MASTER_DELETE_PROTOCOL --- - - -SET citus.next_shard_id TO 320000; - - --- Create a new range partitioned customer_delete_protocol table and load data into it. -CREATE TABLE customer_delete_protocol ( - c_custkey integer not null, - c_name varchar(25) not null, - c_address varchar(40) not null, - c_nationkey integer not null, - c_phone char(15) not null, - c_acctbal decimal(15,2) not null, - c_mktsegment char(10) not null, - c_comment varchar(117) not null); -SELECT master_create_distributed_table('customer_delete_protocol', 'c_custkey', 'append'); - -\copy customer_delete_protocol FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' -\copy customer_delete_protocol FROM '@abs_srcdir@/data/customer.2.data' with delimiter '|' -\copy customer_delete_protocol FROM '@abs_srcdir@/data/customer.3.data' with delimiter '|' - --- Testing master_apply_delete_command --- Check that we don't support conditions on columns other than partition key. - -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_acctbal > 0.0'); --- Check that we delete a shard if and only if all rows in the shard satisfy the condition. -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_custkey > 6500'); -SELECT count(*) from customer_delete_protocol; - --- Delete one shard that satisfies the given conditions. - -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_custkey > 1000 AND c_custkey < 3000'); -SELECT count(*) from customer_delete_protocol; - --- Delete all shards if no condition is provided. - -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol'); -SELECT count(*) FROM customer_delete_protocol; - --- Verify that empty shards are deleted if no condition is provided -SELECT 1 AS one FROM master_create_empty_shard('customer_delete_protocol'); -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_custkey > 1000'); -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol'); - --- Verify that master_apply_delete_command can be called in a transaction block -SELECT 1 AS one FROM master_create_empty_shard('customer_delete_protocol'); -BEGIN; -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol'); -COMMIT; diff --git a/src/test/regress/isolation_schedule b/src/test/regress/isolation_schedule index 52380c5a7..5c486511a 100644 --- a/src/test/regress/isolation_schedule +++ b/src/test/regress/isolation_schedule @@ -40,7 +40,7 @@ test: isolation_create_citus_local_table # writes, run this test serially. test: isolation_create_restore_point -test: isolation_create_distributed_table isolation_master_append_table isolation_master_apply_delete +test: isolation_create_distributed_table isolation_master_append_table test: isolation_multi_shard_modify_vs_all test: isolation_modify_with_subquery_vs_dml test: isolation_hash_copy_vs_all diff --git a/src/test/regress/multi_1_schedule b/src/test/regress/multi_1_schedule index 704cc140a..5f0863dc5 100644 --- a/src/test/regress/multi_1_schedule +++ b/src/test/regress/multi_1_schedule @@ -130,7 +130,6 @@ test: with_executors with_join with_partitioning with_transactions with_dml # Tests to check our large record loading and shard deletion behavior # ---------- test: multi_load_large_records -test: multi_master_delete_protocol # ---------- # Tests around DDL statements run on distributed tables diff --git a/src/test/regress/output/multi_alter_table_statements.source b/src/test/regress/output/multi_alter_table_statements.source index c5932f529..585d8912d 100644 --- a/src/test/regress/output/multi_alter_table_statements.source +++ b/src/test/regress/output/multi_alter_table_statements.source @@ -1029,12 +1029,6 @@ HINT: Connect to worker nodes directly to manually move all tables. DROP TABLESPACE super_fast_ssd; -- Cleanup the table and its shards SET citus.enable_ddl_propagation to true; -SELECT master_apply_delete_command('DELETE FROM lineitem_alter'); - master_apply_delete_command ------------------------------ - 3 -(1 row) - DROP TABLE lineitem_alter; -- check that nothing's left over on workers, other than the leftover shard created -- during the unsuccessful COPY diff --git a/src/test/regress/output/multi_append_table_to_shard.source b/src/test/regress/output/multi_append_table_to_shard.source index 7bd7af759..d2a72a960 100644 --- a/src/test/regress/output/multi_append_table_to_shard.source +++ b/src/test/regress/output/multi_append_table_to_shard.source @@ -84,12 +84,6 @@ WHERE 'multi_append_table_to_shard_right_reference_hash'::regclass::oid = logica ERROR: cannot append to shardId 230001 DETAIL: We currently don't support appending to shards in hash-partitioned, reference and local tables -- Clean up after test -SELECT master_apply_delete_command('DELETE FROM multi_append_table_to_shard_left'); - master_apply_delete_command ------------------------------ - 2 -(1 row) - DROP TABLE multi_append_table_to_shard_stage; DROP TABLE multi_append_table_to_shard_right_reference; DROP TABLE multi_append_table_to_shard_left; diff --git a/src/test/regress/output/multi_master_delete_protocol.source b/src/test/regress/output/multi_master_delete_protocol.source deleted file mode 100644 index ab187306c..000000000 --- a/src/test/regress/output/multi_master_delete_protocol.source +++ /dev/null @@ -1,105 +0,0 @@ --- --- MULTI_MASTER_DELETE_PROTOCOL --- -SET citus.next_shard_id TO 320000; --- Create a new range partitioned customer_delete_protocol table and load data into it. -CREATE TABLE customer_delete_protocol ( - c_custkey integer not null, - c_name varchar(25) not null, - c_address varchar(40) not null, - c_nationkey integer not null, - c_phone char(15) not null, - c_acctbal decimal(15,2) not null, - c_mktsegment char(10) not null, - c_comment varchar(117) not null); -SELECT master_create_distributed_table('customer_delete_protocol', 'c_custkey', 'append'); - master_create_distributed_table ---------------------------------- - -(1 row) - -\copy customer_delete_protocol FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' -\copy customer_delete_protocol FROM '@abs_srcdir@/data/customer.2.data' with delimiter '|' -\copy customer_delete_protocol FROM '@abs_srcdir@/data/customer.3.data' with delimiter '|' --- Testing master_apply_delete_command --- Check that we don't support conditions on columns other than partition key. -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_acctbal > 0.0'); -ERROR: cannot delete from distributed table -DETAIL: Where clause includes a column other than partition column --- Check that we delete a shard if and only if all rows in the shard satisfy the condition. -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_custkey > 6500'); - master_apply_delete_command ------------------------------ - 0 -(1 row) - -SELECT count(*) from customer_delete_protocol; - count -------- - 3000 -(1 row) - --- Delete one shard that satisfies the given conditions. -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_custkey > 1000 AND c_custkey < 3000'); - master_apply_delete_command ------------------------------ - 1 -(1 row) - -SELECT count(*) from customer_delete_protocol; - count -------- - 2000 -(1 row) - --- Delete all shards if no condition is provided. -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol'); - master_apply_delete_command ------------------------------ - 2 -(1 row) - -SELECT count(*) FROM customer_delete_protocol; - count -------- - 0 -(1 row) - --- Verify that empty shards are deleted if no condition is provided -SELECT 1 AS one FROM master_create_empty_shard('customer_delete_protocol'); - one ------ - 1 -(1 row) - -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol - WHERE c_custkey > 1000'); - master_apply_delete_command ------------------------------ - 0 -(1 row) - -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol'); - master_apply_delete_command ------------------------------ - 1 -(1 row) - --- Verify that master_apply_delete_command can be called in a transaction block -SELECT 1 AS one FROM master_create_empty_shard('customer_delete_protocol'); - one ------ - 1 -(1 row) - -BEGIN; -SELECT master_apply_delete_command('DELETE FROM customer_delete_protocol'); - master_apply_delete_command ------------------------------ - 1 -(1 row) - -COMMIT; diff --git a/src/test/regress/spec/isolation_append_copy_vs_all.spec b/src/test/regress/spec/isolation_append_copy_vs_all.spec index f4bdb2f2f..4ae92f17b 100644 --- a/src/test/regress/spec/isolation_append_copy_vs_all.spec +++ b/src/test/regress/spec/isolation_append_copy_vs_all.spec @@ -41,7 +41,6 @@ step "s1-ddl-add-column" { ALTER TABLE append_copy ADD new_column int DEFAULT 0; step "s1-ddl-drop-column" { ALTER TABLE append_copy DROP new_column; } step "s1-ddl-rename-column" { ALTER TABLE append_copy RENAME data TO new_column; } step "s1-table-size" { SELECT citus_total_relation_size('append_copy'); } -step "s1-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM append_copy WHERE id <= 4;'); } step "s1-master-drop-all-shards" { SELECT citus_drop_all_shards('append_copy'::regclass, 'public', 'append_copy'); } step "s1-create-non-distributed-table" { CREATE TABLE append_copy(id integer, data text, int_data int); } step "s1-distribute-table" { SELECT create_distributed_table('append_copy', 'id', 'append'); } @@ -73,7 +72,6 @@ step "s2-ddl-add-column" { ALTER TABLE append_copy ADD new_column int DEFAULT 0; step "s2-ddl-drop-column" { ALTER TABLE append_copy DROP new_column; } step "s2-ddl-rename-column" { ALTER TABLE append_copy RENAME data TO new_column; } step "s2-table-size" { SELECT citus_total_relation_size('append_copy'); } -step "s2-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM append_copy WHERE id <= 4;'); } step "s2-master-drop-all-shards" { SELECT citus_drop_all_shards('append_copy'::regclass, 'public', 'append_copy'); } step "s2-distribute-table" { SELECT create_distributed_table('append_copy', 'id', 'append'); } @@ -97,7 +95,6 @@ permutation "s1-initialize" "s1-begin" "s1-copy" "s2-ddl-add-column" "s1-commit" permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s1-copy-additional-column" "s2-ddl-drop-column" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-copy" "s2-ddl-rename-column" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-copy" "s2-table-size" "s1-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s1-copy" "s2-master-apply-delete-command" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-copy" "s2-master-drop-all-shards" "s1-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s1-copy" "s2-distribute-table" "s1-commit" "s1-select-count" @@ -117,6 +114,5 @@ permutation "s1-initialize" "s1-begin" "s1-ddl-add-column" "s2-copy" "s1-commit" permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s1-ddl-drop-column" "s2-copy" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-ddl-rename-column" "s2-copy" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-table-size" "s2-copy" "s1-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s1-master-apply-delete-command" "s2-copy" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-master-drop-all-shards" "s2-copy" "s1-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s1-distribute-table" "s2-copy" "s1-commit" "s1-select-count" diff --git a/src/test/regress/spec/isolation_drop_shards.spec b/src/test/regress/spec/isolation_drop_shards.spec index 06872c10b..cd83b18a9 100644 --- a/src/test/regress/spec/isolation_drop_shards.spec +++ b/src/test/regress/spec/isolation_drop_shards.spec @@ -25,11 +25,6 @@ step "s1-truncate" TRUNCATE append_table; } -step "s1-apply-delete-command" -{ - SELECT master_apply_delete_command('DELETE FROM append_table'); -} - step "s1-drop-all-shards" { SELECT citus_drop_all_shards('append_table', 'public', 'append_table'); @@ -47,11 +42,6 @@ step "s2-truncate" TRUNCATE append_table; } -step "s2-apply-delete-command" -{ - SELECT master_apply_delete_command('DELETE FROM append_table'); -} - step "s2-drop-all-shards" { SELECT citus_drop_all_shards('append_table', 'public', 'append_table'); @@ -63,18 +53,9 @@ step "s2-select" } permutation "s1-begin" "s1-drop-all-shards" "s2-truncate" "s1-commit" -permutation "s1-begin" "s1-drop-all-shards" "s2-apply-delete-command" "s1-commit" permutation "s1-begin" "s1-drop-all-shards" "s2-drop-all-shards" "s1-commit" permutation "s1-begin" "s1-drop-all-shards" "s2-select" "s1-commit" -// We can't verify master_apply_delete_command + SELECT since it blocks on the -// the workers, but this is not visible on the master, meaning the isolation -// test cannot proceed. -permutation "s1-begin" "s1-apply-delete-command" "s2-truncate" "s1-commit" -permutation "s1-begin" "s1-apply-delete-command" "s2-apply-delete-command" "s1-commit" -permutation "s1-begin" "s1-apply-delete-command" "s2-drop-all-shards" "s1-commit" - permutation "s1-begin" "s1-truncate" "s2-truncate" "s1-commit" -permutation "s1-begin" "s1-truncate" "s2-apply-delete-command" "s1-commit" permutation "s1-begin" "s1-truncate" "s2-drop-all-shards" "s1-commit" permutation "s1-begin" "s1-truncate" "s2-select" "s1-commit" diff --git a/src/test/regress/spec/isolation_master_apply_delete.spec b/src/test/regress/spec/isolation_master_apply_delete.spec deleted file mode 100644 index 7b5f36219..000000000 --- a/src/test/regress/spec/isolation_master_apply_delete.spec +++ /dev/null @@ -1,63 +0,0 @@ -setup -{ - CREATE TABLE table_to_delete_from(id int); - - SELECT create_distributed_table('table_to_delete_from', 'id', 'append'); - - COPY table_to_delete_from FROM PROGRAM 'echo 0 && echo 1 && echo 2 && echo 3 && echo 4 && echo 5 && echo 6 && echo 7 && echo 8 && echo 9 && echo 10'; -} - -teardown -{ - DROP TABLE table_to_delete_from CASCADE; -} - -session "s1" - -step "s1-begin" -{ - BEGIN; -} - -step "s1-master_apply_delete_command_all_shard" -{ - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$); -} - -step "s1-master_apply_delete_command_row" -{ - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$); -} - -step "s1-commit" -{ - COMMIT; -} - -session "s2" - -step "s2-begin" -{ - BEGIN; -} - -step "s2-master_apply_delete_command_all_shard" -{ - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$); -} - -step "s2-master_apply_delete_command_row" -{ - SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$); -} - -step "s2-commit" -{ - COMMIT; -} - -//concurrent master_apply_delete_command vs master_apply_delete_command -permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_all_shard" "s2-master_apply_delete_command_all_shard" "s1-commit" "s2-commit" -permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_all_shard" "s2-master_apply_delete_command_row" "s1-commit" "s2-commit" -permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_row" "s2-master_apply_delete_command_all_shard" "s1-commit" "s2-commit" -permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_row" "s2-master_apply_delete_command_row" "s1-commit" "s2-commit" diff --git a/src/test/regress/spec/isolation_range_copy_vs_all.spec b/src/test/regress/spec/isolation_range_copy_vs_all.spec index 07a45da32..f5b31cc7d 100644 --- a/src/test/regress/spec/isolation_range_copy_vs_all.spec +++ b/src/test/regress/spec/isolation_range_copy_vs_all.spec @@ -42,7 +42,6 @@ step "s1-ddl-drop-column" { ALTER TABLE range_copy DROP new_column; } step "s1-ddl-rename-column" { ALTER TABLE range_copy RENAME data TO new_column; } step "s1-table-size" { SELECT citus_total_relation_size('range_copy'); } step "s1-master-modify-multiple-shards" { DELETE FROM range_copy; } -step "s1-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM range_copy WHERE id <= 4;'); } step "s1-master-drop-all-shards" { SELECT citus_drop_all_shards('range_copy'::regclass, 'public', 'range_copy'); } step "s1-create-non-distributed-table" { CREATE TABLE range_copy(id integer, data text, int_data int); } step "s1-distribute-table" { SELECT create_distributed_table('range_copy', 'id', 'range'); } @@ -76,7 +75,6 @@ step "s2-ddl-drop-column" { ALTER TABLE range_copy DROP new_column; } step "s2-ddl-rename-column" { ALTER TABLE range_copy RENAME data TO new_column; } step "s2-table-size" { SELECT citus_total_relation_size('range_copy'); } step "s2-master-modify-multiple-shards" { DELETE FROM range_copy; } -step "s2-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM range_copy WHERE id <= 4;'); } step "s2-master-drop-all-shards" { SELECT citus_drop_all_shards('range_copy'::regclass, 'public', 'range_copy'); } step "s2-distribute-table" { SELECT create_distributed_table('range_copy', 'id', 'range'); } @@ -101,7 +99,6 @@ permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s1-copy-additional-c permutation "s1-initialize" "s1-begin" "s1-copy" "s2-ddl-rename-column" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-copy" "s2-table-size" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-copy" "s2-master-modify-multiple-shards" "s1-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s1-copy" "s2-master-apply-delete-command" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-copy" "s2-master-drop-all-shards" "s1-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s1-copy" "s2-distribute-table" "s1-commit" "s1-select-count" @@ -122,6 +119,5 @@ permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s1-ddl-drop-column" permutation "s1-initialize" "s1-begin" "s1-ddl-rename-column" "s2-copy" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-table-size" "s2-copy" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-master-modify-multiple-shards" "s2-copy" "s1-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s1-master-apply-delete-command" "s2-copy" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-master-drop-all-shards" "s2-copy" "s1-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s1-distribute-table" "s2-copy" "s1-commit" "s1-select-count" diff --git a/src/test/regress/spec/isolation_select_vs_all.spec b/src/test/regress/spec/isolation_select_vs_all.spec index 9e2a9f558..eade6ff20 100644 --- a/src/test/regress/spec/isolation_select_vs_all.spec +++ b/src/test/regress/spec/isolation_select_vs_all.spec @@ -49,7 +49,6 @@ step "s1-ddl-drop-column" { ALTER TABLE select_append DROP new_column; } step "s1-ddl-rename-column" { ALTER TABLE select_append RENAME data TO new_column; } step "s1-table-size" { SELECT citus_total_relation_size('select_append'); } step "s1-master-modify-multiple-shards" { DELETE FROM select_append; } -step "s1-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM select_append WHERE id <= 4;'); } step "s1-master-drop-all-shards" { SELECT citus_drop_all_shards('select_append'::regclass, 'public', 'append_copy'); } step "s1-create-non-distributed-table" { CREATE TABLE select_append(id integer, data text, int_data int); } step "s1-distribute-table" { SELECT create_distributed_table('select_append', 'id', 'append'); } @@ -81,7 +80,6 @@ step "s2-ddl-drop-column" { ALTER TABLE select_append DROP new_column; } step "s2-ddl-rename-column" { ALTER TABLE select_append RENAME data TO new_column; } step "s2-table-size" { SELECT citus_total_relation_size('select_append'); } step "s2-master-modify-multiple-shards" { DELETE FROM select_append; } -step "s2-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM select_append WHERE id <= 4;'); } step "s2-master-drop-all-shards" { SELECT citus_drop_all_shards('select_append'::regclass, 'public', 'append_copy'); } step "s2-distribute-table" { SELECT create_distributed_table('select_append', 'id', 'append'); } @@ -111,7 +109,6 @@ permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s1-router-select" "s permutation "s1-initialize" "s1-begin" "s1-router-select" "s2-ddl-rename-column" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-router-select" "s2-table-size" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-router-select" "s2-master-modify-multiple-shards" "s1-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s2-master-apply-delete-command" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s2-master-drop-all-shards" "s1-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s1-router-select" "s2-distribute-table" "s1-commit" "s1-select-count" @@ -129,7 +126,6 @@ permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s1-ddl-drop-column" permutation "s1-initialize" "s1-begin" "s1-ddl-rename-column" "s2-router-select" "s1-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s1-table-size" "s2-router-select" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-master-modify-multiple-shards" "s2-router-select" "s1-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s1-master-apply-delete-command" "s1-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s1-master-drop-all-shards" "s1-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s1-distribute-table" "s2-router-select" "s1-commit" "s1-select-count" diff --git a/src/test/regress/spec/isolation_truncate_vs_all.spec b/src/test/regress/spec/isolation_truncate_vs_all.spec index aa69b12b9..0ea190208 100644 --- a/src/test/regress/spec/isolation_truncate_vs_all.spec +++ b/src/test/regress/spec/isolation_truncate_vs_all.spec @@ -34,7 +34,6 @@ step "s1-ddl-drop-column" { ALTER TABLE truncate_append DROP new_column; } step "s1-ddl-rename-column" { ALTER TABLE truncate_append RENAME data TO new_column; } step "s1-table-size" { SELECT citus_total_relation_size('truncate_append'); } step "s1-master-modify-multiple-shards" { DELETE FROM truncate_append; } -step "s1-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM truncate_append WHERE id <= 4;'); } step "s1-master-drop-all-shards" { SELECT citus_drop_all_shards('truncate_append'::regclass, 'public', 'truncate_append'); } step "s1-create-non-distributed-table" { CREATE TABLE truncate_append(id integer, data text); } step "s1-distribute-table" { SELECT create_distributed_table('truncate_append', 'id', 'append'); } @@ -56,7 +55,6 @@ step "s2-ddl-drop-column" { ALTER TABLE truncate_append DROP new_column; } step "s2-ddl-rename-column" { ALTER TABLE truncate_append RENAME data TO new_column; } step "s2-table-size" { SELECT citus_total_relation_size('truncate_append'); } step "s2-master-modify-multiple-shards" { DELETE FROM truncate_append; } -step "s2-master-apply-delete-command" { SELECT master_apply_delete_command('DELETE FROM truncate_append WHERE id <= 4;'); } step "s2-master-drop-all-shards" { SELECT citus_drop_all_shards('truncate_append'::regclass, 'public', 'truncate_append'); } step "s2-distribute-table" { SELECT create_distributed_table('truncate_append', 'id', 'append'); } step "s2-commit" { COMMIT; } @@ -75,7 +73,6 @@ permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s2-begin" "s1-trunca permutation "s1-initialize" "s1-begin" "s2-begin" "s1-truncate" "s2-ddl-rename-column" "s1-commit" "s2-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s2-begin" "s1-truncate" "s2-table-size" "s1-commit" "s2-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s2-begin" "s1-truncate" "s2-master-modify-multiple-shards" "s1-commit" "s2-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s2-begin" "s1-truncate" "s2-master-apply-delete-command" "s1-commit" "s2-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s2-begin" "s1-truncate" "s2-master-drop-all-shards" "s1-commit" "s2-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s2-begin" "s1-truncate" "s2-distribute-table" "s1-commit" "s2-commit" "s1-select-count" @@ -89,6 +86,5 @@ permutation "s1-initialize" "s1-ddl-add-column" "s1-begin" "s2-begin" "s1-ddl-dr permutation "s1-initialize" "s1-begin" "s2-begin" "s1-ddl-rename-column" "s2-truncate" "s1-commit" "s2-commit" "s1-select-count" "s1-show-columns" permutation "s1-initialize" "s1-begin" "s2-begin" "s1-table-size" "s2-truncate" "s1-commit" "s2-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s2-begin" "s1-master-modify-multiple-shards" "s2-truncate" "s1-commit" "s2-commit" "s1-select-count" -permutation "s1-initialize" "s1-begin" "s2-begin" "s1-master-apply-delete-command" "s2-truncate" "s1-commit" "s2-commit" "s1-select-count" permutation "s1-initialize" "s1-begin" "s2-begin" "s1-master-drop-all-shards" "s2-truncate" "s1-commit" "s2-commit" "s1-select-count" permutation "s1-drop" "s1-create-non-distributed-table" "s1-begin" "s2-begin" "s1-distribute-table" "s2-truncate" "s1-commit" "s2-commit" "s1-select-count" diff --git a/src/test/regress/sql/.gitignore b/src/test/regress/sql/.gitignore index b10b2880c..ebe88db6a 100644 --- a/src/test/regress/sql/.gitignore +++ b/src/test/regress/sql/.gitignore @@ -15,7 +15,6 @@ /multi_load_data_superuser.sql /multi_load_large_records.sql /multi_load_more_data.sql -/multi_master_delete_protocol.sql /multi_mx_copy_data.sql /multi_outer_join.sql /multi_outer_join_reference.sql diff --git a/src/test/regress/sql/citus_local_tables.sql b/src/test/regress/sql/citus_local_tables.sql index 7e7f3f30d..fb46befc8 100644 --- a/src/test/regress/sql/citus_local_tables.sql +++ b/src/test/regress/sql/citus_local_tables.sql @@ -458,7 +458,6 @@ ROLLBACK; SELECT update_distributed_table_colocation('citus_local_table_4', colocate_with => 'none'); SELECT master_create_empty_shard('citus_local_table_4'); -SELECT master_apply_delete_command('DELETE FROM citus_local_table_4'); CREATE TABLE postgres_local_table (a int); SELECT master_append_table_to_shard(shardId, 'postgres_local_table', 'localhost', :master_port) diff --git a/src/test/regress/sql/multi_reference_table.sql b/src/test/regress/sql/multi_reference_table.sql index a432730d5..33e3fb570 100644 --- a/src/test/regress/sql/multi_reference_table.sql +++ b/src/test/regress/sql/multi_reference_table.sql @@ -895,9 +895,6 @@ ALTER TABLE reference_schema.reference_table_ddl_test RENAME TO reference_table_ -- now test reference tables against some helper UDFs that Citus provides --- cannot delete / drop shards from a reference table -SELECT master_apply_delete_command('DELETE FROM reference_schema.reference_table_ddl'); - -- cannot add shards SELECT master_create_empty_shard('reference_schema.reference_table_ddl'); diff --git a/src/test/regress/sql/multi_schema_support.sql b/src/test/regress/sql/multi_schema_support.sql index 05843f84d..d4abcabf1 100644 --- a/src/test/regress/sql/multi_schema_support.sql +++ b/src/test/regress/sql/multi_schema_support.sql @@ -509,37 +509,6 @@ SELECT master_copy_shard_placement(1190000, 'localhost', :worker_2_port, 'localh -- verify shardstate SELECT shardstate, nodename, nodeport FROM pg_dist_shard_placement WHERE shardid = 1190000 ORDER BY nodeport; - --- test master_apply_delete_command with schemas -SET search_path TO public; -SELECT master_apply_delete_command('DELETE FROM test_schema_support.nation_append') ; - --- verify shard is dropped -\c - - - :worker_1_port -\d test_schema_support.nation_append_119* - -\c - - - :master_port - --- test with search_path is set -SET search_path TO test_schema_support; - -\copy nation_append FROM STDIN with delimiter '|'; -0|ALGERIA|0| haggle. carefully final deposits detect slyly agai -1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold requests alon -2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special -3|CANADA|1|eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold -4|EGYPT|4|y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d -5|ETHIOPIA|0|ven packages wake quickly. regu -\. - -SELECT master_apply_delete_command('DELETE FROM nation_append') ; - --- verify shard is dropped -\c - - - :worker_1_port -\d test_schema_support.nation_append_119* - -\c - - - :master_port - -- check joins of tables which are in schemas other than public -- we create new tables with replication factor of 1 -- so that we guarantee to have repartitions when necessary diff --git a/src/test/regress/sql/multi_transactional_drop_shards.sql b/src/test/regress/sql/multi_transactional_drop_shards.sql index 5bc651d76..edbce4f13 100644 --- a/src/test/regress/sql/multi_transactional_drop_shards.sql +++ b/src/test/regress/sql/multi_transactional_drop_shards.sql @@ -68,7 +68,7 @@ SELECT create_distributed_table('transactional_drop_shards', 'column1', 'append' SELECT master_create_empty_shard('transactional_drop_shards'); BEGIN; -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); +SELECT citus_drop_all_shards('transactional_drop_shards','',''); ROLLBACK; -- verify metadata is not deleted @@ -90,7 +90,7 @@ ORDER BY -- test master_delete_protocol in transaction, then COMMIT BEGIN; -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); +SELECT citus_drop_all_shards('transactional_drop_shards','',''); COMMIT; -- verify metadata is deleted @@ -138,10 +138,10 @@ ORDER BY \c - - - :master_port --- test master_apply_delete_command in a transaction after insertion +-- test citus_drop_all_shards in a transaction after insertion BEGIN; INSERT INTO transactional_drop_shards VALUES (1); -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); +SELECT citus_drop_all_shards('transactional_drop_shards','',''); ROLLBACK; -- verify metadata is not deleted @@ -223,9 +223,9 @@ ORDER BY \c - - - :master_port --- test master_apply_delete_command table with failing worker +-- test citus_drop_all_shards table with failing worker \set VERBOSITY terse -SELECT master_apply_delete_command('DELETE FROM transactional_drop_shards'); +SELECT citus_drop_all_shards('transactional_drop_shards','',''); \set VERBOSITY default -- verify metadata is not deleted diff --git a/src/test/regress/sql/multi_unsupported_worker_operations.sql b/src/test/regress/sql/multi_unsupported_worker_operations.sql index 94aaa96f2..a59337200 100644 --- a/src/test/regress/sql/multi_unsupported_worker_operations.sql +++ b/src/test/regress/sql/multi_unsupported_worker_operations.sql @@ -118,10 +118,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.mx_tabl SELECT citus_drop_all_shards('mx_table'::regclass, 'public', 'mx_table'); SELECT count(*) FROM pg_dist_shard NATURAL JOIN pg_dist_shard_placement WHERE logicalrelid='mx_table'::regclass; --- master_apply_delete_command -SELECT master_apply_delete_command('DELETE FROM mx_table'); -SELECT count(*) FROM mx_table; - -- master_add_inactive_node SELECT 1 FROM master_add_inactive_node('localhost', 5432); diff --git a/src/test/regress/sql/multi_utilities.sql b/src/test/regress/sql/multi_utilities.sql index 5500fc0bf..2933fdc7a 100644 --- a/src/test/regress/sql/multi_utilities.sql +++ b/src/test/regress/sql/multi_utilities.sql @@ -43,11 +43,8 @@ EXECUTE sharded_query; EXECUTE sharded_delete; EXECUTE sharded_query; --- try to drop shards with where clause -SELECT master_apply_delete_command('DELETE FROM sharded_table WHERE id > 0'); - -- drop all shards -SELECT master_apply_delete_command('DELETE FROM sharded_table'); +SELECT citus_drop_all_shards('sharded_table','',''); SET citus.shard_count TO 4; SET citus.next_shard_id TO 999001; ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1400000;