"autovacuum: VACUUM public.XXXX (to prevent wraparound)" blocking DDLs to XXXX
A problem: if in point in time, when we created our snapshot for thin clones, on the master autovacuum was processing some table in "transaction ID wraparound prevention" mode, then technically, when we have a freshly-promoted master, autovacuum needs to do this job to finish it. And in this mode, autovacuum blocks DDLs to this table (strictly speaking, autovacuum blocks them always, but in "regular" mode it will auto-kill itself after a second or two of blocking issues; in this special mode autovacuum won't yield).
As a result, if a user tries to, say, build an index on such a table, this action is blocked by autovacuum. What is worse, this is invisible to the user and really hard to understand -- it just looks like DDL execution takes a very long time.
We need to solve this issue somehow.
TODO / How to implement
- Warn user about this case and allow killing autovacuum's backend -- in this case, autovacuum will start again, but will be blocked by our DDL already. However, in case we need to do multiple DDLs, this "kill" action will need to be repeated.
- At snapshotting time, prepare database to avoid transaction wraparound prevention mode for autovacuum. For example we could just raise
As a user, I'm either not affected by
"autovacuum: VACUUM public.XXXX (to prevent wraparound)" or I am able to handle such cases manually to avoid extended waiting time to execute DDLs.