mirror of https://github.com/citusdata/citus.git
Expose citus_delete_marked_shards to users
master_defer_delete_shards was only used in testing but it seems useful for users as well since we will enable deferring shard deletions by default. The name is changed to citus_delete_marked_shards.expose/defer_marked_shards_API
parent
33c620f232
commit
025612986a
|
@ -20,14 +20,14 @@
|
|||
|
||||
|
||||
/* declarations for dynamic loading */
|
||||
PG_FUNCTION_INFO_V1(master_defer_delete_shards);
|
||||
PG_FUNCTION_INFO_V1(citus_delete_marked_shards);
|
||||
|
||||
|
||||
static int DropMarkedShards(void);
|
||||
|
||||
|
||||
/*
|
||||
* master_defer_delete_shards implements a user-facing UDF to deleter orphaned shards that
|
||||
* citus_delete_marked_shards implements a user-facing UDF to deleter orphaned shards that
|
||||
* are still haning around in the system. These shards are orphaned by previous actions
|
||||
* that were not directly able to delete the placements eg. shard moving or dropping of a
|
||||
* distributed table while one of the data nodes was not online.
|
||||
|
@ -39,7 +39,7 @@ static int DropMarkedShards(void);
|
|||
* The function takes no arguments and runs cluster wide
|
||||
*/
|
||||
Datum
|
||||
master_defer_delete_shards(PG_FUNCTION_ARGS)
|
||||
citus_delete_marked_shards(PG_FUNCTION_ARGS)
|
||||
{
|
||||
CheckCitusVersion(ERROR);
|
||||
EnsureCoordinator();
|
||||
|
|
|
@ -6,3 +6,4 @@
|
|||
#include "udfs/worker_partitioned_relation_size/10.1-1.sql"
|
||||
#include "udfs/worker_partitioned_table_size/10.1-1.sql"
|
||||
#include "udfs/citus_finish_pg_upgrade/10.1-1.sql"
|
||||
#include "udfs/citus_delete_marked_shards/10.1-1.sql"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE FUNCTION citus_delete_marked_shards()
|
||||
RETURNS int
|
||||
LANGUAGE C STRICT
|
||||
AS 'citus', $$citus_delete_marked_shards$$;
|
||||
COMMENT ON FUNCTION citus_delete_marked_shards()
|
||||
IS 'remove orphaned shards';
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE FUNCTION citus_delete_marked_shards()
|
||||
RETURNS int
|
||||
LANGUAGE C STRICT
|
||||
AS 'citus', $$citus_delete_marked_shards$$;
|
||||
COMMENT ON FUNCTION citus_delete_marked_shards()
|
||||
IS 'remove orphaned shards';
|
|
@ -1,9 +1,3 @@
|
|||
CREATE OR REPLACE FUNCTION master_defer_delete_shards()
|
||||
RETURNS int
|
||||
LANGUAGE C STRICT
|
||||
AS 'citus', $$master_defer_delete_shards$$;
|
||||
COMMENT ON FUNCTION master_defer_delete_shards()
|
||||
IS 'remove orphaned shards';
|
||||
CREATE OR REPLACE FUNCTION wait_until_metadata_sync(timeout INTEGER DEFAULT 15000)
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
|
|
|
@ -42,8 +42,8 @@ $cmd$);
|
|||
(2 rows)
|
||||
|
||||
-- execute delayed removal
|
||||
SELECT public.master_defer_delete_shards();
|
||||
master_defer_delete_shards
|
||||
SELECT public.citus_delete_marked_shards();
|
||||
citus_delete_marked_shards
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
(1 row)
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
CREATE OR REPLACE FUNCTION master_defer_delete_shards()
|
||||
RETURNS int
|
||||
LANGUAGE C STRICT
|
||||
AS 'citus', $$master_defer_delete_shards$$;
|
||||
COMMENT ON FUNCTION master_defer_delete_shards()
|
||||
IS 'remove orphaned shards';
|
||||
|
||||
CREATE OR REPLACE FUNCTION wait_until_metadata_sync(timeout INTEGER DEFAULT 15000)
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
|
|
|
@ -28,7 +28,7 @@ SELECT run_command_on_workers($cmd$
|
|||
$cmd$);
|
||||
|
||||
-- execute delayed removal
|
||||
SELECT public.master_defer_delete_shards();
|
||||
SELECT public.citus_delete_marked_shards();
|
||||
|
||||
-- we expect the shard to be on only the second worker
|
||||
SELECT run_command_on_workers($cmd$
|
||||
|
|
Loading…
Reference in New Issue