postgresql: drop per-database autovacuum ALTERs (rejected by Postgres)
Follow-up to the previous two commits: the ALTER DATABASE ... SET autovacuum_* commands fail at boot with ERROR: parameter "autovacuum_vacuum_scale_factor" cannot be changed now and take matrix-synapse-db-tune.service (and nextcloud-db-init.service) down with them. Root cause: ALTER DATABASE/ROLE ... SET validates through set_config_option() with an interactive context, and guc.c rejects any PGC_SIGHUP parameter set that way. All autovacuum_* GUCs are SIGHUP-context, so per-database scoping is impossible for them — only USERSET-level parameters (e.g. work_mem, statement_timeout) can be set per-database. Nothing is lost: the same values are already set cluster-wide in configuration.nix, which covers both nextclouddb and matrix-synapse. Remove the ALTERs from nextcloud-db-init and delete the now-purposeless matrix-synapse-db-tune service.
This commit is contained in:
@@ -60,11 +60,11 @@ lib.mkIf config.sovran_systemsOS.services.nextcloud {
|
||||
psql -U postgres -c "CREATE DATABASE nextclouddb WITH OWNER ncusr TEMPLATE template0 LC_COLLATE = 'C' LC_CTYPE = 'C';"
|
||||
fi
|
||||
|
||||
# Per-database autovacuum, scoped to nextclouddb only.
|
||||
# The shared matrix-synapse DB keeps the milder cluster defaults.
|
||||
# Fixes Nextcloud 35 pg.dead_tuples warning. Idempotent.
|
||||
psql -U postgres -d nextclouddb -c "ALTER DATABASE nextclouddb SET autovacuum_vacuum_scale_factor = '0.05';"
|
||||
psql -U postgres -d nextclouddb -c "ALTER DATABASE nextclouddb SET autovacuum_analyze_scale_factor = '0.025';"
|
||||
# NOTE: autovacuum GUCs are SIGHUP-context, so they cannot be set
|
||||
# per-database — ALTER DATABASE ... SET rejects them with
|
||||
# 'parameter "..." cannot be changed now'. They are set
|
||||
# cluster-wide in configuration.nix instead, which already covers
|
||||
# both nextclouddb and matrix-synapse.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user