Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker_copy_table_to_node UDF succeeds when expected to throw an error. #6795

Open
emelsimsek opened this issue Mar 28, 2023 · 0 comments · May be fixed by #7662
Open

worker_copy_table_to_node UDF succeeds when expected to throw an error. #6795

emelsimsek opened this issue Mar 28, 2023 · 0 comments · May be fixed by #7662

Comments

@emelsimsek
Copy link
Contributor

emelsimsek commented Mar 28, 2023

In the following scenario (derived from src/test/regress/results/worker_copy_table_to_node.sql), we expect the UDF call on worker_1

SELECT worker_copy_table_to_node('t', :worker_1_node);

to throw an error but it succeeds.

The culprit seems to be removing and re-adding all the workers which should have no impact on the following sql statements.

CREATE SCHEMA worker_copy_table_to_node;
SET search_path TO worker_copy_table_to_node;
SET citus.shard_count TO 1; -- single shard table for ease of testing
SET citus.shard_replication_factor TO 1;
SET citus.next_shard_id TO 62629600;
SELECT 1 FROM master_remove_node('localhost', :worker_1_port);
 ?column?
---------------------------------------------------------------------
        1
(1 row)

SELECT 1 FROM master_remove_node('localhost', :worker_2_port);
 ?column?
---------------------------------------------------------------------
        1
(1 row)

SELECT 1 FROM master_add_node('localhost', :worker_1_port);
 ?column?
---------------------------------------------------------------------
        1
(1 row)

SELECT 1 FROM master_add_node('localhost', :worker_2_port);
 ?column?
---------------------------------------------------------------------
        1
(1 row)

SELECT nodeid AS worker_1_node FROM pg_dist_node WHERE nodeport=:worker_1_port \gset
SELECT nodeid AS worker_2_node FROM pg_dist_node WHERE nodeport=:worker_2_port \gset
CREATE TABLE t(a int);
INSERT INTO t SELECT generate_series(1, 100);
CREATE TABLE ref(a int);
INSERT INTO ref SELECT generate_series(1, 100);
select create_distributed_table('t', 'a');
NOTICE:  Copying data from local table...
NOTICE:  copying the data has completed
DETAIL:  The local data in the table is no longer visible, but is still on disk.
HINT:  To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$worker_copy_table_to_node.t$$)
 create_distributed_table
---------------------------------------------------------------------

(1 row)

select create_reference_table('ref');
NOTICE:  Copying data from local table...
NOTICE:  copying the data has completed
DETAIL:  The local data in the table is no longer visible, but is still on disk.
HINT:  To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$worker_copy_table_to_node.ref$$)
 create_reference_table
---------------------------------------------------------------------

(1 row)

\c - - - :worker_1_port
SET search_path TO worker_copy_table_to_node;
-- Make sure that the UDF doesn't work on Citus tables
SELECT worker_copy_table_to_node('t', :worker_1_node);
 worker_copy_table_to_node
---------------------------------------------------------------------

(1 row)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant