not continue in sequential execution if a cancellation is received (#3289)

pull/3290/head
SaitTalhaNisanci 2019-12-12 17:22:30 +03:00 committed by GitHub
parent 0cd14449f3
commit 053fe18404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -1808,6 +1808,13 @@ SequentialRunDistributedExecution(DistributedExecution *execution)
execution->totalTaskCount = 1; execution->totalTaskCount = 1;
execution->unfinishedTaskCount = 1; execution->unfinishedTaskCount = 1;
CHECK_FOR_INTERRUPTS();
if (InterruptHoldoffCount > 0 && (QueryCancelPending || ProcDiePending))
{
break;
}
/* simply call the regular execution function */ /* simply call the regular execution function */
RunDistributedExecution(execution); RunDistributedExecution(execution);
} }

View File

@ -134,6 +134,23 @@ SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").cancel(' || :pid || ')');
INSERT INTO reference_table VALUES (1), (2), (3), (4); INSERT INTO reference_table VALUES (1), (2), (3), (4);
ERROR: canceling statement due to user request ERROR: canceling statement due to user request
SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").cancel(' || :pid || ')');
mitmproxy
-----------
(1 row)
INSERT INTO distributed_table VALUES (1,1), (2,2), (3,3), (4,2), (5,2), (6,2), (7,2);
ERROR: canceling statement due to user request
-- cancel the second insert over the same connection
SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").after(1).cancel(' || :pid || ')');
mitmproxy
-----------
(1 row)
INSERT INTO distributed_table VALUES (1,1), (2,2), (3,3), (4,2), (5,2), (6,2), (7,2);
ERROR: canceling statement due to user request
-- we've either failed or cancelled all queries, so should be empty -- we've either failed or cancelled all queries, so should be empty
SELECT * FROM distributed_table; SELECT * FROM distributed_table;
key | value key | value

View File

@ -70,6 +70,13 @@ INSERT INTO distributed_table VALUES (2,21), (1,22);
SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").cancel(' || :pid || ')'); SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").cancel(' || :pid || ')');
INSERT INTO reference_table VALUES (1), (2), (3), (4); INSERT INTO reference_table VALUES (1), (2), (3), (4);
SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").cancel(' || :pid || ')');
INSERT INTO distributed_table VALUES (1,1), (2,2), (3,3), (4,2), (5,2), (6,2), (7,2);
-- cancel the second insert over the same connection
SELECT citus.mitmproxy('conn.onQuery(query="^INSERT").after(1).cancel(' || :pid || ')');
INSERT INTO distributed_table VALUES (1,1), (2,2), (3,3), (4,2), (5,2), (6,2), (7,2);
-- we've either failed or cancelled all queries, so should be empty -- we've either failed or cancelled all queries, so should be empty
SELECT * FROM distributed_table; SELECT * FROM distributed_table;
SELECT * FROM reference_table; SELECT * FROM reference_table;