mirror of https://github.com/citusdata/citus.git
Merge pull request #1762 from citusdata/check_connection_status
Check connection status before using itpull/1764/head
commit
5984e7f009
|
@ -424,7 +424,7 @@ SendRemoteCommandParams(MultiConnection *connection, const char *command,
|
||||||
* Don't try to send command if connection is entirely gone
|
* Don't try to send command if connection is entirely gone
|
||||||
* (PQisnonblocking() would crash).
|
* (PQisnonblocking() would crash).
|
||||||
*/
|
*/
|
||||||
if (!pgConn)
|
if (!pgConn || PQstatus(pgConn) != CONNECTION_OK)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ SendRemoteCommand(MultiConnection *connection, const char *command)
|
||||||
* Don't try to send command if connection is entirely gone
|
* Don't try to send command if connection is entirely gone
|
||||||
* (PQisnonblocking() would crash).
|
* (PQisnonblocking() would crash).
|
||||||
*/
|
*/
|
||||||
if (!pgConn)
|
if (!pgConn || PQstatus(pgConn) != CONNECTION_OK)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -713,6 +713,12 @@ SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
1
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- test adding an invalid node while we have reference tables to replicate
|
||||||
|
-- set client message level to ERROR to suppress OS-dependent host name resolution warnings
|
||||||
|
SET client_min_messages to ERROR;
|
||||||
|
SELECT master_add_node('invalid-node-name', 9999);
|
||||||
|
ERROR: failure on connection marked as essential: invalid-node-name:9999
|
||||||
|
SET client_min_messages to DEFAULT;
|
||||||
-- drop unnecassary tables
|
-- drop unnecassary tables
|
||||||
DROP TABLE initially_not_replicated_reference_table;
|
DROP TABLE initially_not_replicated_reference_table;
|
||||||
-- reload pg_dist_shard_placement table
|
-- reload pg_dist_shard_placement table
|
||||||
|
|
|
@ -2151,7 +2151,7 @@ GRANT INSERT ON ALL TABLES IN SCHEMA public TO router_user;
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO failure_test VALUES (1, 1);
|
INSERT INTO failure_test VALUES (1, 1);
|
||||||
WARNING: connection error: localhost:57638
|
WARNING: connection error: localhost:57638
|
||||||
DETAIL: no connection to the server
|
DETAIL: FATAL: role "router_user" does not exist
|
||||||
SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement
|
SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement
|
||||||
WHERE shardid IN (
|
WHERE shardid IN (
|
||||||
SELECT shardid FROM pg_dist_shard
|
SELECT shardid FROM pg_dist_shard
|
||||||
|
@ -2169,7 +2169,7 @@ SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
INSERT INTO failure_test VALUES (2, 1);
|
INSERT INTO failure_test VALUES (2, 1);
|
||||||
WARNING: connection error: localhost:57638
|
WARNING: connection error: localhost:57638
|
||||||
DETAIL: no connection to the server
|
DETAIL: FATAL: role "router_user" does not exist
|
||||||
SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement
|
SELECT shardid, shardstate, nodename, nodeport FROM pg_dist_shard_placement
|
||||||
WHERE shardid IN (
|
WHERE shardid IN (
|
||||||
SELECT shardid FROM pg_dist_shard
|
SELECT shardid FROM pg_dist_shard
|
||||||
|
|
|
@ -457,6 +457,13 @@ ORDER BY 1,4,5;
|
||||||
-- this should have no effect
|
-- this should have no effect
|
||||||
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
|
|
||||||
|
-- test adding an invalid node while we have reference tables to replicate
|
||||||
|
-- set client message level to ERROR to suppress OS-dependent host name resolution warnings
|
||||||
|
SET client_min_messages to ERROR;
|
||||||
|
SELECT master_add_node('invalid-node-name', 9999);
|
||||||
|
|
||||||
|
SET client_min_messages to DEFAULT;
|
||||||
|
|
||||||
-- drop unnecassary tables
|
-- drop unnecassary tables
|
||||||
DROP TABLE initially_not_replicated_reference_table;
|
DROP TABLE initially_not_replicated_reference_table;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue