Merge pull request #5522 from citusdata/fix_metadata_sync_fails_on_failure_connection_establishment

Fix metadata sync fails on failure_connection_establishment
pull/5527/head
Halil Ozan Akgül 2021-12-14 10:12:45 +03:00 committed by GitHub
commit 31ffb0981d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 12 deletions

View File

@ -44,7 +44,8 @@ SELECT citus.mitmproxy('conn.delay(500)');
(1 row)
ALTER TABLE products ADD CONSTRAINT p_key PRIMARY KEY(product_no);
ERROR: could not establish any connections to the node localhost:xxxxx after 400 ms
WARNING: could not establish connection after 400 ms
ERROR: connection to the remote node localhost:xxxxx failed
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
---------------------------------------------------------------------
@ -190,7 +191,7 @@ FROM
pg_dist_shard_placement
WHERE
shardstate = 3 AND
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'products'::regclass);
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'single_replicatated'::regclass);
invalid_placement_count
---------------------------------------------------------------------
0
@ -202,7 +203,7 @@ SELECT citus.mitmproxy('conn.delay(500)');
(1 row)
INSERT INTO products VALUES (100, '100', 100);
INSERT INTO single_replicatated VALUES (100);
ERROR: could not establish any connections to the node localhost:xxxxx after 400 ms
COMMIT;
SELECT
@ -211,14 +212,20 @@ FROM
pg_dist_shard_placement
WHERE
shardstate = 3 AND
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'products'::regclass);
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'single_replicatated'::regclass);
invalid_placement_count
---------------------------------------------------------------------
0
(1 row)
-- show that INSERT failed
SELECT count(*) FROM products WHERE product_no = 100;
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT count(*) FROM single_replicatated WHERE key = 100;
count
---------------------------------------------------------------------
0
@ -227,8 +234,6 @@ SELECT count(*) FROM products WHERE product_no = 100;
RESET client_min_messages;
-- verify get_global_active_transactions works when a timeout happens on a connection
SELECT get_global_active_transactions();
WARNING: could not establish connection after 400 ms
WARNING: connection to the remote node localhost:xxxxx failed
get_global_active_transactions
---------------------------------------------------------------------
(0 rows)

View File

@ -21,7 +21,6 @@ test: turn_mx_off
test: failure_create_distributed_table_non_empty
test: failure_create_table
test: failure_single_select
test: failure_connection_establishment
test: turn_mx_on
test: failure_multi_shard_update_delete
@ -35,6 +34,7 @@ test: failure_single_mod
test: failure_savepoints
test: failure_multi_row_insert
test: failure_mx_metadata_sync
test: failure_connection_establishment
# this test syncs metadata to the workers
test: failure_failover_to_local_execution

View File

@ -108,9 +108,9 @@ FROM
pg_dist_shard_placement
WHERE
shardstate = 3 AND
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'products'::regclass);
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'single_replicatated'::regclass);
SELECT citus.mitmproxy('conn.delay(500)');
INSERT INTO products VALUES (100, '100', 100);
INSERT INTO single_replicatated VALUES (100);
COMMIT;
SELECT
count(*) as invalid_placement_count
@ -118,10 +118,11 @@ FROM
pg_dist_shard_placement
WHERE
shardstate = 3 AND
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'products'::regclass);
shardid IN (SELECT shardid from pg_dist_shard where logicalrelid = 'single_replicatated'::regclass);
-- show that INSERT failed
SELECT count(*) FROM products WHERE product_no = 100;
SELECT citus.mitmproxy('conn.allow()');
SELECT count(*) FROM single_replicatated WHERE key = 100;
RESET client_min_messages;