Fix operation tests

velioglu/tmpfuncprop
Burak Velioglu 2022-02-10 01:35:05 +03:00
parent 6de2d7f050
commit 0cfe2375b6
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
2 changed files with 32 additions and 53 deletions

View File

@ -142,22 +142,14 @@ SELECT master_move_shard_placement(20000000, 'localhost', :worker_2_port, 'local
(1 row) (1 row)
SELECT run_command_on_workers($cmd$ -- override the function for testing purpose
-- override the function for testing purpose create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint)
create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint) as $BODY$
as $BODY$ begin
begin select 20 into available_disk_size;
select 20 into available_disk_size; select 8500 into total_disk_size;
select 8500 into total_disk_size; end
end $BODY$ language plpgsql;
$BODY$ language plpgsql;
$cmd$);
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"CREATE FUNCTION")
(localhost,57638,t,"CREATE FUNCTION")
(2 rows)
SELECT citus_shard_cost_by_disk_size(20000001); SELECT citus_shard_cost_by_disk_size(20000001);
citus_shard_cost_by_disk_size citus_shard_cost_by_disk_size
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -187,22 +179,14 @@ $cmd$);
(localhost,57638,t,1) (localhost,57638,t,1)
(2 rows) (2 rows)
SELECT run_command_on_workers($cmd$ -- override the function for testing purpose
-- override the function for testing purpose create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint)
create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint) as $BODY$
as $BODY$ begin
begin select 8300 into available_disk_size;
select 8300 into available_disk_size; select 8500 into total_disk_size;
select 8500 into total_disk_size; end
end $BODY$ language plpgsql;
$BODY$ language plpgsql;
$cmd$);
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"CREATE FUNCTION")
(localhost,57638,t,"CREATE FUNCTION")
(2 rows)
-- When there would not be enough free space left after the move, the move should fail -- When there would not be enough free space left after the move, the move should fail
SELECT master_move_shard_placement(20000001, 'localhost', :worker_2_port, 'localhost', :worker_1_port); SELECT master_move_shard_placement(20000001, 'localhost', :worker_2_port, 'localhost', :worker_1_port);
ERROR: not enough empty space on node if the shard is moved, actual available space after move will be 108 bytes, desired available space after move is 850 bytes,estimated size increase on node after move is 8192 bytes. ERROR: not enough empty space on node if the shard is moved, actual available space after move will be 108 bytes, desired available space after move is 850 bytes,estimated size increase on node after move is 8192 bytes.

View File

@ -80,17 +80,14 @@ $cmd$);
SELECT master_move_shard_placement(20000000, 'localhost', :worker_2_port, 'localhost', :worker_1_port); SELECT master_move_shard_placement(20000000, 'localhost', :worker_2_port, 'localhost', :worker_1_port);
SELECT run_command_on_workers($cmd$ -- override the function for testing purpose
-- override the function for testing purpose create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint)
create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint) as $BODY$
as $BODY$ begin
begin select 20 into available_disk_size;
select 20 into available_disk_size; select 8500 into total_disk_size;
select 8500 into total_disk_size; end
end $BODY$ language plpgsql;
$BODY$ language plpgsql;
$cmd$);
SELECT citus_shard_cost_by_disk_size(20000001); SELECT citus_shard_cost_by_disk_size(20000001);
@ -108,16 +105,14 @@ SELECT run_command_on_workers($cmd$
SELECT count(*) FROM pg_class WHERE relname = 't1_20000000'; SELECT count(*) FROM pg_class WHERE relname = 't1_20000000';
$cmd$); $cmd$);
SELECT run_command_on_workers($cmd$ -- override the function for testing purpose
-- override the function for testing purpose create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint)
create or replace function pg_catalog.citus_local_disk_space_stats(OUT available_disk_size bigint, OUT total_disk_size bigint) as $BODY$
as $BODY$ begin
begin select 8300 into available_disk_size;
select 8300 into available_disk_size; select 8500 into total_disk_size;
select 8500 into total_disk_size; end
end $BODY$ language plpgsql;
$BODY$ language plpgsql;
$cmd$);
-- When there would not be enough free space left after the move, the move should fail -- When there would not be enough free space left after the move, the move should fail
SELECT master_move_shard_placement(20000001, 'localhost', :worker_2_port, 'localhost', :worker_1_port); SELECT master_move_shard_placement(20000001, 'localhost', :worker_2_port, 'localhost', :worker_1_port);