From b1619e182d817d1e2eff522fcb8af6a531434fe4 Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Fri, 11 May 2018 11:36:16 +0300 Subject: [PATCH 1/4] Make sure windows are build with the latest version --- citus.control | 2 +- windows/include/citus_version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/citus.control b/citus.control index 5493b8234..71a541d86 100644 --- a/citus.control +++ b/citus.control @@ -1,6 +1,6 @@ # Citus extension comment = 'Citus distributed database' -default_version = '7.4-1' +default_version = '7.4-3' module_pathname = '$libdir/citus' relocatable = false schema = pg_catalog diff --git a/windows/include/citus_version.h b/windows/include/citus_version.h index fb3921196..83bc95efe 100644 --- a/windows/include/citus_version.h +++ b/windows/include/citus_version.h @@ -5,7 +5,7 @@ #define CITUS_EDITION "community" /* Extension version expected by this Citus build */ -#define CITUS_EXTENSIONVERSION "7.4-1" +#define CITUS_EXTENSIONVERSION "7.4-3" /* Citus major version as a string */ #define CITUS_MAJORVERSION "7.4" From 12e50d96dc4332cfa517a46c997f801c2e599c6b Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Fri, 11 May 2018 16:01:47 +0300 Subject: [PATCH 2/4] Fix tests where hll is not installed --- .../expected/multi_agg_approximate_distinct_0.out | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/test/regress/expected/multi_agg_approximate_distinct_0.out b/src/test/regress/expected/multi_agg_approximate_distinct_0.out index 6879f5a99..355fdda25 100644 --- a/src/test/regress/expected/multi_agg_approximate_distinct_0.out +++ b/src/test/regress/expected/multi_agg_approximate_distinct_0.out @@ -87,6 +87,8 @@ ERROR: cannot compute count (distinct) approximation HINT: You need to have the hll extension loaded. -- Check that approximate count(distinct) works at a table in a schema other than public -- create necessary objects +SET citus.next_shard_id TO 20000000; +SET citus.next_placement_id TO 20000000; CREATE SCHEMA test_count_distinct_schema; CREATE TABLE test_count_distinct_schema.nation_hash( n_nationkey integer not null, @@ -94,15 +96,9 @@ CREATE TABLE test_count_distinct_schema.nation_hash( n_regionkey integer not null, n_comment varchar(152) ); -SELECT master_create_distributed_table('test_count_distinct_schema.nation_hash', 'n_nationkey', 'hash'); - master_create_distributed_table ---------------------------------- - -(1 row) - -SELECT master_create_worker_shards('test_count_distinct_schema.nation_hash', 4, 2); - master_create_worker_shards ------------------------------ +SELECT create_distributed_table('test_count_distinct_schema.nation_hash', 'n_nationkey', 'hash'); + create_distributed_table +-------------------------- (1 row) From ed47e4e6b9216e626a64dbe991896ac3c205abec Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Fri, 11 May 2018 17:04:50 +0300 Subject: [PATCH 3/4] Remove placementId from the ORDER BY to make results consistent --- src/test/regress/input/multi_copy.source | 10 ++++---- src/test/regress/output/multi_copy.source | 30 +++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/test/regress/input/multi_copy.source b/src/test/regress/input/multi_copy.source index fa4fe9325..0db3abbea 100644 --- a/src/test/regress/input/multi_copy.source +++ b/src/test/regress/input/multi_copy.source @@ -632,7 +632,7 @@ COPY numbers_hash FROM STDIN WITH (FORMAT 'csv'); -- verify each placement is active SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport; -- create a reference table CREATE TABLE numbers_reference(a int, b int); @@ -647,7 +647,7 @@ CREATE TABLE numbers_hash_other(a int, b int); SELECT create_distributed_table('numbers_hash_other', 'a'); SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport; -- manually corrupt pg_dist_shard such that both copies of one shard is placed in -- worker_1. This is to test the behavior when no replica of a shard is accessible. @@ -675,7 +675,7 @@ COPY numbers_hash FROM STDIN WITH (FORMAT 'csv'); -- verify shards in the first worker as marked invalid SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport; -- try to insert into a reference table copy should fail COPY numbers_reference FROM STDIN WITH (FORMAT 'csv'); @@ -702,7 +702,7 @@ COPY numbers_hash_other FROM STDIN WITH (FORMAT 'csv'); -- since copy has failed altogether SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport; -- re-enable test_user on the first worker \c - :default_user - :worker_1_port @@ -748,7 +748,7 @@ SELECT count(a) FROM numbers_hash; -- verify shard is still marked as valid SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport; DROP TABLE numbers_hash; SELECT * FROM run_command_on_workers('DROP USER test_user'); diff --git a/src/test/regress/output/multi_copy.source b/src/test/regress/output/multi_copy.source index 6ebb8ff9d..063463328 100644 --- a/src/test/regress/output/multi_copy.source +++ b/src/test/regress/output/multi_copy.source @@ -826,15 +826,15 @@ COPY numbers_hash FROM STDIN WITH (FORMAT 'csv'); -- verify each placement is active SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport; shardid | shardstate | nodename | nodeport ---------+------------+-----------+---------- - 560171 | 1 | localhost | 57638 560171 | 1 | localhost | 57637 + 560171 | 1 | localhost | 57638 560172 | 1 | localhost | 57637 560172 | 1 | localhost | 57638 - 560173 | 1 | localhost | 57638 560173 | 1 | localhost | 57637 + 560173 | 1 | localhost | 57638 560174 | 1 | localhost | 57637 560174 | 1 | localhost | 57638 (8 rows) @@ -858,17 +858,17 @@ SELECT create_distributed_table('numbers_hash_other', 'a'); SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport; shardid | shardstate | nodename | nodeport ---------+------------+-----------+---------- 560176 | 1 | localhost | 57637 560176 | 1 | localhost | 57638 - 560177 | 1 | localhost | 57638 560177 | 1 | localhost | 57637 + 560177 | 1 | localhost | 57638 560178 | 1 | localhost | 57637 560178 | 1 | localhost | 57638 - 560179 | 1 | localhost | 57638 560179 | 1 | localhost | 57637 + 560179 | 1 | localhost | 57638 (8 rows) -- manually corrupt pg_dist_shard such that both copies of one shard is placed in @@ -897,15 +897,15 @@ CONTEXT: COPY numbers_hash, line 6: "6,6" -- verify shards in the first worker as marked invalid SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport; shardid | shardstate | nodename | nodeport ---------+------------+-----------+---------- - 560171 | 1 | localhost | 57638 560171 | 3 | localhost | 57637 + 560171 | 1 | localhost | 57638 560172 | 3 | localhost | 57637 560172 | 1 | localhost | 57638 - 560173 | 1 | localhost | 57638 560173 | 3 | localhost | 57637 + 560173 | 1 | localhost | 57638 560174 | 3 | localhost | 57637 560174 | 1 | localhost | 57638 (8 rows) @@ -941,17 +941,17 @@ CONTEXT: COPY numbers_hash_other, line 1: "1,1" -- since copy has failed altogether SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport; shardid | shardstate | nodename | nodeport ---------+------------+-----------+---------- 560176 | 1 | localhost | 57637 560176 | 1 | localhost | 57637 - 560177 | 1 | localhost | 57638 560177 | 1 | localhost | 57637 + 560177 | 1 | localhost | 57638 560178 | 1 | localhost | 57637 560178 | 1 | localhost | 57638 - 560179 | 1 | localhost | 57638 560179 | 1 | localhost | 57637 + 560179 | 1 | localhost | 57638 (8 rows) -- re-enable test_user on the first worker @@ -993,15 +993,15 @@ SELECT count(a) FROM numbers_hash; -- verify shard is still marked as valid SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement join pg_dist_shard using(shardid) - WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport; + WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport; shardid | shardstate | nodename | nodeport ---------+------------+-----------+---------- - 560180 | 1 | localhost | 57638 560180 | 1 | localhost | 57637 + 560180 | 1 | localhost | 57638 560181 | 1 | localhost | 57637 560181 | 1 | localhost | 57638 - 560182 | 1 | localhost | 57638 560182 | 1 | localhost | 57637 + 560182 | 1 | localhost | 57638 560183 | 1 | localhost | 57637 560183 | 1 | localhost | 57638 (8 rows) From 61d2c0f618d411389d9686f6db6cfceca80fc6be Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Fri, 11 May 2018 07:29:56 +0200 Subject: [PATCH 4/4] Stabilise output of multi_shard_update_delete test --- .../expected/multi_shard_update_delete.out | 32 +++++++++---------- .../expected/multi_shard_update_delete_0.out | 32 +++++++++---------- .../regress/sql/multi_shard_update_delete.sql | 4 +-- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/test/regress/expected/multi_shard_update_delete.out b/src/test/regress/expected/multi_shard_update_delete.out index ce597cafc..c4188e65b 100644 --- a/src/test/regress/expected/multi_shard_update_delete.out +++ b/src/test/regress/expected/multi_shard_update_delete.out @@ -393,20 +393,20 @@ WHERE user_id IN (SELECT user_id FROM users_test_table UNION SELECT user_id - FROM events_test_table) returning *; - user_id | value_1 | value_2 | value_3 ----------+---------+---------+--------- - 8 | 4 | 13 | 0 - 20 | 4 | | 0 - 20 | 4 | | 0 - 20 | 4 | | 0 - 4 | 4 | 9 | 0 - 4 | 4 | 17 | 0 - 16 | 4 | | 0 - 6 | 4 | 11 | 0 - 6 | 4 | 15 | 0 - 2 | 4 | 7 | 0 - 2 | 4 | 19 | 0 + FROM events_test_table) returning value_3; + value_3 +--------- + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 (11 rows) UPDATE users_test_table @@ -750,11 +750,11 @@ ERROR: more than one row returned by a subquery used as an expression CONTEXT: while executing command on localhost:57637 -- Cursors are not supported BEGIN; -DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table; +DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table ORDER BY user_id; FETCH test_cursor; user_id | value_1 | value_2 | value_3 ---------+---------+---------+--------- - 8 | 4 | 0 | 0 + 1 | 2 | 5 | 0 (1 row) UPDATE users_test_table SET value_2 = 5 WHERE CURRENT OF test_cursor; diff --git a/src/test/regress/expected/multi_shard_update_delete_0.out b/src/test/regress/expected/multi_shard_update_delete_0.out index 3d340c29a..0181e1828 100644 --- a/src/test/regress/expected/multi_shard_update_delete_0.out +++ b/src/test/regress/expected/multi_shard_update_delete_0.out @@ -416,20 +416,20 @@ WHERE user_id IN (SELECT user_id FROM users_test_table UNION SELECT user_id - FROM events_test_table) returning *; - user_id | value_1 | value_2 | value_3 ----------+---------+---------+--------- - 8 | 4 | 13 | 0 - 20 | 4 | | 0 - 20 | 4 | | 0 - 20 | 4 | | 0 - 4 | 4 | 9 | 0 - 4 | 4 | 17 | 0 - 16 | 4 | | 0 - 6 | 4 | 11 | 0 - 6 | 4 | 15 | 0 - 2 | 4 | 7 | 0 - 2 | 4 | 19 | 0 + FROM events_test_table) returning value_3; + value_3 +--------- + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 (11 rows) UPDATE users_test_table @@ -773,11 +773,11 @@ ERROR: more than one row returned by a subquery used as an expression CONTEXT: while executing command on localhost:57637 -- Cursors are not supported BEGIN; -DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table; +DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table ORDER BY user_id; FETCH test_cursor; user_id | value_1 | value_2 | value_3 ---------+---------+---------+--------- - 8 | 4 | 0 | 0 + 1 | 2 | 5 | 0 (1 row) UPDATE users_test_table SET value_2 = 5 WHERE CURRENT OF test_cursor; diff --git a/src/test/regress/sql/multi_shard_update_delete.sql b/src/test/regress/sql/multi_shard_update_delete.sql index 147db404c..ad6bf5d34 100644 --- a/src/test/regress/sql/multi_shard_update_delete.sql +++ b/src/test/regress/sql/multi_shard_update_delete.sql @@ -306,7 +306,7 @@ WHERE user_id IN (SELECT user_id FROM users_test_table UNION SELECT user_id - FROM events_test_table) returning *; + FROM events_test_table) returning value_3; UPDATE users_test_table SET value_1 = 4 @@ -634,7 +634,7 @@ WHERE users_test_table.user_id = (SELECT user_id -- Cursors are not supported BEGIN; -DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table; +DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table ORDER BY user_id; FETCH test_cursor; UPDATE users_test_table SET value_2 = 5 WHERE CURRENT OF test_cursor; ROLLBACK;