mirror of https://github.com/citusdata/citus.git
Add stub for Copy shard placement
This commit does not change the current behaviour, but, helps to implement enterprise feature without any version changes.pull/919/head
parent
9969594e10
commit
9cd549f21f
|
@ -8,7 +8,7 @@ EXTENSION = citus
|
||||||
EXTVERSIONS = 5.0 5.0-1 5.0-2 \
|
EXTVERSIONS = 5.0 5.0-1 5.0-2 \
|
||||||
5.1-1 5.1-2 5.1-3 5.1-4 5.1-5 5.1-6 5.1-7 5.1-8 \
|
5.1-1 5.1-2 5.1-3 5.1-4 5.1-5 5.1-6 5.1-7 5.1-8 \
|
||||||
5.2-1 5.2-2 5.2-3 5.2-4 \
|
5.2-1 5.2-2 5.2-3 5.2-4 \
|
||||||
6.0-1 6.0-2 6.0-3 6.0-4 6.0-5 6.0-6 6.0-7 6.0-8 6.0-9 6.0-10 6.0-11 6.0-12 6.0-13 6.0-14 6.0-15 6.0-16
|
6.0-1 6.0-2 6.0-3 6.0-4 6.0-5 6.0-6 6.0-7 6.0-8 6.0-9 6.0-10 6.0-11 6.0-12 6.0-13 6.0-14 6.0-15 6.0-16 6.0-17
|
||||||
|
|
||||||
# All citus--*.sql files in the source directory
|
# All citus--*.sql files in the source directory
|
||||||
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
||||||
|
@ -90,6 +90,8 @@ $(EXTENSION)--6.0-15.sql: $(EXTENSION)--6.0-14.sql $(EXTENSION)--6.0-14--6.0-15.
|
||||||
cat $^ > $@
|
cat $^ > $@
|
||||||
$(EXTENSION)--6.0-16.sql: $(EXTENSION)--6.0-15.sql $(EXTENSION)--6.0-15--6.0-16.sql
|
$(EXTENSION)--6.0-16.sql: $(EXTENSION)--6.0-15.sql $(EXTENSION)--6.0-15--6.0-16.sql
|
||||||
cat $^ > $@
|
cat $^ > $@
|
||||||
|
$(EXTENSION)--6.0-17.sql: $(EXTENSION)--6.0-16.sql $(EXTENSION)--6.0-16--6.0-17.sql
|
||||||
|
cat $^ > $@
|
||||||
|
|
||||||
NO_PGXS = 1
|
NO_PGXS = 1
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* citus--6.0-16--6.0-17.sql */
|
||||||
|
|
||||||
|
SET search_path = 'pg_catalog';
|
||||||
|
|
||||||
|
DROP FUNCTION pg_catalog.master_copy_shard_placement(bigint, text, integer, text, integer);
|
||||||
|
|
||||||
|
CREATE FUNCTION pg_catalog.master_copy_shard_placement(shard_id bigint,
|
||||||
|
source_node_name text,
|
||||||
|
source_node_port integer,
|
||||||
|
target_node_name text,
|
||||||
|
target_node_port integer,
|
||||||
|
do_repair bool DEFAULT true)
|
||||||
|
RETURNS void
|
||||||
|
LANGUAGE C STRICT
|
||||||
|
AS 'citus', $$master_copy_shard_placement$$;
|
||||||
|
COMMENT ON FUNCTION pg_catalog.master_copy_shard_placement(shard_id bigint,
|
||||||
|
source_node_name text,
|
||||||
|
source_node_port integer,
|
||||||
|
target_node_name text,
|
||||||
|
target_node_port integer,
|
||||||
|
do_repair bool)
|
||||||
|
IS 'copy shard from remote node';
|
||||||
|
|
||||||
|
RESET search_path;
|
|
@ -1,6 +1,6 @@
|
||||||
# Citus extension
|
# Citus extension
|
||||||
comment = 'Citus distributed database'
|
comment = 'Citus distributed database'
|
||||||
default_version = '6.0-16'
|
default_version = '6.0-17'
|
||||||
module_pathname = '$libdir/citus'
|
module_pathname = '$libdir/citus'
|
||||||
relocatable = false
|
relocatable = false
|
||||||
schema = pg_catalog
|
schema = pg_catalog
|
||||||
|
|
|
@ -77,10 +77,19 @@ master_copy_shard_placement(PG_FUNCTION_ARGS)
|
||||||
int32 sourceNodePort = PG_GETARG_INT32(2);
|
int32 sourceNodePort = PG_GETARG_INT32(2);
|
||||||
text *targetNodeNameText = PG_GETARG_TEXT_P(3);
|
text *targetNodeNameText = PG_GETARG_TEXT_P(3);
|
||||||
int32 targetNodePort = PG_GETARG_INT32(4);
|
int32 targetNodePort = PG_GETARG_INT32(4);
|
||||||
|
bool doRepair = PG_GETARG_BOOL(5);
|
||||||
|
|
||||||
char *sourceNodeName = text_to_cstring(sourceNodeNameText);
|
char *sourceNodeName = text_to_cstring(sourceNodeNameText);
|
||||||
char *targetNodeName = text_to_cstring(targetNodeNameText);
|
char *targetNodeName = text_to_cstring(targetNodeNameText);
|
||||||
|
|
||||||
|
if (!doRepair)
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("master_copy_shard_placement() "
|
||||||
|
"with do not repair functionality "
|
||||||
|
"is only supported on Citus Enterprise")));
|
||||||
|
}
|
||||||
|
|
||||||
/* RepairShardPlacement function repairs only given shard */
|
/* RepairShardPlacement function repairs only given shard */
|
||||||
RepairShardPlacement(shardId, sourceNodeName, sourceNodePort, targetNodeName,
|
RepairShardPlacement(shardId, sourceNodeName, sourceNodePort, targetNodeName,
|
||||||
targetNodePort);
|
targetNodePort);
|
||||||
|
|
|
@ -56,6 +56,7 @@ ALTER EXTENSION citus UPDATE TO '6.0-13';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.0-14';
|
ALTER EXTENSION citus UPDATE TO '6.0-14';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.0-15';
|
ALTER EXTENSION citus UPDATE TO '6.0-15';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.0-16';
|
ALTER EXTENSION citus UPDATE TO '6.0-16';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '6.0-17';
|
||||||
-- ensure no objects were created outside pg_catalog
|
-- ensure no objects were created outside pg_catalog
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM pg_depend AS pgd,
|
FROM pg_depend AS pgd,
|
||||||
|
|
|
@ -56,6 +56,7 @@ ALTER EXTENSION citus UPDATE TO '6.0-13';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.0-14';
|
ALTER EXTENSION citus UPDATE TO '6.0-14';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.0-15';
|
ALTER EXTENSION citus UPDATE TO '6.0-15';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.0-16';
|
ALTER EXTENSION citus UPDATE TO '6.0-16';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '6.0-17';
|
||||||
|
|
||||||
-- ensure no objects were created outside pg_catalog
|
-- ensure no objects were created outside pg_catalog
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
|
|
Loading…
Reference in New Issue