mirror of https://github.com/citusdata/citus.git
131 lines
4.1 KiB
Plaintext
131 lines
4.1 KiB
Plaintext
-- We have different output files for the executor. This is because
|
|
-- we don't mark transactions with ANALYZE as critical anymore, and
|
|
-- get WARNINGs instead of ERRORs.
|
|
SET citus.next_shard_id TO 12000000;
|
|
SELECT citus.mitmproxy('conn.allow()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SET citus.shard_count = 1;
|
|
SET citus.shard_replication_factor = 2; -- one shard per worker
|
|
SET citus.multi_shard_commit_protocol TO '1pc';
|
|
CREATE TABLE vacuum_test (key int, value int);
|
|
SELECT create_distributed_table('vacuum_test', 'key');
|
|
create_distributed_table
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT citus.clear_network_traffic();
|
|
clear_network_traffic
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM").kill()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
VACUUM vacuum_test;
|
|
ERROR: connection error: localhost:xxxxx
|
|
DETAIL: server closed the connection unexpectedly
|
|
This probably means the server terminated abnormally
|
|
before or while processing the request.
|
|
SELECT citus.mitmproxy('conn.onQuery(query="^ANALYZE").kill()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
ANALYZE vacuum_test;
|
|
WARNING: connection error: localhost:xxxxx
|
|
DETAIL: server closed the connection unexpectedly
|
|
This probably means the server terminated abnormally
|
|
before or while processing the request.
|
|
SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").kill()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
ANALYZE vacuum_test;
|
|
-- ANALYZE transactions being critical is an open question, see #2430
|
|
-- show that we marked as INVALID on COMMIT FAILURE
|
|
SELECT shardid, shardstate FROM pg_dist_shard_placement where shardstate != 1 AND
|
|
shardid in ( SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'vacuum_test'::regclass);
|
|
shardid | shardstate
|
|
---------------------------------------------------------------------
|
|
12000000 | 3
|
|
(1 row)
|
|
|
|
UPDATE pg_dist_shard_placement SET shardstate = 1
|
|
WHERE shardid IN (
|
|
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()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE other_vacuum_test (key int, value int);
|
|
SELECT create_distributed_table('other_vacuum_test', 'key');
|
|
create_distributed_table
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").kill()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
VACUUM vacuum_test, other_vacuum_test;
|
|
ERROR: syntax error at or near ","
|
|
SELECT citus.mitmproxy('conn.onQuery(query="^VACUUM.*other").cancel(' || pg_backend_pid() || ')');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
VACUUM vacuum_test, other_vacuum_test;
|
|
ERROR: syntax error at or near ","
|
|
-- ==== Clean up, we're done here ====
|
|
SELECT citus.mitmproxy('conn.allow()');
|
|
mitmproxy
|
|
---------------------------------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
DROP TABLE vacuum_test, other_vacuum_test;
|