Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Columnar: vacuum freeze does not advance relfrozenxid #5958

Closed
jeff-davis opened this issue May 18, 2022 · 2 comments · Fixed by #5962
Closed

Columnar: vacuum freeze does not advance relfrozenxid #5958

jeff-davis opened this issue May 18, 2022 · 2 comments · Fixed by #5962

Comments

@jeff-davis
Copy link
Contributor

With postgresql.conf:

wal_level=logical
shared_preload_libraries='citus'
autovacuum_freeze_max_age = 100000
vacuum_freeze_min_age = 50000
vacuum_freeze_table_age = 75000
synchronous_commit = off
fsync = off

And doing:

CREATE EXTENSION citus;
CREATE TABLE test_row(i int);
INSERT INTO test_row VALUES (1);
CREATE TABLE test_col(i int) USING columnar;
INSERT INTO test_col VALUES (1);

Then doing:

(for i in `seq 1 200000`; do echo "UPDATE test_row SET i = i + 1;"; done) | ./bin/psql -q -X postgres

I see:

=# select datname, relname, age(datfrozenxid) datage, age(relfrozenxid) as relage from pg_database, pg_class where datname='postgres' and (relname='test_row' or relname='test_col');
 datname  | relname  | datage | relage 
----------+----------+--------+--------
 postgres | test_row | 200018 | 200010
 postgres | test_col | 200018 | 200008
(2 rows)

After I wait for autovacuum to kick in, I see:

=# select datname, relname, age(datfrozenxid) datage, age(relfrozenxid) as relage from pg_database, pg_class where datname='postgres' and (relname='test_row' or relname='test_col');
 datname  | relname  | datage | relage 
----------+----------+--------+--------
 postgres | test_row | 200010 |  50002
 postgres | test_col | 200010 | 200010
(2 rows)

And further manual VACUUM or VACUUM FREEZE do not fix it.

@jeff-davis
Copy link
Contributor Author

This is a fairly serious issue. I am sure we tested this before, but it's hard to create acceptance tests for this, so we must have seen a regression. Perhaps we can add a TAP test.

@jeff-davis jeff-davis changed the title Columnar: vacuum freeze does not advange relfrozenxid Columnar: vacuum freeze does not advance relfrozenxid May 18, 2022
@amalek215
Copy link

I am also experiencing this issue
Postgres 14.1
citus 10.2-4

I've had to increase autovacuum_freeze_max_age to prevent autovacuum: VACUUM .... (to prevent wraparound) from constantly running.
I have 10s of thousands of tables using Citus columnar store and now that they are aging (created 5 months ago) those autovacuums began to always run.

jeff-davis added a commit that referenced this issue May 20, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 20, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 20, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 20, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 23, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 25, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 25, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.
jeff-davis added a commit that referenced this issue May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 27, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 31, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
jeff-davis added a commit that referenced this issue May 31, 2022
columnar_vacuum_rel() now advances relfrozenxid.

Fixes #5958.

(cherry picked from commit 74ce210)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants