Reduced test timings

users/saawasek/non_blocking_split_integrated
Sameer Awasekar 2022-05-31 09:18:43 +05:30
parent 5a711a9176
commit 04c2a92455
5 changed files with 46 additions and 92 deletions

View File

@ -41,9 +41,9 @@ void
_PG_output_plugin_init(OutputPluginCallbacks *cb)
{
LogicalOutputPluginInit plugin_init =
(LogicalOutputPluginInit) load_external_function("pgoutput",
"_PG_output_plugin_init",
false, NULL);
(LogicalOutputPluginInit) (void *) load_external_function("pgoutput",
"_PG_output_plugin_init",
false, NULL);
if (plugin_init == NULL)
{
@ -199,7 +199,7 @@ ShouldCommitBeApplied(Relation sourceShardRelation)
return false;
}
}
return true;
}

View File

@ -55,7 +55,7 @@ select 1 from public.CreateReplicationSlotForColocatedShards(:worker_2_node, :wo
(1 row)
COMMIT;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
@ -87,12 +87,6 @@ SELECT * from table_first_6;
---------------------------------------------------------------------
(0 rows)
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- Insert data in table_to_split_1 at worker1
\c - - - :worker_1_port
INSERT into table_first_4 values(100, 'a');
@ -137,7 +131,7 @@ SELECT * FROM table_second_9;
---------------------------------------------------------------------
(0 rows)
select pg_sleep(10);
select pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
@ -145,12 +139,6 @@ select pg_sleep(10);
-- Expect data to be present in shard xxxxx,6 and 8,9 based on the hash value.
\c - - - :worker_2_port
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
SELECT * from table_first_4; -- should alwasy have zero rows
id | value
---------------------------------------------------------------------

View File

@ -72,6 +72,12 @@ SELECT 1 from public.CreateSubscription(:worker_2_node, 'SUB1');
(1 row)
COMMIT;
select pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- No data is present at this moment in all the below tables at worker2
SELECT * from table_to_split_1;
id | value
@ -88,12 +94,6 @@ SELECT * from table_to_split_3;
---------------------------------------------------------------------
(0 rows)
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- Insert data in table_to_split_1 at worker1
\c - - - :worker_1_port
INSERT into table_to_split_1 values(100, 'a');
@ -117,7 +117,7 @@ SELECT * from table_to_split_3;
---------------------------------------------------------------------
(0 rows)
select pg_sleep(10);
select pg_sleep(2);
pg_sleep
---------------------------------------------------------------------
@ -125,12 +125,6 @@ select pg_sleep(10);
-- Expect data to be present in shard xxxxx and shard xxxxx based on the hash value.
\c - - - :worker_2_port
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
SELECT * from table_to_split_1; -- should alwasy have zero rows
id | value
---------------------------------------------------------------------
@ -154,7 +148,7 @@ SELECT * from table_to_split_3;
UPDATE table_to_split_1 SET value='b' where id = 100;
UPDATE table_to_split_1 SET value='b' where id = 400;
UPDATE table_to_split_1 SET value='b' where id = 500;
SELECT pg_sleep(10);
SELECT pg_sleep(2);
pg_sleep
---------------------------------------------------------------------
@ -182,7 +176,7 @@ SELECT * FROM table_to_split_3;
\c - - - :worker_1_port
DELETE FROM table_to_split_1;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
@ -232,12 +226,6 @@ select 1 from public.CreateReplicationSlot(:worker_1_node, :worker_2_node);
(1 row)
COMMIT;
SELECT pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- Create subscription at worker1 with copy_data to 'false' and derived replication slot name
BEGIN;
SELECT 1 from public.CreateSubscription(:worker_1_node, 'SUB1');
@ -247,6 +235,12 @@ SELECT 1 from public.CreateSubscription(:worker_1_node, 'SUB1');
(1 row)
COMMIT;
select pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
(1 row)
\c - - - :worker_2_port
-- Create subscription at worker2 with copy_data to 'false' and derived replication slot name
BEGIN;
@ -257,6 +251,12 @@ SELECT 1 from public.CreateSubscription(:worker_2_node, 'SUB2');
(1 row)
COMMIT;
select pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- No data is present at this moment in all the below tables at worker2
SELECT * from table_to_split_1;
id | value
@ -273,19 +273,13 @@ SELECT * from table_to_split_3;
---------------------------------------------------------------------
(0 rows)
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- Insert data in table_to_split_1 at worker1
\c - - - :worker_1_port
INSERT into table_to_split_1 values(100, 'a');
INSERT into table_to_split_1 values(400, 'a');
INSERT into table_to_split_1 values(500, 'a');
UPDATE table_to_split_1 SET value='b' where id = 400;
select pg_sleep(10);
select pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
@ -311,20 +305,8 @@ SELECT * from table_to_split_3;
---------------------------------------------------------------------
(0 rows)
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- Expect data to be present only in table_to_split3 on worker2
\c - - - :worker_2_port
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
SELECT * from table_to_split_1;
id | value
---------------------------------------------------------------------
@ -393,12 +375,6 @@ select 1 from public.CreateReplicationSlot(:worker_1_node, :worker_1_node);
(1 row)
COMMIT;
SELECT pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
-- Create subscription at worker1 with copy_data to 'false' and derived replication slot name
BEGIN;
SELECT 1 from public.CreateSubscription(:worker_1_node, 'SUB1');
@ -408,7 +384,7 @@ SELECT 1 from public.CreateSubscription(:worker_1_node, 'SUB1');
(1 row)
COMMIT;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
@ -417,7 +393,7 @@ SELECT pg_sleep(10);
INSERT into table_to_split_1 values(100, 'a');
INSERT into table_to_split_1 values(400, 'a');
INSERT into table_to_split_1 values(500, 'a');
select pg_sleep(10);
select pg_sleep(5);
pg_sleep
---------------------------------------------------------------------
@ -445,14 +421,8 @@ SELECT * from table_to_split_3;
500 | a
(2 rows)
select pg_sleep(10);
pg_sleep
---------------------------------------------------------------------
(1 row)
DELETE FROM table_to_split_1;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
pg_sleep
---------------------------------------------------------------------

View File

@ -51,7 +51,7 @@ COMMIT;
BEGIN;
select 1 from public.CreateReplicationSlotForColocatedShards(:worker_2_node, :worker_2_node);
COMMIT;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
\c - - - :worker_2_port
-- Create subscription at worker2 with copy_data to 'false' and derived replication slot name
@ -63,7 +63,7 @@ COMMIT;
SELECT * from table_first_4;
SELECT * from table_first_5;
SELECT * from table_first_6;
select pg_sleep(10);
-- Insert data in table_to_split_1 at worker1
\c - - - :worker_1_port
@ -82,11 +82,10 @@ INSERT into table_second_7 values(500, 'a');
SELECT * FROM table_second_7;
SELECT * FROM table_second_8;
SELECT * FROM table_second_9;
select pg_sleep(10);
select pg_sleep(5);
-- Expect data to be present in shard 5,6 and 8,9 based on the hash value.
\c - - - :worker_2_port
select pg_sleep(10);
SELECT * from table_first_4; -- should alwasy have zero rows
SELECT * from table_first_5;
SELECT * from table_first_6;

View File

@ -61,12 +61,13 @@ COMMIT;
BEGIN;
SELECT 1 from public.CreateSubscription(:worker_2_node, 'SUB1');
COMMIT;
select pg_sleep(5);
-- No data is present at this moment in all the below tables at worker2
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
select pg_sleep(10);
-- Insert data in table_to_split_1 at worker1
\c - - - :worker_1_port
@ -76,11 +77,10 @@ INSERT into table_to_split_1 values(500, 'a');
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
select pg_sleep(10);
select pg_sleep(2);
-- Expect data to be present in shard 2 and shard 3 based on the hash value.
\c - - - :worker_2_port
select pg_sleep(10);
SELECT * from table_to_split_1; -- should alwasy have zero rows
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
@ -90,7 +90,7 @@ SELECT * from table_to_split_3;
UPDATE table_to_split_1 SET value='b' where id = 100;
UPDATE table_to_split_1 SET value='b' where id = 400;
UPDATE table_to_split_1 SET value='b' where id = 500;
SELECT pg_sleep(10);
SELECT pg_sleep(2);
-- Value should be updated in table_to_split_2;
\c - - - :worker_2_port
@ -100,7 +100,7 @@ SELECT * FROM table_to_split_3;
\c - - - :worker_1_port
DELETE FROM table_to_split_1;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
-- Child shard rows should be deleted
\c - - - :worker_2_port
@ -134,24 +134,24 @@ COMMIT;
BEGIN;
select 1 from public.CreateReplicationSlot(:worker_1_node, :worker_2_node);
COMMIT;
SELECT pg_sleep(10);
-- Create subscription at worker1 with copy_data to 'false' and derived replication slot name
BEGIN;
SELECT 1 from public.CreateSubscription(:worker_1_node, 'SUB1');
COMMIT;
select pg_sleep(5);
\c - - - :worker_2_port
-- Create subscription at worker2 with copy_data to 'false' and derived replication slot name
BEGIN;
SELECT 1 from public.CreateSubscription(:worker_2_node, 'SUB2');
COMMIT;
select pg_sleep(5);
-- No data is present at this moment in all the below tables at worker2
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
select pg_sleep(10);
-- Insert data in table_to_split_1 at worker1
\c - - - :worker_1_port
@ -159,17 +159,15 @@ INSERT into table_to_split_1 values(100, 'a');
INSERT into table_to_split_1 values(400, 'a');
INSERT into table_to_split_1 values(500, 'a');
UPDATE table_to_split_1 SET value='b' where id = 400;
select pg_sleep(10);
select pg_sleep(5);
-- expect data to present in table_to_split_2 on worker1 as its destination for value '400'
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
select pg_sleep(10);
-- Expect data to be present only in table_to_split3 on worker2
\c - - - :worker_2_port
select pg_sleep(10);
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
@ -216,27 +214,26 @@ COMMIT;
BEGIN;
select 1 from public.CreateReplicationSlot(:worker_1_node, :worker_1_node);
COMMIT;
SELECT pg_sleep(10);
-- Create subscription at worker1 with copy_data to 'false' and derived replication slot name
BEGIN;
SELECT 1 from public.CreateSubscription(:worker_1_node, 'SUB1');
COMMIT;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
INSERT into table_to_split_1 values(100, 'a');
INSERT into table_to_split_1 values(400, 'a');
INSERT into table_to_split_1 values(500, 'a');
select pg_sleep(10);
select pg_sleep(5);
-- expect data to present in table_to_split_2/3 on worker1
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;
select pg_sleep(10);
DELETE FROM table_to_split_1;
SELECT pg_sleep(10);
SELECT pg_sleep(5);
SELECT * from table_to_split_1;
SELECT * from table_to_split_2;
SELECT * from table_to_split_3;