mirror of https://github.com/citusdata/citus.git
Fix VACUUM flakiness in multi_utilities (#7334)
When I run this test in my local, the size of the table after the DELETE command is around 58785792. Hence, I assume that the diffs suggest that the Vacuum had no effect. The current solution is to run the VACUUM command three times instead of once. Example diff: https://github.com/citusdata/citus/actions/runs/6722231142/attempts/1#summary-18269870674 ```diff insert into local_vacuum_table select i from generate_series(1,1000000) i; delete from local_vacuum_table; VACUUM local_vacuum_table; SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END FROM pg_total_relation_size('local_vacuum_table') s ; s ---------- - 22500000 + 58785792 (1 row) ``` See more diff examples in the PR description https://github.com/citusdata/citus/pull/7334pull/7009/merge
parent
c028d929b5
commit
57ff762c82
|
@ -207,6 +207,10 @@ DEPS = {
|
||||||
"multi_cluster_management",
|
"multi_cluster_management",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
"multi_utilities": TestDeps(
|
||||||
|
"minimal_schedule",
|
||||||
|
["multi_data_types"],
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,8 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
VACUUM local_vacuum_table;
|
VACUUM local_vacuum_table;
|
||||||
|
VACUUM local_vacuum_table;
|
||||||
|
VACUUM local_vacuum_table;
|
||||||
SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END
|
SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END
|
||||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
s
|
s
|
||||||
|
@ -401,6 +403,8 @@ VACUUM (DISABLE_PAGE_SKIPPING false) local_vacuum_table;
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
||||||
SELECT CASE WHEN s BETWEEN 50000000 AND 70000000 THEN 60000000 ELSE s END size
|
SELECT CASE WHEN s BETWEEN 50000000 AND 70000000 THEN 60000000 ELSE s END size
|
||||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
size
|
size
|
||||||
|
@ -411,6 +415,8 @@ FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
||||||
SELECT CASE WHEN s BETWEEN 20000000 AND 49999999 THEN 35000000 ELSE s END size
|
SELECT CASE WHEN s BETWEEN 20000000 AND 49999999 THEN 35000000 ELSE s END size
|
||||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
size
|
size
|
||||||
|
@ -422,10 +428,14 @@ FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
vacuum (TRUNCATE false) local_vacuum_table;
|
vacuum (TRUNCATE false) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE false) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE false) local_vacuum_table;
|
||||||
SELECT pg_total_relation_size('local_vacuum_table') as size1 \gset
|
SELECT pg_total_relation_size('local_vacuum_table') as size1 \gset
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
vacuum (TRUNCATE true) local_vacuum_table;
|
vacuum (TRUNCATE true) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE true) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE true) local_vacuum_table;
|
||||||
SELECT pg_total_relation_size('local_vacuum_table') as size2 \gset
|
SELECT pg_total_relation_size('local_vacuum_table') as size2 \gset
|
||||||
SELECT :size1 > :size2 as truncate_less_size;
|
SELECT :size1 > :size2 as truncate_less_size;
|
||||||
truncate_less_size
|
truncate_less_size
|
||||||
|
|
|
@ -229,6 +229,8 @@ VACUUM;
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
VACUUM local_vacuum_table;
|
VACUUM local_vacuum_table;
|
||||||
|
VACUUM local_vacuum_table;
|
||||||
|
VACUUM local_vacuum_table;
|
||||||
SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END
|
SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END
|
||||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
|
|
||||||
|
@ -257,12 +259,16 @@ VACUUM (DISABLE_PAGE_SKIPPING false) local_vacuum_table;
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP OFF, PARALLEL 1) local_vacuum_table;
|
||||||
SELECT CASE WHEN s BETWEEN 50000000 AND 70000000 THEN 60000000 ELSE s END size
|
SELECT CASE WHEN s BETWEEN 50000000 AND 70000000 THEN 60000000 ELSE s END size
|
||||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
|
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
||||||
|
VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
||||||
SELECT CASE WHEN s BETWEEN 20000000 AND 49999999 THEN 35000000 ELSE s END size
|
SELECT CASE WHEN s BETWEEN 20000000 AND 49999999 THEN 35000000 ELSE s END size
|
||||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
|
|
||||||
|
@ -270,11 +276,15 @@ FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
vacuum (TRUNCATE false) local_vacuum_table;
|
vacuum (TRUNCATE false) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE false) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE false) local_vacuum_table;
|
||||||
SELECT pg_total_relation_size('local_vacuum_table') as size1 \gset
|
SELECT pg_total_relation_size('local_vacuum_table') as size1 \gset
|
||||||
|
|
||||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||||
delete from local_vacuum_table;
|
delete from local_vacuum_table;
|
||||||
vacuum (TRUNCATE true) local_vacuum_table;
|
vacuum (TRUNCATE true) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE true) local_vacuum_table;
|
||||||
|
vacuum (TRUNCATE true) local_vacuum_table;
|
||||||
SELECT pg_total_relation_size('local_vacuum_table') as size2 \gset
|
SELECT pg_total_relation_size('local_vacuum_table') as size2 \gset
|
||||||
|
|
||||||
SELECT :size1 > :size2 as truncate_less_size;
|
SELECT :size1 > :size2 as truncate_less_size;
|
||||||
|
|
Loading…
Reference in New Issue