mirror of https://github.com/citusdata/citus.git
Merge pull request #4437 from citusdata/marcocitus/collapse-7
Collapse Citus 7.* scripts into Citus 8.0-1pull/4438/head^2
commit
dca83e5938
|
@ -1,9 +0,0 @@
|
|||
-- citus--7.0-1--7.0-2.sql
|
||||
|
||||
-- redefine shard_name as STRICT
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.shard_name(object_name regclass, shard_id bigint)
|
||||
RETURNS text
|
||||
LANGUAGE C STABLE STRICT
|
||||
AS 'MODULE_PATHNAME', $$shard_name$$;
|
||||
COMMENT ON FUNCTION pg_catalog.shard_name(object_name regclass, shard_id bigint)
|
||||
IS 'returns schema-qualified, shard-extended identifier of object name';
|
|
@ -1,30 +0,0 @@
|
|||
-- citus-7.0-10--7.0-11
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
||||
RETURNS VOID AS $$
|
||||
DECLARE
|
||||
colocated_tables regclass[];
|
||||
BEGIN
|
||||
SELECT get_colocated_table_array(relation) INTO colocated_tables;
|
||||
|
||||
PERFORM
|
||||
master_update_shard_statistics(shardid)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
logicalrelid = ANY (colocated_tables);
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
COMMENT ON FUNCTION master_update_table_statistics(regclass)
|
||||
IS 'updates shard statistics of the given table and its colocated tables';
|
||||
|
||||
CREATE OR REPLACE FUNCTION get_colocated_shard_array(bigint)
|
||||
RETURNS BIGINT[]
|
||||
LANGUAGE C STRICT
|
||||
AS 'citus', $$get_colocated_shard_array$$;
|
||||
COMMENT ON FUNCTION get_colocated_shard_array(bigint)
|
||||
IS 'returns the array of colocated shards of the given shard';
|
||||
|
||||
RESET search_path;
|
|
@ -1,8 +0,0 @@
|
|||
-- citus--7.0-11--7.0-12.sql
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.citus_create_restore_point(text)
|
||||
RETURNS pg_lsn
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_create_restore_point$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_create_restore_point(text)
|
||||
IS 'temporarily block writes and create a named restore point on all nodes';
|
|
@ -1,47 +0,0 @@
|
|||
-- citus--7.0-12--7.0-13.sql
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.citus_drop_trigger()
|
||||
RETURNS event_trigger
|
||||
LANGUAGE plpgsql
|
||||
SECURITY DEFINER
|
||||
SET search_path = pg_catalog
|
||||
AS $cdbdt$
|
||||
DECLARE
|
||||
v_obj record;
|
||||
sequence_names text[] := '{}';
|
||||
table_colocation_id integer;
|
||||
propagate_drop boolean := false;
|
||||
BEGIN
|
||||
-- collect set of dropped sequences to drop on workers later
|
||||
SELECT array_agg(object_identity) INTO sequence_names
|
||||
FROM pg_event_trigger_dropped_objects()
|
||||
WHERE object_type = 'sequence';
|
||||
|
||||
FOR v_obj IN SELECT * FROM pg_event_trigger_dropped_objects() JOIN
|
||||
pg_dist_partition ON (logicalrelid = objid)
|
||||
WHERE object_type IN ('table', 'foreign table')
|
||||
LOOP
|
||||
-- get colocation group
|
||||
SELECT colocationid INTO table_colocation_id FROM pg_dist_partition WHERE logicalrelid = v_obj.objid;
|
||||
|
||||
-- ensure all shards are dropped
|
||||
PERFORM master_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name);
|
||||
|
||||
PERFORM master_drop_distributed_table_metadata(v_obj.objid, v_obj.schema_name, v_obj.object_name);
|
||||
END LOOP;
|
||||
|
||||
IF cardinality(sequence_names) = 0 THEN
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
PERFORM master_drop_sequences(sequence_names);
|
||||
END;
|
||||
$cdbdt$;
|
||||
|
||||
COMMENT ON FUNCTION citus_drop_trigger()
|
||||
IS 'perform checks and actions at the end of DROP actions';
|
||||
|
||||
RESET search_path;
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
-- citus--7.0-13--7.0-14.sql
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE OR REPLACE FUNCTION check_distributed_deadlocks()
|
||||
RETURNS BOOL
|
||||
LANGUAGE 'c' STRICT
|
||||
AS $$MODULE_PATHNAME$$, $$check_distributed_deadlocks$$;
|
||||
COMMENT ON FUNCTION check_distributed_deadlocks()
|
||||
IS 'does a distributed deadlock check, if a deadlock found cancels one of the participating backends and returns true ';
|
||||
|
||||
RESET search_path;
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
-- citus--7.0-14--7.0-15
|
||||
|
||||
DROP FUNCTION pg_catalog.dump_local_wait_edges(int4);
|
||||
|
||||
CREATE FUNCTION pg_catalog.dump_local_wait_edges(
|
||||
OUT waiting_pid int4,
|
||||
OUT waiting_node_id int4,
|
||||
OUT waiting_transaction_num int8,
|
||||
OUT waiting_transaction_stamp timestamptz,
|
||||
OUT blocking_pid int4,
|
||||
OUT blocking_node_id int4,
|
||||
OUT blocking_transaction_num int8,
|
||||
OUT blocking_transaction_stamp timestamptz,
|
||||
OUT blocking_transaction_waiting bool)
|
||||
RETURNS SETOF RECORD
|
||||
LANGUAGE C STRICT
|
||||
AS $$MODULE_PATHNAME$$, $$dump_local_wait_edges$$;
|
||||
COMMENT ON FUNCTION pg_catalog.dump_local_wait_edges()
|
||||
IS 'returns all local lock wait chains, that start from distributed transactions';
|
|
@ -1,14 +0,0 @@
|
|||
-- citus--7.0-15--7.1-1
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE OR REPLACE FUNCTION master_update_node(node_id int,
|
||||
new_node_name text,
|
||||
new_node_port int)
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$master_update_node$$;
|
||||
COMMENT ON FUNCTION master_update_node(node_id int, new_node_name text, new_node_port int)
|
||||
IS 'change the location of a node';
|
||||
|
||||
RESET search_path;
|
|
@ -1,97 +0,0 @@
|
|||
-- citus--7.0-2--7.0-3.sql
|
||||
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shard_placement_placementid_seq
|
||||
RENAME TO pg_dist_placement_placementid_seq;
|
||||
|
||||
ALTER TABLE pg_catalog.pg_dist_shard_placement
|
||||
ALTER COLUMN placementid SET DEFAULT nextval('pg_catalog.pg_dist_placement_placementid_seq');
|
||||
|
||||
CREATE TABLE citus.pg_dist_placement (
|
||||
placementid BIGINT NOT NULL default nextval('pg_dist_placement_placementid_seq'::regclass),
|
||||
shardid BIGINT NOT NULL,
|
||||
shardstate INT NOT NULL,
|
||||
shardlength BIGINT NOT NULL,
|
||||
groupid INT NOT NULL
|
||||
);
|
||||
ALTER TABLE citus.pg_dist_placement SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.pg_dist_placement TO public;
|
||||
|
||||
CREATE INDEX pg_dist_placement_groupid_index
|
||||
ON pg_dist_placement USING btree(groupid);
|
||||
|
||||
CREATE INDEX pg_dist_placement_shardid_index
|
||||
ON pg_dist_placement USING btree(shardid);
|
||||
|
||||
CREATE UNIQUE INDEX pg_dist_placement_placementid_index
|
||||
ON pg_dist_placement USING btree(placementid);
|
||||
|
||||
CREATE OR REPLACE FUNCTION citus.find_groupid_for_node(text, int)
|
||||
RETURNS int AS $$
|
||||
DECLARE
|
||||
groupid int := (SELECT groupid FROM pg_dist_node WHERE nodename = $1 AND nodeport = $2);
|
||||
BEGIN
|
||||
IF groupid IS NULL THEN
|
||||
RAISE EXCEPTION 'There is no node at "%:%"', $1, $2;
|
||||
ELSE
|
||||
RETURN groupid;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
INSERT INTO pg_catalog.pg_dist_placement
|
||||
SELECT placementid, shardid, shardstate, shardlength,
|
||||
citus.find_groupid_for_node(placement.nodename, placement.nodeport::int) AS groupid
|
||||
FROM pg_dist_shard_placement placement;
|
||||
|
||||
DROP TRIGGER dist_placement_cache_invalidate ON pg_catalog.pg_dist_shard_placement;
|
||||
CREATE TRIGGER dist_placement_cache_invalidate
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON pg_catalog.pg_dist_placement
|
||||
FOR EACH ROW EXECUTE PROCEDURE master_dist_placement_cache_invalidate();
|
||||
|
||||
-- this should be removed when noderole is added but for now it ensures the below view
|
||||
-- returns the correct results and that placements unambiguously belong to a view
|
||||
ALTER TABLE pg_catalog.pg_dist_node ADD CONSTRAINT pg_dist_node_groupid_unique
|
||||
UNIQUE (groupid);
|
||||
|
||||
DROP TABLE pg_dist_shard_placement;
|
||||
CREATE VIEW citus.pg_dist_shard_placement AS
|
||||
SELECT shardid, shardstate, shardlength, nodename, nodeport, placementid
|
||||
-- assumes there's only one node per group
|
||||
FROM pg_dist_placement placement INNER JOIN pg_dist_node node ON (
|
||||
placement.groupid = node.groupid
|
||||
);
|
||||
ALTER VIEW citus.pg_dist_shard_placement SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.pg_dist_shard_placement TO public;
|
||||
|
||||
-- add some triggers which make it look like pg_dist_shard_placement is still a table
|
||||
|
||||
ALTER VIEW pg_catalog.pg_dist_shard_placement
|
||||
ALTER placementid SET DEFAULT nextval('pg_dist_placement_placementid_seq');
|
||||
|
||||
CREATE OR REPLACE FUNCTION citus.pg_dist_shard_placement_trigger_func()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'DELETE') THEN
|
||||
DELETE FROM pg_dist_placement WHERE placementid = OLD.placementid;
|
||||
RETURN OLD;
|
||||
ELSIF (TG_OP = 'UPDATE') THEN
|
||||
UPDATE pg_dist_placement
|
||||
SET shardid = NEW.shardid, shardstate = NEW.shardstate,
|
||||
shardlength = NEW.shardlength, placementid = NEW.placementid,
|
||||
groupid = citus.find_groupid_for_node(NEW.nodename, NEW.nodeport)
|
||||
WHERE placementid = OLD.placementid;
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO pg_dist_placement
|
||||
(placementid, shardid, shardstate, shardlength, groupid)
|
||||
VALUES (NEW.placementid, NEW.shardid, NEW.shardstate, NEW.shardlength,
|
||||
citus.find_groupid_for_node(NEW.nodename, NEW.nodeport));
|
||||
RETURN NEW;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER pg_dist_shard_placement_trigger
|
||||
INSTEAD OF INSERT OR UPDATE OR DELETE ON pg_dist_shard_placement
|
||||
FOR EACH ROW EXECUTE PROCEDURE citus.pg_dist_shard_placement_trigger_func();
|
|
@ -1,26 +0,0 @@
|
|||
-- citus--7.0-3--7.0-4.sql
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE FUNCTION assign_distributed_transaction_id(initiator_node_identifier int4, transaction_number int8, transaction_stamp timestamptz)
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME',$$assign_distributed_transaction_id$$;
|
||||
COMMENT ON FUNCTION assign_distributed_transaction_id(initiator_node_identifier int4, transaction_number int8, transaction_stamp timestamptz)
|
||||
IS 'Only intended for internal use, users should not call this. The function sets the distributed transaction id';
|
||||
|
||||
CREATE OR REPLACE FUNCTION get_current_transaction_id(OUT database_id oid, OUT process_id int, OUT initiator_node_identifier int4, OUT transaction_number int8, OUT transaction_stamp timestamptz)
|
||||
RETURNS RECORD
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME',$$get_current_transaction_id$$;
|
||||
COMMENT ON FUNCTION get_current_transaction_id(OUT database_id oid, OUT process_id int, OUT initiator_node_identifier int4, OUT transaction_number int8, OUT transaction_stamp timestamptz)
|
||||
IS 'returns the current backend data including distributed transaction id';
|
||||
|
||||
CREATE OR REPLACE FUNCTION get_all_active_transactions(OUT database_id oid, OUT process_id int, OUT initiator_node_identifier int4, OUT transaction_number int8, OUT transaction_stamp timestamptz)
|
||||
RETURNS SETOF RECORD
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$get_all_active_transactions$$;
|
||||
COMMENT ON FUNCTION get_all_active_transactions(OUT database_id oid, OUT process_id int, OUT initiator_node_identifier int4, OUT transaction_number int8, OUT transaction_stamp timestamptz)
|
||||
IS 'returns distributed transaction ids of active distributed transactions';
|
||||
|
||||
RESET search_path;
|
|
@ -1,98 +0,0 @@
|
|||
-- citus--7.0-4--7.0-5.sql
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE TYPE pg_catalog.noderole AS ENUM (
|
||||
'primary', -- node is available and accepting writes
|
||||
'secondary', -- node is available but only accepts reads
|
||||
'unavailable' -- node is in recovery or otherwise not usable
|
||||
-- adding new values to a type inside of a transaction (such as during an ALTER EXTENSION
|
||||
-- citus UPDATE) isn't allowed in PG 9.6, and only allowed in PG10 if you don't use the
|
||||
-- new values inside of the same transaction. You might need to replace this type with a
|
||||
-- new one and then change the column type in pg_dist_node. There's a list of
|
||||
-- alternatives here:
|
||||
-- https://stackoverflow.com/questions/1771543/postgresql-updating-an-enum-type/41696273
|
||||
);
|
||||
|
||||
ALTER TABLE pg_dist_node ADD COLUMN noderole noderole NOT NULL DEFAULT 'primary';
|
||||
|
||||
-- we're now allowed to have more than one node per group
|
||||
ALTER TABLE pg_catalog.pg_dist_node DROP CONSTRAINT pg_dist_node_groupid_unique;
|
||||
|
||||
-- so make sure pg_dist_shard_placement only returns writable placements
|
||||
CREATE OR REPLACE VIEW pg_catalog.pg_dist_shard_placement AS
|
||||
SELECT shardid, shardstate, shardlength, nodename, nodeport, placementid
|
||||
FROM pg_dist_placement placement INNER JOIN pg_dist_node node ON (
|
||||
placement.groupid = node.groupid AND node.noderole = 'primary'
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION citus.pg_dist_node_trigger_func()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
-- AddNodeMetadata also takes out a ShareRowExclusiveLock
|
||||
LOCK TABLE pg_dist_node IN SHARE ROW EXCLUSIVE MODE;
|
||||
IF (TG_OP = 'INSERT') THEN
|
||||
IF NEW.noderole = 'primary'
|
||||
AND EXISTS (SELECT 1 FROM pg_dist_node WHERE groupid = NEW.groupid AND
|
||||
noderole = 'primary' AND
|
||||
nodeid <> NEW.nodeid) THEN
|
||||
RAISE EXCEPTION 'there cannot be two primary nodes in a group';
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'UPDATE') THEN
|
||||
IF NEW.noderole = 'primary'
|
||||
AND EXISTS (SELECT 1 FROM pg_dist_node WHERE groupid = NEW.groupid AND
|
||||
noderole = 'primary' AND
|
||||
nodeid <> NEW.nodeid) THEN
|
||||
RAISE EXCEPTION 'there cannot be two primary nodes in a group';
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER pg_dist_node_trigger
|
||||
BEFORE INSERT OR UPDATE ON pg_dist_node
|
||||
FOR EACH ROW EXECUTE PROCEDURE citus.pg_dist_node_trigger_func();
|
||||
|
||||
DROP FUNCTION master_add_node(text, integer);
|
||||
CREATE FUNCTION master_add_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer default 0,
|
||||
noderole noderole default 'primary',
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$master_add_node$$;
|
||||
COMMENT ON FUNCTION master_add_node(nodename text, nodeport integer,
|
||||
groupid integer, noderole noderole)
|
||||
IS 'add node to the cluster';
|
||||
|
||||
DROP FUNCTION master_add_inactive_node(text, integer);
|
||||
CREATE FUNCTION master_add_inactive_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer default 0,
|
||||
noderole noderole default 'primary',
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME',$$master_add_inactive_node$$;
|
||||
COMMENT ON FUNCTION master_add_inactive_node(nodename text,nodeport integer,
|
||||
groupid integer, noderole noderole)
|
||||
IS 'prepare node by adding it to pg_dist_node';
|
||||
|
||||
RESET search_path;
|
|
@ -1,34 +0,0 @@
|
|||
-- citus--7.0-5--7.0-6
|
||||
|
||||
CREATE FUNCTION pg_catalog.dump_local_wait_edges(
|
||||
IN source_node_id int4,
|
||||
OUT waiting_pid int4,
|
||||
OUT waiting_node_id int4,
|
||||
OUT waiting_transaction_num int8,
|
||||
OUT waiting_transaction_stamp timestamptz,
|
||||
OUT blocking_pid int4,
|
||||
OUT blocking_node_id int4,
|
||||
OUT blocking_transaction_num int8,
|
||||
OUT blocking_transaction_stamp timestamptz,
|
||||
OUT blocking_transaction_waiting bool)
|
||||
RETURNS SETOF RECORD
|
||||
LANGUAGE 'c' STRICT
|
||||
AS $$MODULE_PATHNAME$$, $$dump_local_wait_edges$$;
|
||||
COMMENT ON FUNCTION pg_catalog.dump_local_wait_edges(int)
|
||||
IS 'returns a local list of blocked transactions originating from source_node_id';
|
||||
|
||||
CREATE FUNCTION pg_catalog.dump_global_wait_edges(
|
||||
OUT waiting_pid int4,
|
||||
OUT waiting_node_id int4,
|
||||
OUT waiting_transaction_num int8,
|
||||
OUT waiting_transaction_stamp timestamptz,
|
||||
OUT blocking_pid int4,
|
||||
OUT blocking_node_id int4,
|
||||
OUT blocking_transaction_num int8,
|
||||
OUT blocking_transaction_stamp timestamptz,
|
||||
OUT blocking_transaction_waiting bool)
|
||||
RETURNS SETOF RECORD
|
||||
LANGUAGE 'c' STRICT
|
||||
AS $$MODULE_PATHNAME$$, $$dump_global_wait_edges$$;
|
||||
COMMENT ON FUNCTION pg_catalog.dump_global_wait_edges()
|
||||
IS 'returns a global list of blocked transactions originating from this node';
|
|
@ -1,103 +0,0 @@
|
|||
-- citus--7.0-6--7.0-7
|
||||
|
||||
CREATE FUNCTION citus.replace_isolation_tester_func()
|
||||
RETURNS void AS $$
|
||||
DECLARE
|
||||
version integer := current_setting('server_version_num');
|
||||
BEGIN
|
||||
IF version >= 100000 THEN
|
||||
ALTER FUNCTION pg_catalog.pg_isolation_test_session_is_blocked(integer, integer[])
|
||||
RENAME TO old_pg_isolation_test_session_is_blocked;
|
||||
ALTER FUNCTION pg_catalog.citus_isolation_test_session_is_blocked(integer, integer[])
|
||||
RENAME TO pg_isolation_test_session_is_blocked;
|
||||
ELSE
|
||||
ALTER FUNCTION pg_catalog.pg_blocking_pids(integer)
|
||||
RENAME TO old_pg_blocking_pids;
|
||||
ALTER FUNCTION pg_catalog.citus_blocking_pids(integer)
|
||||
RENAME TO pg_blocking_pids;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE FUNCTION citus.restore_isolation_tester_func()
|
||||
RETURNS void AS $$
|
||||
DECLARE
|
||||
version integer := current_setting('server_version_num');
|
||||
BEGIN
|
||||
IF version >= 100000 THEN
|
||||
ALTER FUNCTION pg_catalog.pg_isolation_test_session_is_blocked(integer, integer[])
|
||||
RENAME TO citus_isolation_test_session_is_blocked;
|
||||
ALTER FUNCTION pg_catalog.old_pg_isolation_test_session_is_blocked(integer, integer[])
|
||||
RENAME TO pg_isolation_test_session_is_blocked;
|
||||
ELSE
|
||||
ALTER FUNCTION pg_catalog.pg_blocking_pids(integer)
|
||||
RENAME TO citus_blocking_pids;
|
||||
ALTER FUNCTION pg_catalog.old_pg_blocking_pids(integer)
|
||||
RENAME TO pg_blocking_pids;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE FUNCTION citus.refresh_isolation_tester_prepared_statement()
|
||||
RETURNS void AS $$
|
||||
BEGIN
|
||||
-- isolation creates a prepared statement using the old function before tests have a
|
||||
-- chance to call replace_isolation_tester_func. By calling that prepared statement
|
||||
-- with a different search_path we force a re-parse which picks up the new function
|
||||
SET search_path TO 'citus';
|
||||
EXECUTE 'EXECUTE isolationtester_waiting (0)';
|
||||
RESET search_path;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_blocking_pids(pBlockedPid integer)
|
||||
RETURNS int4[] AS $$
|
||||
DECLARE
|
||||
mLocalBlockingPids int4[];
|
||||
mRemoteBlockingPids int4[];
|
||||
mLocalTransactionNum int8;
|
||||
BEGIN
|
||||
SELECT pg_catalog.old_pg_blocking_pids(pBlockedPid) INTO mLocalBlockingPids;
|
||||
|
||||
IF (array_length(mLocalBlockingPids, 1) > 0) THEN
|
||||
RETURN mLocalBlockingPids;
|
||||
END IF;
|
||||
|
||||
-- pg says we're not blocked locally; check whether we're blocked globally.
|
||||
SELECT transaction_number INTO mLocalTransactionNum
|
||||
FROM get_all_active_transactions() WHERE process_id = pBlockedPid;
|
||||
|
||||
SELECT array_agg(process_id) INTO mRemoteBlockingPids FROM (
|
||||
WITH activeTransactions AS (
|
||||
SELECT process_id, transaction_number FROM get_all_active_transactions()
|
||||
), blockingTransactions AS (
|
||||
SELECT blocking_transaction_num AS txn_num FROM dump_global_wait_edges()
|
||||
WHERE waiting_transaction_num = mLocalTransactionNum
|
||||
)
|
||||
SELECT activeTransactions.process_id FROM activeTransactions, blockingTransactions
|
||||
WHERE activeTransactions.transaction_number = blockingTransactions.txn_num
|
||||
) AS sub;
|
||||
|
||||
RETURN mRemoteBlockingPids;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_isolation_test_session_is_blocked(pBlockedPid integer, pInterestingPids integer[])
|
||||
RETURNS boolean AS $$
|
||||
DECLARE
|
||||
mBlockedTransactionNum int8;
|
||||
BEGIN
|
||||
IF pg_catalog.old_pg_isolation_test_session_is_blocked(pBlockedPid, pInterestingPids) THEN
|
||||
RETURN true;
|
||||
END IF;
|
||||
|
||||
-- pg says we're not blocked locally; check whether we're blocked globally.
|
||||
SELECT transaction_number INTO mBlockedTransactionNum
|
||||
FROM get_all_active_transactions() WHERE process_id = pBlockedPid;
|
||||
|
||||
RETURN EXISTS (
|
||||
SELECT 1 FROM dump_global_wait_edges()
|
||||
WHERE waiting_transaction_num = mBlockedTransactionNum
|
||||
);
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
|
@ -1,22 +0,0 @@
|
|||
-- citus--7.0-7--7.0-8.sql
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
DROP FUNCTION master_activate_node(text, integer);
|
||||
CREATE FUNCTION master_activate_node(nodename text,
|
||||
nodeport integer,
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME',$$master_activate_node$$;
|
||||
COMMENT ON FUNCTION master_activate_node(nodename text, nodeport integer)
|
||||
IS 'activate a node which is in the cluster';
|
||||
|
||||
RESET search_path;
|
|
@ -1,73 +0,0 @@
|
|||
-- citus-7.0-8--7.0-9
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
ALTER TABLE pg_dist_node ADD COLUMN nodecluster name NOT NULL DEFAULT 'default';
|
||||
ALTER TABLE pg_dist_node
|
||||
ADD CONSTRAINT primaries_are_only_allowed_in_the_default_cluster
|
||||
CHECK (NOT (nodecluster <> 'default' AND noderole = 'primary'));
|
||||
|
||||
DROP FUNCTION master_add_node(text, integer, integer, noderole);
|
||||
CREATE FUNCTION master_add_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer default 0,
|
||||
noderole noderole default 'primary',
|
||||
nodecluster name default 'default',
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole,
|
||||
OUT nodecluster name)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$master_add_node$$;
|
||||
COMMENT ON FUNCTION master_add_node(nodename text, nodeport integer,
|
||||
groupid integer, noderole noderole, nodecluster name)
|
||||
IS 'add node to the cluster';
|
||||
|
||||
DROP FUNCTION master_add_inactive_node(text, integer, integer, noderole);
|
||||
CREATE FUNCTION master_add_inactive_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer default 0,
|
||||
noderole noderole default 'primary',
|
||||
nodecluster name default 'default',
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole,
|
||||
OUT nodecluster name)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME',$$master_add_inactive_node$$;
|
||||
COMMENT ON FUNCTION master_add_inactive_node(nodename text,nodeport integer,
|
||||
groupid integer, noderole noderole,
|
||||
nodecluster name)
|
||||
IS 'prepare node by adding it to pg_dist_node';
|
||||
|
||||
DROP FUNCTION master_activate_node(text, integer);
|
||||
CREATE FUNCTION master_activate_node(nodename text,
|
||||
nodeport integer,
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole,
|
||||
OUT nodecluster name)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME',$$master_activate_node$$;
|
||||
COMMENT ON FUNCTION master_activate_node(nodename text, nodeport integer)
|
||||
IS 'activate a node which is in the cluster';
|
||||
|
||||
RESET search_path;
|
|
@ -1,27 +0,0 @@
|
|||
-- citus-7.0-9--7.0-10
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE FUNCTION master_add_secondary_node(nodename text,
|
||||
nodeport integer,
|
||||
primaryname text,
|
||||
primaryport integer,
|
||||
nodecluster name default 'default',
|
||||
OUT nodeid integer,
|
||||
OUT groupid integer,
|
||||
OUT nodename text,
|
||||
OUT nodeport integer,
|
||||
OUT noderack text,
|
||||
OUT hasmetadata boolean,
|
||||
OUT isactive bool,
|
||||
OUT noderole noderole,
|
||||
OUT nodecluster name)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$master_add_secondary_node$$;
|
||||
COMMENT ON FUNCTION master_add_secondary_node(nodename text, nodeport integer,
|
||||
primaryname text, primaryport integer,
|
||||
nodecluster name)
|
||||
IS 'add a secondary node to the cluster';
|
||||
|
||||
RESET search_path;
|
|
@ -1,8 +0,0 @@
|
|||
-- citus--7.1-1--7.1-2
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.citus_version()
|
||||
RETURNS text
|
||||
LANGUAGE C STABLE STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_version$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_version()
|
||||
IS 'Citus version string';
|
|
@ -1,17 +0,0 @@
|
|||
-- citus--7.1-2--7.1-3
|
||||
|
||||
CREATE TABLE citus.pg_dist_node_metadata(
|
||||
metadata jsonb NOT NULL
|
||||
);
|
||||
ALTER TABLE citus.pg_dist_node_metadata SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.pg_dist_node_metadata TO public;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_server_id()
|
||||
RETURNS uuid
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_server_id$$;
|
||||
COMMENT ON FUNCTION citus_server_id()
|
||||
IS 'generates a random UUID to be used as server identifier';
|
||||
|
||||
INSERT INTO pg_dist_node_metadata
|
||||
VALUES (jsonb_build_object('server_id', citus_server_id()::text));
|
|
@ -1,54 +0,0 @@
|
|||
-- citus--7.1-3--7.1-4
|
||||
|
||||
CREATE TYPE citus.shard_transfer_mode AS ENUM (
|
||||
'auto',
|
||||
'force_logical',
|
||||
'block_writes'
|
||||
);
|
||||
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
DROP FUNCTION master_move_shard_placement(bigint, text, integer, text, integer);
|
||||
DROP FUNCTION master_copy_shard_placement(bigint, text, integer, text, integer, bool);
|
||||
|
||||
CREATE OR REPLACE FUNCTION master_move_shard_placement(
|
||||
shard_id bigint,
|
||||
source_node_name text,
|
||||
source_node_port integer,
|
||||
target_node_name text,
|
||||
target_node_port integer,
|
||||
shard_transfer_mode citus.shard_transfer_mode default 'auto')
|
||||
RETURNS void LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$master_move_shard_placement$$;
|
||||
|
||||
COMMENT ON FUNCTION master_move_shard_placement(
|
||||
shard_id bigint,
|
||||
source_node_name text,
|
||||
source_node_port integer,
|
||||
target_node_name text,
|
||||
target_node_port integer,
|
||||
shard_transfer_mode citus.shard_transfer_mode)
|
||||
IS 'move a shard from a the source node to the destination node';
|
||||
|
||||
CREATE FUNCTION 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,
|
||||
transfer_mode citus.shard_transfer_mode default 'auto')
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$master_copy_shard_placement$$;
|
||||
|
||||
COMMENT ON FUNCTION 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,
|
||||
shard_transfer_mode citus.shard_transfer_mode)
|
||||
IS 'copy a shard from the source node to the destination node';
|
||||
|
||||
RESET search_path;
|
|
@ -1,4 +0,0 @@
|
|||
-- citus--7.1-4--7.2-1
|
||||
|
||||
-- bump version to 7.2-1
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
-- citus--7.2-1--7.2-2
|
||||
|
||||
CREATE TYPE citus.copy_format AS ENUM ('csv', 'binary', 'text');
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.read_intermediate_result(result_id text, format citus.copy_format default 'csv')
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT VOLATILE PARALLEL SAFE
|
||||
AS 'MODULE_PATHNAME', $$read_intermediate_result$$;
|
||||
COMMENT ON FUNCTION pg_catalog.read_intermediate_result(text,citus.copy_format)
|
||||
IS 'read a file and return it as a set of records';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.create_intermediate_result(result_id text, query text)
|
||||
RETURNS bigint
|
||||
LANGUAGE C STRICT VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$create_intermediate_result$$;
|
||||
COMMENT ON FUNCTION pg_catalog.create_intermediate_result(text,text)
|
||||
IS 'execute a query and write its results to local result file';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.broadcast_intermediate_result(result_id text, query text)
|
||||
RETURNS bigint
|
||||
LANGUAGE C STRICT VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$broadcast_intermediate_result$$;
|
||||
COMMENT ON FUNCTION pg_catalog.broadcast_intermediate_result(text,text)
|
||||
IS 'execute a query and write its results to an result file on all workers';
|
|
@ -1,13 +0,0 @@
|
|||
-- citus--7.2-2--7.2-3
|
||||
|
||||
DROP FUNCTION pg_catalog.read_intermediate_result(text,citus.copy_format);
|
||||
DROP TYPE citus.copy_format;
|
||||
|
||||
CREATE TYPE pg_catalog.citus_copy_format AS ENUM ('csv', 'binary', 'text');
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.read_intermediate_result(result_id text, format pg_catalog.citus_copy_format default 'csv')
|
||||
RETURNS SETOF record
|
||||
LANGUAGE C STRICT VOLATILE PARALLEL SAFE
|
||||
AS 'MODULE_PATHNAME', $$read_intermediate_result$$;
|
||||
COMMENT ON FUNCTION pg_catalog.read_intermediate_result(text,pg_catalog.citus_copy_format)
|
||||
IS 'read a file and return it as a set of records';
|
|
@ -1,4 +0,0 @@
|
|||
-- citus--7.2-3--7.3-1
|
||||
|
||||
-- bump version to 7.3-1
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
-- citus--7.3-1--7.3-2
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_text_send_as_jsonb(text)
|
||||
RETURNS bytea
|
||||
LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_text_send_as_jsonb$$;
|
|
@ -1,71 +0,0 @@
|
|||
-- citus--7.3-2--7.3-3
|
||||
|
||||
-- Citus json aggregate helpers
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_jsonb_concatenate(state jsonb, val jsonb)
|
||||
RETURNS jsonb
|
||||
LANGUAGE SQL
|
||||
AS $function$
|
||||
SELECT CASE
|
||||
WHEN val IS NULL THEN state
|
||||
WHEN jsonb_typeof(state) = 'null' THEN val
|
||||
ELSE state || val
|
||||
END;
|
||||
$function$;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_jsonb_concatenate_final(state jsonb)
|
||||
RETURNS jsonb
|
||||
LANGUAGE SQL
|
||||
AS $function$
|
||||
SELECT CASE WHEN jsonb_typeof(state) = 'null' THEN NULL ELSE state END;
|
||||
$function$;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_json_concatenate(state json, val json)
|
||||
RETURNS json
|
||||
LANGUAGE SQL
|
||||
AS $function$
|
||||
SELECT CASE
|
||||
WHEN val IS NULL THEN state
|
||||
WHEN json_typeof(state) = 'null' THEN val
|
||||
WHEN json_typeof(state) = 'object' THEN
|
||||
(SELECT json_object_agg(key, value) FROM (
|
||||
SELECT * FROM json_each(state)
|
||||
UNION ALL
|
||||
SELECT * FROM json_each(val)
|
||||
) t)
|
||||
ELSE
|
||||
(SELECT json_agg(a) FROM (
|
||||
SELECT json_array_elements(state) AS a
|
||||
UNION ALL
|
||||
SELECT json_array_elements(val) AS a
|
||||
) t)
|
||||
END;
|
||||
$function$;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_json_concatenate_final(state json)
|
||||
RETURNS json
|
||||
LANGUAGE SQL
|
||||
AS $function$
|
||||
SELECT CASE WHEN json_typeof(state) = 'null' THEN NULL ELSE state END;
|
||||
$function$;
|
||||
|
||||
|
||||
-- Citus json aggregates
|
||||
|
||||
CREATE AGGREGATE pg_catalog.jsonb_cat_agg(jsonb) (
|
||||
SFUNC = citus_jsonb_concatenate,
|
||||
FINALFUNC = citus_jsonb_concatenate_final,
|
||||
STYPE = jsonb,
|
||||
INITCOND = 'null'
|
||||
);
|
||||
COMMENT ON AGGREGATE pg_catalog.jsonb_cat_agg(jsonb)
|
||||
IS 'concatenate input jsonbs into a single jsonb';
|
||||
|
||||
CREATE AGGREGATE pg_catalog.json_cat_agg(json) (
|
||||
SFUNC = citus_json_concatenate,
|
||||
FINALFUNC = citus_json_concatenate_final,
|
||||
STYPE = json,
|
||||
INITCOND = 'null'
|
||||
);
|
||||
COMMENT ON AGGREGATE pg_catalog.json_cat_agg(json)
|
||||
IS 'concatenate input jsons into a single json';
|
|
@ -1,5 +0,0 @@
|
|||
-- citus--7.3-3--7.4-1
|
||||
|
||||
DROP FUNCTION IF EXISTS master_expire_table_cache(regclass);
|
||||
DROP FUNCTION IF EXISTS pg_catalog.worker_fetch_regular_table(text, bigint, text[], integer[]);
|
||||
DROP FUNCTION IF EXISTS pg_catalog.worker_fetch_foreign_file(text, bigint, text[], integer[]);
|
|
@ -1,35 +0,0 @@
|
|||
-- citus--7.4-1--7.4-2
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.citus_drop_trigger()
|
||||
RETURNS event_trigger
|
||||
LANGUAGE plpgsql
|
||||
SET search_path = pg_catalog
|
||||
AS $cdbdt$
|
||||
DECLARE
|
||||
v_obj record;
|
||||
sequence_names text[] := '{}';
|
||||
table_colocation_id integer;
|
||||
propagate_drop boolean := false;
|
||||
BEGIN
|
||||
-- collect set of dropped sequences to drop on workers later
|
||||
SELECT array_agg(object_identity) INTO sequence_names
|
||||
FROM pg_event_trigger_dropped_objects()
|
||||
WHERE object_type = 'sequence';
|
||||
|
||||
FOR v_obj IN SELECT * FROM pg_event_trigger_dropped_objects()
|
||||
WHERE object_type IN ('table', 'foreign table')
|
||||
LOOP
|
||||
-- drop all shards and the metadata
|
||||
PERFORM master_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name);
|
||||
PERFORM master_drop_distributed_table_metadata(v_obj.objid, v_obj.schema_name, v_obj.object_name);
|
||||
END LOOP;
|
||||
|
||||
IF cardinality(sequence_names) = 0 THEN
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
PERFORM master_drop_sequences(sequence_names);
|
||||
END;
|
||||
$cdbdt$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_drop_trigger()
|
||||
IS 'perform checks and actions at the end of DROP actions';
|
|
@ -1,13 +0,0 @@
|
|||
-- citus--7.4-2--7.4-3
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
-- note that we're not dropping the older version of the function
|
||||
CREATE FUNCTION worker_hash_partition_table(bigint, integer, text, text, oid, anyarray)
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$worker_hash_partition_table$$;
|
||||
COMMENT ON FUNCTION worker_hash_partition_table(bigint, integer, text, text, oid,
|
||||
anyarray)
|
||||
IS 'hash partition query results';
|
||||
|
||||
RESET search_path;
|
|
@ -1,4 +0,0 @@
|
|||
-- citus--7.4-3--7.5-1
|
||||
|
||||
-- bump version to 7.5-1
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
-- citus--7.5-1--7.5-2
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
-- note that we're not dropping the older version of the function
|
||||
CREATE FUNCTION pg_catalog.role_exists(name)
|
||||
RETURNS boolean
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$role_exists$$;
|
||||
COMMENT ON FUNCTION role_exists(name) IS 'returns whether a role exists';
|
||||
|
||||
CREATE FUNCTION pg_catalog.authinfo_valid(text)
|
||||
RETURNS boolean
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$authinfo_valid$$;
|
||||
COMMENT ON FUNCTION authinfo_valid(text) IS 'returns whether an authinfo is valid';
|
||||
|
||||
CREATE TABLE citus.pg_dist_authinfo (
|
||||
nodeid integer NOT NULL,
|
||||
rolename name NOT NULL
|
||||
CONSTRAINT role_exists
|
||||
CHECK (role_exists(rolename)),
|
||||
authinfo text NOT NULL
|
||||
CONSTRAINT authinfo_valid
|
||||
CHECK (authinfo_valid(authinfo))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX pg_dist_authinfo_identification_index
|
||||
ON citus.pg_dist_authinfo (rolename, nodeid DESC);
|
||||
|
||||
ALTER TABLE citus.pg_dist_authinfo SET SCHEMA pg_catalog;
|
||||
|
||||
REVOKE ALL ON pg_catalog.pg_dist_authinfo FROM PUBLIC;
|
||||
|
||||
RESET search_path;
|
|
@ -1,28 +0,0 @@
|
|||
-- citus--7.5-2--7.5-3
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE FUNCTION master_dist_authinfo_cache_invalidate()
|
||||
RETURNS trigger
|
||||
LANGUAGE C
|
||||
AS 'citus', $$master_dist_authinfo_cache_invalidate$$;
|
||||
COMMENT ON FUNCTION master_dist_authinfo_cache_invalidate()
|
||||
IS 'register authinfo cache invalidation on any modifications';
|
||||
|
||||
CREATE FUNCTION task_tracker_conninfo_cache_invalidate()
|
||||
RETURNS trigger
|
||||
LANGUAGE C
|
||||
AS 'citus', $$task_tracker_conninfo_cache_invalidate$$;
|
||||
COMMENT ON FUNCTION task_tracker_conninfo_cache_invalidate()
|
||||
IS 'invalidate task-tracker conninfo cache';
|
||||
|
||||
CREATE TRIGGER dist_authinfo_cache_invalidate
|
||||
AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE
|
||||
ON pg_catalog.pg_dist_authinfo
|
||||
FOR EACH STATEMENT EXECUTE PROCEDURE master_dist_authinfo_cache_invalidate();
|
||||
|
||||
CREATE TRIGGER dist_authinfo_task_tracker_cache_invalidate
|
||||
AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE
|
||||
ON pg_catalog.pg_dist_authinfo
|
||||
FOR EACH STATEMENT EXECUTE PROCEDURE task_tracker_conninfo_cache_invalidate();
|
||||
|
||||
RESET search_path;
|
|
@ -1,47 +0,0 @@
|
|||
-- citus--7.5-3--7.5-4
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_query_stats(OUT queryid bigint,
|
||||
OUT userid oid,
|
||||
OUT dbid oid,
|
||||
OUT executor bigint,
|
||||
OUT partition_key text,
|
||||
OUT calls bigint)
|
||||
RETURNS SETOF record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_query_stats$$;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_stat_statements_reset()
|
||||
RETURNS VOID
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_stat_statements_reset$$;
|
||||
|
||||
CREATE FUNCTION pg_catalog.citus_stat_statements(OUT queryid bigint,
|
||||
OUT userid oid,
|
||||
OUT dbid oid,
|
||||
OUT query text,
|
||||
OUT executor bigint,
|
||||
OUT partition_key text,
|
||||
OUT calls bigint)
|
||||
RETURNS SETOF record
|
||||
LANGUAGE plpgsql
|
||||
AS $citus_stat_statements$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT extname FROM pg_extension
|
||||
WHERE extname = 'pg_stat_statements')
|
||||
THEN
|
||||
RETURN QUERY SELECT pss.queryid, pss.userid, pss.dbid, pss.query, cqs.executor,
|
||||
cqs.partition_key, cqs.calls
|
||||
FROM pg_stat_statements(true) pss
|
||||
JOIN citus_query_stats() cqs
|
||||
USING (queryid);
|
||||
ELSE
|
||||
RAISE EXCEPTION 'pg_stat_statements is not installed'
|
||||
USING HINT = 'install pg_stat_statements extension and try again';
|
||||
END IF;
|
||||
END;
|
||||
$citus_stat_statements$;
|
||||
|
||||
CREATE VIEW citus.citus_stat_statements as SELECT * FROM pg_catalog.citus_stat_statements();
|
||||
ALTER VIEW citus.citus_stat_statements SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.citus_stat_statements TO public;
|
|
@ -1,34 +0,0 @@
|
|||
-- citus--7.5-4--7.5-5
|
||||
CREATE FUNCTION pg_catalog.citus_executor_name(executor_type int)
|
||||
RETURNS TEXT
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
IF (executor_type = 1) THEN
|
||||
RETURN 'real-time';
|
||||
ELSIF (executor_type = 2) THEN
|
||||
RETURN 'task-tracker';
|
||||
ELSIF (executor_type = 3) THEN
|
||||
RETURN 'router';
|
||||
ELSIF (executor_type = 4) THEN
|
||||
RETURN 'insert-select';
|
||||
ELSE
|
||||
RETURN 'unknown';
|
||||
END IF;
|
||||
END;
|
||||
$function$;
|
||||
|
||||
DROP VIEW pg_catalog.citus_stat_statements;
|
||||
|
||||
CREATE VIEW citus.citus_stat_statements AS
|
||||
SELECT
|
||||
queryid,
|
||||
userid,
|
||||
dbid,
|
||||
query,
|
||||
pg_catalog.citus_executor_name(executor::int) AS executor,
|
||||
partition_key,
|
||||
calls
|
||||
FROM pg_catalog.citus_stat_statements();
|
||||
ALTER VIEW citus.citus_stat_statements SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.citus_stat_statements TO public;
|
|
@ -1,4 +0,0 @@
|
|||
-- citus--7.5-5--7.5-6
|
||||
|
||||
-- Don't want this to be available to non-superusers.
|
||||
REVOKE ALL ON FUNCTION pg_catalog.citus_stat_statements_reset() FROM PUBLIC;
|
|
@ -1,35 +0,0 @@
|
|||
-- citus--7.5-6--7.5-7
|
||||
SET search_path = 'pg_catalog';
|
||||
|
||||
CREATE FUNCTION pg_catalog.poolinfo_valid(text)
|
||||
RETURNS boolean
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$poolinfo_valid$$;
|
||||
COMMENT ON FUNCTION pg_catalog.poolinfo_valid(text) IS 'returns whether a poolinfo is valid';
|
||||
|
||||
CREATE TABLE citus.pg_dist_poolinfo (
|
||||
nodeid integer PRIMARY KEY
|
||||
REFERENCES pg_dist_node(nodeid)
|
||||
ON DELETE CASCADE,
|
||||
poolinfo text NOT NULL
|
||||
CONSTRAINT poolinfo_valid
|
||||
CHECK (poolinfo_valid(poolinfo))
|
||||
);
|
||||
|
||||
ALTER TABLE citus.pg_dist_poolinfo SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.pg_dist_poolinfo TO public;
|
||||
|
||||
ALTER FUNCTION master_dist_authinfo_cache_invalidate()
|
||||
RENAME TO master_conninfo_cache_invalidate;
|
||||
|
||||
CREATE TRIGGER dist_poolinfo_cache_invalidate
|
||||
AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE
|
||||
ON pg_catalog.pg_dist_poolinfo
|
||||
FOR EACH STATEMENT EXECUTE PROCEDURE master_conninfo_cache_invalidate();
|
||||
|
||||
CREATE TRIGGER dist_poolinfo_task_tracker_cache_invalidate
|
||||
AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE
|
||||
ON pg_catalog.pg_dist_poolinfo
|
||||
FOR EACH STATEMENT EXECUTE PROCEDURE task_tracker_conninfo_cache_invalidate();
|
||||
|
||||
RESET search_path;
|
|
@ -1,4 +0,0 @@
|
|||
-- citus--7.5-7--8.0-1
|
||||
|
||||
-- bump version to 8.0-1
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +0,0 @@
|
|||
SET citus.next_shard_id TO 103000;
|
||||
-- tests that the upgrade from 7.0-2 to 7.0-3 properly migrates shard placements
|
||||
DROP EXTENSION citus;
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.0-2';
|
||||
INSERT INTO pg_dist_shard_placement
|
||||
(placementid, shardid, shardstate, shardlength, nodename, nodeport) VALUES
|
||||
(1, 1, 1, 0, 'localhost', :worker_1_port);
|
||||
-- if there are no worker nodes which match the shards this should fail
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
ERROR: There is no node at "localhost:xxxxx"
|
||||
CONTEXT: PL/pgSQL function citus.find_groupid_for_node(text,integer) line 6 at RAISE
|
||||
-- if you add a matching worker the upgrade should succeed
|
||||
INSERT INTO pg_dist_node (nodename, nodeport, groupid)
|
||||
VALUES ('localhost', :worker_1_port, 1);
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
SELECT * FROM pg_dist_placement;
|
||||
placementid | shardid | shardstate | shardlength | groupid
|
||||
---------------------------------------------------------------------
|
||||
1 | 1 | 1 | 0 | 1
|
||||
(1 row)
|
||||
|
||||
-- reset and prepare for the rest of the tests
|
||||
DROP EXTENSION citus;
|
||||
CREATE EXTENSION citus;
|
|
@ -103,40 +103,7 @@ DROP EXTENSION citus;
|
|||
-- these tests switch between citus versions and call ddl's that require pg_dist_object to be created
|
||||
SET citus.enable_object_propagation TO 'false';
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-5';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-6';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-7';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-8';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-9';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-10';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-11';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-12';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-13';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-14';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-15';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.3-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-5';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-6';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-7';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-4';
|
||||
|
@ -519,13 +486,13 @@ ORDER BY 1, 2;
|
|||
-- see incompatible version errors out
|
||||
RESET citus.enable_version_checks;
|
||||
DROP EXTENSION citus;
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
ERROR: specified version incompatible with loaded Citus library
|
||||
DETAIL: Loaded library requires 10.0, but 7.0-1 was specified.
|
||||
DETAIL: Loaded library requires 10.0, but 8.0-1 was specified.
|
||||
HINT: If a newer library is present, restart the database and try the command again.
|
||||
-- Test non-distributed queries work even in version mismatch
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.1-1';
|
||||
CREATE EXTENSION citus VERSION '8.1-1';
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
-- Test CREATE TABLE
|
||||
CREATE TABLE version_mismatch_table(column1 int);
|
||||
|
@ -564,24 +531,29 @@ ORDER BY 1;
|
|||
-- We should not distribute table in version mistmatch
|
||||
SELECT create_distributed_table('version_mismatch_table', 'column1');
|
||||
ERROR: loaded Citus library version differs from installed extension version
|
||||
DETAIL: Loaded library requires 10.0, but the installed extension version is 7.1-1.
|
||||
DETAIL: Loaded library requires 10.0, but the installed extension version is 8.1-1.
|
||||
HINT: Run ALTER EXTENSION citus UPDATE and try again.
|
||||
-- This function will cause fail in next ALTER EXTENSION
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.master_dist_authinfo_cache_invalidate()
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.relation_is_a_known_shard(regclass)
|
||||
RETURNS void LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
END;
|
||||
$function$;
|
||||
ERROR: cannot change return type of existing function
|
||||
HINT: Use DROP FUNCTION relation_is_a_known_shard(regclass) first.
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
-- This will fail because of previous function declaration
|
||||
ALTER EXTENSION citus UPDATE TO '8.1-1';
|
||||
ERROR: function "master_dist_authinfo_cache_invalidate" already exists with same argument types
|
||||
NOTICE: version "8.1-1" of extension "citus" is already installed
|
||||
-- We can DROP problematic function and continue ALTER EXTENSION even when version checks are on
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
DROP FUNCTION pg_catalog.master_dist_authinfo_cache_invalidate();
|
||||
DROP FUNCTION pg_catalog.relation_is_a_known_shard(regclass);
|
||||
ERROR: cannot drop function relation_is_a_known_shard(regclass) because extension citus requires it
|
||||
HINT: You can drop extension citus instead.
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
ALTER EXTENSION citus UPDATE TO '8.1-1';
|
||||
NOTICE: version "8.1-1" of extension "citus" is already installed
|
||||
-- Test updating to the latest version without specifying the version number
|
||||
ALTER EXTENSION citus UPDATE;
|
||||
-- re-create in newest version
|
||||
|
@ -592,7 +564,7 @@ CREATE EXTENSION citus;
|
|||
\c - - - :worker_1_port
|
||||
DROP EXTENSION citus;
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
-- during ALTER EXTENSION, we should invalidate the cache
|
||||
ALTER EXTENSION citus UPDATE;
|
||||
|
|
|
@ -103,40 +103,7 @@ DROP EXTENSION citus;
|
|||
-- these tests switch between citus versions and call ddl's that require pg_dist_object to be created
|
||||
SET citus.enable_object_propagation TO 'false';
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-5';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-6';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-7';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-8';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-9';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-10';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-11';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-12';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-13';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-14';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-15';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.3-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-5';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-6';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-7';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-4';
|
||||
|
@ -515,13 +482,13 @@ ORDER BY 1, 2;
|
|||
-- see incompatible version errors out
|
||||
RESET citus.enable_version_checks;
|
||||
DROP EXTENSION citus;
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
ERROR: specified version incompatible with loaded Citus library
|
||||
DETAIL: Loaded library requires 10.0, but 7.0-1 was specified.
|
||||
DETAIL: Loaded library requires 10.0, but 8.0-1 was specified.
|
||||
HINT: If a newer library is present, restart the database and try the command again.
|
||||
-- Test non-distributed queries work even in version mismatch
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.1-1';
|
||||
CREATE EXTENSION citus VERSION '8.1-1';
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
-- Test CREATE TABLE
|
||||
CREATE TABLE version_mismatch_table(column1 int);
|
||||
|
@ -560,24 +527,29 @@ ORDER BY 1;
|
|||
-- We should not distribute table in version mistmatch
|
||||
SELECT create_distributed_table('version_mismatch_table', 'column1');
|
||||
ERROR: loaded Citus library version differs from installed extension version
|
||||
DETAIL: Loaded library requires 10.0, but the installed extension version is 7.1-1.
|
||||
DETAIL: Loaded library requires 10.0, but the installed extension version is 8.1-1.
|
||||
HINT: Run ALTER EXTENSION citus UPDATE and try again.
|
||||
-- This function will cause fail in next ALTER EXTENSION
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.master_dist_authinfo_cache_invalidate()
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.relation_is_a_known_shard(regclass)
|
||||
RETURNS void LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
END;
|
||||
$function$;
|
||||
ERROR: cannot change return type of existing function
|
||||
HINT: Use DROP FUNCTION relation_is_a_known_shard(regclass) first.
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
-- This will fail because of previous function declaration
|
||||
ALTER EXTENSION citus UPDATE TO '8.1-1';
|
||||
ERROR: function "master_dist_authinfo_cache_invalidate" already exists with same argument types
|
||||
NOTICE: version "8.1-1" of extension "citus" is already installed
|
||||
-- We can DROP problematic function and continue ALTER EXTENSION even when version checks are on
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
DROP FUNCTION pg_catalog.master_dist_authinfo_cache_invalidate();
|
||||
DROP FUNCTION pg_catalog.relation_is_a_known_shard(regclass);
|
||||
ERROR: cannot drop function relation_is_a_known_shard(regclass) because extension citus requires it
|
||||
HINT: You can drop extension citus instead.
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
ALTER EXTENSION citus UPDATE TO '8.1-1';
|
||||
NOTICE: version "8.1-1" of extension "citus" is already installed
|
||||
-- Test updating to the latest version without specifying the version number
|
||||
ALTER EXTENSION citus UPDATE;
|
||||
-- re-create in newest version
|
||||
|
@ -588,7 +560,7 @@ CREATE EXTENSION citus;
|
|||
\c - - - :worker_1_port
|
||||
DROP EXTENSION citus;
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
-- during ALTER EXTENSION, we should invalidate the cache
|
||||
ALTER EXTENSION citus UPDATE;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# Tests around schema changes, these are run first, so there's no preexisting objects.
|
||||
# ---
|
||||
test: multi_extension
|
||||
test: multi_703_upgrade
|
||||
test: single_node
|
||||
test: multi_cluster_management
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
SET citus.next_shard_id TO 103000;
|
||||
|
||||
-- tests that the upgrade from 7.0-2 to 7.0-3 properly migrates shard placements
|
||||
|
||||
DROP EXTENSION citus;
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
|
||||
CREATE EXTENSION citus VERSION '7.0-2';
|
||||
|
||||
INSERT INTO pg_dist_shard_placement
|
||||
(placementid, shardid, shardstate, shardlength, nodename, nodeport) VALUES
|
||||
(1, 1, 1, 0, 'localhost', :worker_1_port);
|
||||
|
||||
-- if there are no worker nodes which match the shards this should fail
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
|
||||
-- if you add a matching worker the upgrade should succeed
|
||||
INSERT INTO pg_dist_node (nodename, nodeport, groupid)
|
||||
VALUES ('localhost', :worker_1_port, 1);
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
|
||||
SELECT * FROM pg_dist_placement;
|
||||
|
||||
-- reset and prepare for the rest of the tests
|
||||
DROP EXTENSION citus;
|
||||
CREATE EXTENSION citus;
|
|
@ -101,40 +101,7 @@ SET citus.enable_object_propagation TO 'false';
|
|||
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-5';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-6';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-7';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-8';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-9';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-10';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-11';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-12';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-13';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-14';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-15';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.1-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.2-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.3-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.4-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-1';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-2';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-3';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-4';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-5';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-6';
|
||||
ALTER EXTENSION citus UPDATE TO '7.5-7';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '8.0-4';
|
||||
|
@ -250,11 +217,11 @@ ORDER BY 1, 2;
|
|||
-- see incompatible version errors out
|
||||
RESET citus.enable_version_checks;
|
||||
DROP EXTENSION citus;
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
|
||||
-- Test non-distributed queries work even in version mismatch
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.1-1';
|
||||
CREATE EXTENSION citus VERSION '8.1-1';
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
|
||||
-- Test CREATE TABLE
|
||||
|
@ -286,7 +253,7 @@ ORDER BY 1;
|
|||
SELECT create_distributed_table('version_mismatch_table', 'column1');
|
||||
|
||||
-- This function will cause fail in next ALTER EXTENSION
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.master_dist_authinfo_cache_invalidate()
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.relation_is_a_known_shard(regclass)
|
||||
RETURNS void LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
@ -299,7 +266,7 @@ ALTER EXTENSION citus UPDATE TO '8.1-1';
|
|||
|
||||
-- We can DROP problematic function and continue ALTER EXTENSION even when version checks are on
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
DROP FUNCTION pg_catalog.master_dist_authinfo_cache_invalidate();
|
||||
DROP FUNCTION pg_catalog.relation_is_a_known_shard(regclass);
|
||||
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
ALTER EXTENSION citus UPDATE TO '8.1-1';
|
||||
|
@ -317,7 +284,7 @@ CREATE EXTENSION citus;
|
|||
|
||||
DROP EXTENSION citus;
|
||||
SET citus.enable_version_checks TO 'false';
|
||||
CREATE EXTENSION citus VERSION '7.0-1';
|
||||
CREATE EXTENSION citus VERSION '8.0-1';
|
||||
SET citus.enable_version_checks TO 'true';
|
||||
-- during ALTER EXTENSION, we should invalidate the cache
|
||||
ALTER EXTENSION citus UPDATE;
|
||||
|
|
Loading…
Reference in New Issue