Add test to verify whether VACUUM runs remotely

Fails for now.
pull/1013/head
Jason Petersen 2016-12-01 12:35:44 -07:00
parent 6c333d464f
commit 257d9b49fd
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 58 additions and 0 deletions

View File

@ -66,3 +66,37 @@ SELECT master_apply_delete_command('DELETE FROM sharded_table');
-- drop table
DROP TABLE sharded_table;
-- VACUUM tests
-- create a table with a single shard (for convenience)
CREATE TABLE dustbunnies (id integer, name text);
SELECT master_create_distributed_table('dustbunnies', 'id', 'hash');
master_create_distributed_table
---------------------------------
(1 row)
SELECT master_create_worker_shards('dustbunnies', 1, 2);
master_create_worker_shards
-----------------------------
(1 row)
-- add some data to the distributed table
\copy dustbunnies from stdin with csv
-- delete all rows from the shard, then run VACUUM against the table on the master
DELETE FROM dustbunnies;
VACUUM dustbunnies;
-- update statistics, then verify that the four dead rows are gone
\c - - - :worker_1_port
SELECT pg_sleep(.500);
pg_sleep
----------
(1 row)
SELECT pg_stat_get_vacuum_count('dustbunnies_990002'::regclass);
pg_stat_get_vacuum_count
--------------------------
1
(1 row)

View File

@ -40,3 +40,27 @@ SELECT master_apply_delete_command('DELETE FROM sharded_table');
-- drop table
DROP TABLE sharded_table;
-- VACUUM tests
-- create a table with a single shard (for convenience)
CREATE TABLE dustbunnies (id integer, name text);
SELECT master_create_distributed_table('dustbunnies', 'id', 'hash');
SELECT master_create_worker_shards('dustbunnies', 1, 2);
-- add some data to the distributed table
\copy dustbunnies from stdin with csv
1,bugs
2,babs
3,buster
4,roger
\.
-- delete all rows from the shard, then run VACUUM against the table on the master
DELETE FROM dustbunnies;
VACUUM dustbunnies;
-- update statistics, then verify that the four dead rows are gone
\c - - - :worker_1_port
SELECT pg_sleep(.500);
SELECT pg_stat_get_vacuum_count('dustbunnies_990002'::regclass);