Merge pull request #3403 from citusdata/fix-rollback-savepoint-hang

Check connections from connection_placement before polling
pull/3722/head
Philip Dubé 2020-04-06 18:04:03 +00:00 committed by GitHub
commit 6a6d5af8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

View File

@ -2102,6 +2102,13 @@ RunDistributedExecution(DistributedExecution *execution)
PG_TRY();
{
/* Preemptively step state machines in case of immediate errors */
WorkerSession *session = NULL;
foreach_ptr(session, execution->sessionList)
{
ConnectionStateMachine(session);
}
bool cancellationReceived = false;
int eventSetSize = GetEventSetSize(execution->sessionList);

View File

@ -342,6 +342,39 @@ WHERE shardstate = 3 AND shardid IN (
(0 rows)
TRUNCATE researchers;
-- test that we don't mark reference placements unhealthy
CREATE TABLE ref(a int, b int);
SELECT create_reference_table('ref');
create_reference_table
---------------------------------------------------------------------
(1 row)
SELECT citus.mitmproxy('conn.onQuery(query="^ROLLBACK").kill()');
mitmproxy
---------------------------------------------------------------------
(1 row)
BEGIN;
SAVEPOINT start;
INSERT INTO ref VALUES (1001,2);
SELECT * FROM ref;
a | b
---------------------------------------------------------------------
1001 | 2
(1 row)
ROLLBACK TO SAVEPOINT start;
WARNING: connection not open
WARNING: connection not open
SELECT * FROM ref;
WARNING: connection not open
WARNING: connection error: localhost:xxxxx
WARNING: connection not open
WARNING: connection not open
ERROR: connection error: localhost:xxxxx
END;
-- clean up
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
@ -351,3 +384,4 @@ SELECT citus.mitmproxy('conn.allow()');
DROP TABLE artists;
DROP TABLE researchers;
DROP TABLE ref;

View File

@ -188,7 +188,21 @@ WHERE shardstate = 3 AND shardid IN (
) RETURNING placementid;
TRUNCATE researchers;
-- test that we don't mark reference placements unhealthy
CREATE TABLE ref(a int, b int);
SELECT create_reference_table('ref');
SELECT citus.mitmproxy('conn.onQuery(query="^ROLLBACK").kill()');
BEGIN;
SAVEPOINT start;
INSERT INTO ref VALUES (1001,2);
SELECT * FROM ref;
ROLLBACK TO SAVEPOINT start;
SELECT * FROM ref;
END;
-- clean up
SELECT citus.mitmproxy('conn.allow()');
DROP TABLE artists;
DROP TABLE researchers;
DROP TABLE ref;