Check if extversion is the same for seg extension

When we check the exact version of the seg extension, it becomes a
problem when its version changes, such as from 1.3 to 1.4. So now we
modified the changes to check for that the version is the same in all
the cluster.
pull/5209/head
Sait Talha Nisanci 2021-08-20 09:16:44 +03:00
parent ca0d4c3bde
commit 375a1adc9e
2 changed files with 20 additions and 15 deletions

View File

@ -161,10 +161,11 @@ SELECT run_command_on_workers($$SELECT count(extnamespace) FROM pg_extension WHE
(localhost,57637,t,1)
(1 row)
SELECT run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$);
run_command_on_workers
SELECT workers.result = pg_extension.extversion AS same_version
FROM run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$) workers, pg_extension WHERE extname = 'seg';
same_version
---------------------------------------------------------------------
(localhost,57637,t,1.3)
t
(1 row)
-- now create the reference table
@ -254,11 +255,12 @@ SELECT run_command_on_workers($$SELECT count(extnamespace) FROM pg_extension WHE
(localhost,57638,t,1)
(2 rows)
SELECT run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$);
run_command_on_workers
SELECT workers.result = pg_extension.extversion AS same_version
FROM run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$) workers, pg_extension WHERE extname = 'seg';
same_version
---------------------------------------------------------------------
(localhost,57637,t,1.3)
(localhost,57638,t,1.3)
t
t
(2 rows)
-- check for the unpackaged extension to be created correctly
@ -376,12 +378,12 @@ BEGIN;
ROLLBACK;
-- show that the CREATE EXTENSION command propagated even if the transaction
-- block is rollbacked, that's a shortcoming of dependency creation logic
SELECT run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$);
run_command_on_workers
SELECT COUNT(DISTINCT workers.result)
FROM run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$) workers;
count
---------------------------------------------------------------------
(localhost,57637,t,1.3)
(localhost,57638,t,1.3)
(2 rows)
1
(1 row)
-- drop the schema and all the objects
DROP SCHEMA "extension'test" CASCADE;

View File

@ -98,7 +98,8 @@ CREATE EXTENSION seg;
-- show that the extension is created on existing worker
SELECT run_command_on_workers($$SELECT count(extnamespace) FROM pg_extension WHERE extname = 'seg'$$);
SELECT run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$);
SELECT workers.result = pg_extension.extversion AS same_version
FROM run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$) workers, pg_extension WHERE extname = 'seg';
-- now create the reference table
CREATE TABLE ref_table_2 (x seg);
@ -144,7 +145,8 @@ SELECT 1 from master_add_node('localhost', :worker_2_port);
-- show that the extension is created on both existing and new node
SELECT run_command_on_workers($$SELECT count(extnamespace) FROM pg_extension WHERE extname = 'seg'$$);
SELECT run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$);
SELECT workers.result = pg_extension.extversion AS same_version
FROM run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$) workers, pg_extension WHERE extname = 'seg';
-- check for the unpackaged extension to be created correctly
SELECT run_command_on_workers($$SELECT count(extnamespace) FROM pg_extension WHERE extname = 'dict_int'$$);
@ -210,7 +212,8 @@ ROLLBACK;
-- show that the CREATE EXTENSION command propagated even if the transaction
-- block is rollbacked, that's a shortcoming of dependency creation logic
SELECT run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$);
SELECT COUNT(DISTINCT workers.result)
FROM run_command_on_workers($$SELECT extversion FROM pg_extension WHERE extname = 'seg'$$) workers;
-- drop the schema and all the objects
DROP SCHEMA "extension'test" CASCADE;