mirror of https://github.com/citusdata/citus.git
Fixes flaky VACUUM (freeze, process toast true) result (#7348)
https://app.circleci.com/pipelines/github/citusdata/citus/34550/workflows/5b802f66-2666-4623-a209-6d7799f7ee5f/jobs/1229153
```diff
VACUUM (FREEZE, PROCESS_TOAST true) local_vacuum_table;
SELECT relfrozenxid::text::integer > :frozenxid AS frozen_performed FROM pg_class
WHERE oid=:reltoastrelid::regclass;
frozen_performed
------------------
- t
+ f
(1 row)
```
Process toast option in vacuum was introduced in PG14. The failing test
was supposed to be a part of `multi_utilities.sql`, but it was included
in `pg14.sql` to avoid alternative output for PG13. See
ba62c0a148 (diff-ed03478f693155e2fe092e9ad356bf884dc097f554e8d75eff562d52bbcf7a75L255-L272)
for reference.
However, now that we don't support PG13 anymore, we can move this test
to `multi_utilities.sql`. Moving the test, plus inserting data before
running vacuum freeze such that the freeze is more meaningful and not
flaky, fixes the flakiness problem of the test.
reassign_owned_prop_onur
parent
c88bf5ff1c
commit
cedcc220bf
|
@ -424,6 +424,34 @@ FROM pg_total_relation_size('local_vacuum_table') s ;
|
|||
35000000
|
||||
(1 row)
|
||||
|
||||
-- vacuum (process_toast true) should be vacuuming toast tables (default is true)
|
||||
select reltoastrelid from pg_class where relname='local_vacuum_table'
|
||||
\gset
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
insert into local_vacuum_table select i from generate_series(1,10000) i;
|
||||
VACUUM (FREEZE, PROCESS_TOAST true) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer > :frozenxid AS frozen_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
frozen_performed
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
delete from local_vacuum_table;
|
||||
-- vacuum (process_toast false) should not be vacuuming toast tables (default is true)
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
insert into local_vacuum_table select i from generate_series(1,10000) i;
|
||||
VACUUM (FREEZE, PROCESS_TOAST false) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer = :frozenxid AS frozen_not_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
frozen_not_performed
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
delete from local_vacuum_table;
|
||||
-- vacuum (truncate false) should not attempt to truncate off any empty pages at the end of the table (default is true)
|
||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||
delete from local_vacuum_table;
|
||||
|
|
|
@ -71,32 +71,6 @@ NOTICE: issuing VACUUM (FULL,TRUNCATE false,INDEX_CLEANUP auto) pg14.t1_980000
|
|||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing VACUUM (FULL,TRUNCATE false,INDEX_CLEANUP auto) pg14.t1_980001
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
-- vacuum (process_toast true) should be vacuuming toast tables (default is true)
|
||||
CREATE TABLE local_vacuum_table(name text);
|
||||
select reltoastrelid from pg_class where relname='local_vacuum_table'
|
||||
\gset
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
VACUUM (FREEZE, PROCESS_TOAST true) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer > :frozenxid AS frozen_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
frozen_performed
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
-- vacuum (process_toast false) should not be vacuuming toast tables (default is true)
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
VACUUM (FREEZE, PROCESS_TOAST false) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer = :frozenxid AS frozen_not_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
frozen_not_performed
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
DROP TABLE local_vacuum_table;
|
||||
SET citus.log_remote_commands TO OFF;
|
||||
create table dist(a int, b int);
|
||||
select create_distributed_table('dist','a');
|
||||
|
@ -1492,4 +1466,5 @@ DROP TABLE compression_and_defaults, compression_and_generated_col;
|
|||
set client_min_messages to error;
|
||||
drop extension postgres_fdw cascade;
|
||||
drop schema pg14 cascade;
|
||||
DROP ROLE role_1, r1;
|
||||
reset client_min_messages;
|
||||
|
|
|
@ -272,6 +272,27 @@ VACUUM (INDEX_CLEANUP ON, PARALLEL 1) local_vacuum_table;
|
|||
SELECT CASE WHEN s BETWEEN 20000000 AND 49999999 THEN 35000000 ELSE s END size
|
||||
FROM pg_total_relation_size('local_vacuum_table') s ;
|
||||
|
||||
-- vacuum (process_toast true) should be vacuuming toast tables (default is true)
|
||||
select reltoastrelid from pg_class where relname='local_vacuum_table'
|
||||
\gset
|
||||
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
insert into local_vacuum_table select i from generate_series(1,10000) i;
|
||||
VACUUM (FREEZE, PROCESS_TOAST true) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer > :frozenxid AS frozen_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
delete from local_vacuum_table;
|
||||
|
||||
-- vacuum (process_toast false) should not be vacuuming toast tables (default is true)
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
insert into local_vacuum_table select i from generate_series(1,10000) i;
|
||||
VACUUM (FREEZE, PROCESS_TOAST false) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer = :frozenxid AS frozen_not_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
delete from local_vacuum_table;
|
||||
|
||||
-- vacuum (truncate false) should not attempt to truncate off any empty pages at the end of the table (default is true)
|
||||
insert into local_vacuum_table select i from generate_series(1,1000000) i;
|
||||
delete from local_vacuum_table;
|
||||
|
|
|
@ -22,25 +22,6 @@ VACUUM (INDEX_CLEANUP "AUTOX") t1;
|
|||
VACUUM (FULL, FREEZE, VERBOSE false, ANALYZE, SKIP_LOCKED, INDEX_CLEANUP, PROCESS_TOAST, TRUNCATE) t1;
|
||||
VACUUM (FULL, FREEZE false, VERBOSE false, ANALYZE false, SKIP_LOCKED false, INDEX_CLEANUP "Auto", PROCESS_TOAST true, TRUNCATE false) t1;
|
||||
|
||||
-- vacuum (process_toast true) should be vacuuming toast tables (default is true)
|
||||
CREATE TABLE local_vacuum_table(name text);
|
||||
select reltoastrelid from pg_class where relname='local_vacuum_table'
|
||||
\gset
|
||||
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
VACUUM (FREEZE, PROCESS_TOAST true) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer > :frozenxid AS frozen_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
|
||||
-- vacuum (process_toast false) should not be vacuuming toast tables (default is true)
|
||||
SELECT relfrozenxid AS frozenxid FROM pg_class WHERE oid=:reltoastrelid::regclass
|
||||
\gset
|
||||
VACUUM (FREEZE, PROCESS_TOAST false) local_vacuum_table;
|
||||
SELECT relfrozenxid::text::integer = :frozenxid AS frozen_not_performed FROM pg_class
|
||||
WHERE oid=:reltoastrelid::regclass;
|
||||
|
||||
DROP TABLE local_vacuum_table;
|
||||
SET citus.log_remote_commands TO OFF;
|
||||
|
||||
create table dist(a int, b int);
|
||||
|
@ -777,4 +758,5 @@ DROP TABLE compression_and_defaults, compression_and_generated_col;
|
|||
set client_min_messages to error;
|
||||
drop extension postgres_fdw cascade;
|
||||
drop schema pg14 cascade;
|
||||
DROP ROLE role_1, r1;
|
||||
reset client_min_messages;
|
||||
|
|
Loading…
Reference in New Issue