Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
compression bool DEFAULT false,
compression_level bool DEFAULT false)
RETURNS void
LANGUAGE plpgsql AS
LANGUAGE plpgsql
SET search_path = pg_catalog, pg_temp
AS
$alter_columnar_table_reset$
declare
noop BOOLEAN := true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
compression bool DEFAULT false,
compression_level bool DEFAULT false)
RETURNS void
LANGUAGE plpgsql AS
LANGUAGE plpgsql
SET search_path = pg_catalog, pg_temp
AS
$alter_columnar_table_reset$
declare
noop BOOLEAN := true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
compression name DEFAULT null,
compression_level int DEFAULT NULL)
RETURNS void
LANGUAGE plpgsql AS
LANGUAGE plpgsql
SET search_path = pg_catalog, pg_temp
AS
$alter_columnar_table_set$
declare
noop BOOLEAN := true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
compression name DEFAULT null,
compression_level int DEFAULT NULL)
RETURNS void
LANGUAGE plpgsql AS
LANGUAGE plpgsql
SET search_path = pg_catalog, pg_temp
AS
$alter_columnar_table_set$
declare
noop BOOLEAN := true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE OR REPLACE FUNCTION columnar_internal.columnar_ensure_am_depends_catalog()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $func$
BEGIN
INSERT INTO pg_depend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE OR REPLACE FUNCTION columnar_internal.columnar_ensure_am_depends_catalog()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $func$
BEGIN
INSERT INTO pg_depend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CREATE OR REPLACE FUNCTION citus_internal.columnar_ensure_objects_exist()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $ceoe$
BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CREATE OR REPLACE FUNCTION citus_internal.columnar_ensure_objects_exist()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $ceoe$
BEGIN

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE OR REPLACE FUNCTION pg_catalog.columnar_finish_pg_upgrade()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $cppu$
BEGIN
-- set dependencies for columnar table access method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE OR REPLACE FUNCTION pg_catalog.columnar_finish_pg_upgrade()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $cppu$
BEGIN
-- set dependencies for columnar table access method
Expand Down
2 changes: 1 addition & 1 deletion src/backend/distributed/sql/citus--10.2-5--11.0-1.sql
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were this file and src/backend/distributed/sql/downgrades/citus--11.0-1--10.2-5.sql added intentionally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, when we modified 10.2-5--11.0.1, ci complained that we are missing the corresponding downgrade path. not sure if it was left unintentionally till now. @onurctirtir

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ DECLARE
partitioned_table_exists bool :=false;
BEGIN
SELECT count(*) > 0 INTO partitioned_table_exists FROM pg_dist_partition p JOIN pg_class c ON p.logicalrelid = c.oid WHERE c.relkind = 'p';
UPDATE pg_dist_node_metadata SET metadata=jsonb_set(metadata, '{partitioned_citus_table_exists_pre_11}', to_jsonb(partitioned_table_exists), true);
UPDATE pg_dist_node_metadata SET metadata=pg_catalog.jsonb_set(metadata, '{partitioned_citus_table_exists_pre_11}', pg_catalog.to_jsonb(partitioned_table_exists), true);
END;
$$;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- citus--11.0-1--10.2-5
-- downgrade version to 10.2-5

#include "citus--11.0-1--10.2-4.sql"
#include "../udfs/citus_finish_pg_upgrade/10.2-5.sql"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ LANGUAGE plpgsql
AS $$
DECLARE
r record;
parent_table_name_text text;
BEGIN
SELECT pg_catalog.quote_ident(relname)
INTO parent_table_name_text
FROM pg_catalog.pg_class
WHERE oid = parent_table_name;
-- first check whether we can convert all the to_value's to timestamptz
BEGIN
PERFORM
Expand All @@ -16,20 +21,21 @@ BEGIN
AND to_value::timestamptz <= older_than
AND access_method <> new_access_method;
EXCEPTION WHEN invalid_datetime_format THEN
RAISE 'partition column of % cannot be cast to a timestamptz', parent_table_name;
RAISE 'partition column of % cannot be cast to a timestamptz', parent_table_name_text;
END;

-- now convert the partitions in separate transactions
FOR r IN
SELECT partition, from_value, to_value
FROM pg_catalog.time_partitions
SELECT partition, c.relname AS partition_name, from_value, to_value
FROM pg_catalog.time_partitions tp
JOIN pg_catalog.pg_class c ON tp.partition = c.oid
WHERE parent_table = parent_table_name
AND to_value IS NOT NULL
AND to_value::timestamptz <= older_than
AND access_method <> new_access_method
ORDER BY to_value::timestamptz
LOOP
RAISE NOTICE 'converting % with start time % and end time %', r.partition, r.from_value, r.to_value;
RAISE NOTICE 'converting % with start time % and end time %', pg_catalog.quote_ident(r.partition_name), r.from_value, r.to_value;
PERFORM pg_catalog.alter_table_set_access_method(r.partition, new_access_method);
COMMIT;
END LOOP;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ RETURNS int4[] AS $$

-- pg says we're not blocked locally; check whether we're blocked globally.
SELECT global_pid INTO mLocalGlobalPid
FROM get_all_active_transactions() WHERE process_id = pBlockedPid;
FROM pg_catalog.get_all_active_transactions() WHERE process_id = pBlockedPid;

SELECT array_agg(global_pid) INTO mRemoteBlockingPids FROM (
WITH activeTransactions AS (
SELECT global_pid FROM get_all_active_transactions()
SELECT global_pid FROM pg_catalog.get_all_active_transactions()
), blockingTransactions AS (
SELECT blocking_global_pid FROM citus_internal.global_blocked_processes()
WHERE waiting_global_pid = mLocalGlobalPid
Expand All @@ -29,6 +29,7 @@ RETURNS int4[] AS $$

RETURN mRemoteBlockingPids;
END;
$$ LANGUAGE plpgsql;
$$ LANGUAGE plpgsql
SET search_path = pg_catalog, pg_temp;

REVOKE ALL ON FUNCTION citus_blocking_pids(integer) FROM PUBLIC;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE OR REPLACE FUNCTION pg_catalog.citus_drop_trigger()
RETURNS event_trigger
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $cdbdt$
DECLARE
constraint_event_count INTEGER;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
CREATE OR REPLACE FUNCTION pg_catalog.citus_finalize_upgrade_to_citus11(enforce_version_check bool default true)
RETURNS bool
LANGUAGE plpgsql
SET search_path = pg_catalog, pg_temp
AS $$
BEGIN

Expand Down Expand Up @@ -80,7 +81,7 @@ END;

IF primary_disabled_worker_node_count != 0 THEN
RAISE EXCEPTION 'There are inactive primary worker nodes, you need to activate the nodes first.'
'Use SELECT citus_activate_node() to activate the disabled nodes';
'Use SELECT pg_catalog.citus_activate_node() to activate the disabled nodes';
ELSE
RAISE DEBUG 'There are no disabled worker nodes, continue to sync metadata';
END IF;
Expand All @@ -92,12 +93,12 @@ END;
DECLARE
all_nodes_can_connect_to_each_other boolean := False;
BEGIN
SELECT bool_and(coalesce(result, false)) INTO all_nodes_can_connect_to_each_other FROM citus_check_cluster_node_health();
SELECT bool_and(coalesce(result, false)) INTO all_nodes_can_connect_to_each_other FROM pg_catalog.citus_check_cluster_node_health();

IF all_nodes_can_connect_to_each_other != True THEN
RAISE EXCEPTION 'There are unhealth primary nodes, you need to ensure all '
'nodes are up and running. Also, make sure that all nodes can connect '
'to each other. Use SELECT * FROM citus_check_cluster_node_health(); '
'to each other. Use SELECT * FROM pg_catalog.citus_check_cluster_node_health(); '
'to check the cluster health';
ELSE
RAISE DEBUG 'Cluster is healthy, all nodes can connect to each other';
Expand All @@ -119,7 +120,7 @@ END;
SELECT
count(distinct result) INTO worker_node_version_count
FROM
run_command_on_workers('SELECT extversion from pg_extension WHERE extname = ''citus''');
pg_catalog.run_command_on_workers('SELECT extversion from pg_extension WHERE extname = ''citus''');

IF enforce_version_check AND worker_node_version_count = 0 THEN
RAISE DEBUG 'There are no worker nodes';
Expand All @@ -134,7 +135,7 @@ END;
SELECT
result INTO worker_node_version
FROM
run_command_on_workers('SELECT extversion from pg_extension WHERE extname = ''citus'';')
pg_catalog.run_command_on_workers('SELECT extversion from pg_extension WHERE extname = ''citus'';')
GROUP BY result;

IF enforce_version_check AND coordinator_version != worker_node_version THEN
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CREATE OR REPLACE PROCEDURE pg_catalog.citus_finish_citus_upgrade()
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $cppu$
DECLARE
current_version_string text;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE OR REPLACE FUNCTION pg_catalog.citus_finish_pg_upgrade()
RETURNS void
LANGUAGE plpgsql
SET search_path = pg_catalog
SET search_path = pg_catalog, pg_temp
AS $cppu$
DECLARE
table_name regclass;
Expand Down
Loading
Loading