mirror of https://github.com/citusdata/citus.git
Add cancellation tests for VACUUM/ANALYZE
parent
c58bb37ad7
commit
7b4d912904
|
@ -67,6 +67,31 @@ UPDATE pg_dist_shard_placement SET shardstate = 1
|
||||||
WHERE shardid IN (
|
WHERE shardid IN (
|
||||||
SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass
|
SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass
|
||||||
);
|
);
|
||||||
|
-- the same tests with cancel
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
VACUUM vacuum_test;
|
||||||
|
ERROR: canceling statement due to user request
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^ANALYZE").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
ANALYZE vacuum_test;
|
||||||
|
ERROR: canceling statement due to user request
|
||||||
|
-- cancel during COMMIT should be ignored
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
ANALYZE vacuum_test;
|
||||||
SELECT citus.mitmproxy('conn.allow()');
|
SELECT citus.mitmproxy('conn.allow()');
|
||||||
mitmproxy
|
mitmproxy
|
||||||
-----------
|
-----------
|
||||||
|
@ -91,6 +116,14 @@ ERROR: server closed the connection unexpectedly
|
||||||
This probably means the server terminated abnormally
|
This probably means the server terminated abnormally
|
||||||
before or while processing the request.
|
before or while processing the request.
|
||||||
CONTEXT: while executing command on localhost:9060
|
CONTEXT: while executing command on localhost:9060
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
VACUUM vacuum_test, other_vacuum_test;
|
||||||
|
ERROR: canceling statement due to user request
|
||||||
-- ==== Clean up, we're done here ====
|
-- ==== Clean up, we're done here ====
|
||||||
SELECT citus.mitmproxy('conn.allow()');
|
SELECT citus.mitmproxy('conn.allow()');
|
||||||
mitmproxy
|
mitmproxy
|
||||||
|
|
|
@ -67,6 +67,31 @@ UPDATE pg_dist_shard_placement SET shardstate = 1
|
||||||
WHERE shardid IN (
|
WHERE shardid IN (
|
||||||
SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass
|
SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass
|
||||||
);
|
);
|
||||||
|
-- the same tests with cancel
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
VACUUM vacuum_test;
|
||||||
|
ERROR: canceling statement due to user request
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^ANALYZE").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
ANALYZE vacuum_test;
|
||||||
|
ERROR: canceling statement due to user request
|
||||||
|
-- cancel during COMMIT should be ignored
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
ANALYZE vacuum_test;
|
||||||
SELECT citus.mitmproxy('conn.allow()');
|
SELECT citus.mitmproxy('conn.allow()');
|
||||||
mitmproxy
|
mitmproxy
|
||||||
-----------
|
-----------
|
||||||
|
@ -86,6 +111,16 @@ SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").kill()');
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
VACUUM vacuum_test, other_vacuum_test;
|
||||||
|
ERROR: syntax error at or near ","
|
||||||
|
LINE 1: VACUUM vacuum_test, other_vacuum_test;
|
||||||
|
^
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").cancel(' || pg_backend_pid() || ')');
|
||||||
|
mitmproxy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
VACUUM vacuum_test, other_vacuum_test;
|
VACUUM vacuum_test, other_vacuum_test;
|
||||||
ERROR: syntax error at or near ","
|
ERROR: syntax error at or near ","
|
||||||
LINE 1: VACUUM vacuum_test, other_vacuum_test;
|
LINE 1: VACUUM vacuum_test, other_vacuum_test;
|
||||||
|
|
|
@ -28,6 +28,17 @@ WHERE shardid IN (
|
||||||
SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass
|
SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- the same tests with cancel
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM").cancel(' || pg_backend_pid() || ')');
|
||||||
|
VACUUM vacuum_test;
|
||||||
|
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^ANALYZE").cancel(' || pg_backend_pid() || ')');
|
||||||
|
ANALYZE vacuum_test;
|
||||||
|
|
||||||
|
-- cancel during COMMIT should be ignored
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").cancel(' || pg_backend_pid() || ')');
|
||||||
|
ANALYZE vacuum_test;
|
||||||
|
|
||||||
SELECT citus.mitmproxy('conn.allow()');
|
SELECT citus.mitmproxy('conn.allow()');
|
||||||
|
|
||||||
CREATE TABLE other_vacuum_test (key int, value int);
|
CREATE TABLE other_vacuum_test (key int, value int);
|
||||||
|
@ -37,6 +48,10 @@ SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").kill()');
|
||||||
|
|
||||||
VACUUM vacuum_test, other_vacuum_test;
|
VACUUM vacuum_test, other_vacuum_test;
|
||||||
|
|
||||||
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").cancel(' || pg_backend_pid() || ')');
|
||||||
|
|
||||||
|
VACUUM vacuum_test, other_vacuum_test;
|
||||||
|
|
||||||
-- ==== Clean up, we're done here ====
|
-- ==== Clean up, we're done here ====
|
||||||
|
|
||||||
SELECT citus.mitmproxy('conn.allow()');
|
SELECT citus.mitmproxy('conn.allow()');
|
||||||
|
|
Loading…
Reference in New Issue