#!/bin/bash
sed -i $PGDATA/postgresql.conf -e "s/^max_connections .*$/max_connections = $MAX_CONNECTIONS/"

#!/bin/bash -ex

# The engine needs a 'max_connections' parameter larger than the default used
# by PostgreSQL, at most 150. As this parameter already has a value in the
# default 'postgresql.conf' file, we need to edit the file to fix it.
sed -i \
  -e "s/^\(max_connections\)\\s*=.*$/\1 = ${MAX_CONNECTIONS}/" \
  "${PGDATA}/postgresql.conf"

# Recent versions of the engine also need custom auto-vacuum parameters. The
# setup tool checks them, and fails the start of the engine if they aren't set.
# These are commented out by default, so we just need to append them to the
# file.
cat >> "${PGDATA}/postgresql.conf" <<.
autovacuum_vacuum_scale_factor = 0.01
autovacuum_analyze_scale_factor = 0.075
autovacuum_max_workers = 6
maintenance_work_mem = 65536
.

Add 'autovacuum' parameters to the PostgreSQL image
Add 'autovacuum' parameters to the PostgreSQL image

Recent versions of the engine need to have the following auto-vacuum
configuration parameters:

  autovacuum_vacuum_scale_factor = 0.01
  autovacuum_analyze_scale_factor = 0.075
  autovacuum_max_workers = 6
  maintenance_work_mem = 65536

Without them the setup tool fails during the start of the engine container.

This patch modifies the 'ovirt-db-config.sh' file so that those parameter are
automatically added to the 'postgresql.conf' file during the start of the
PostgreSQL container.

Change-Id: I90924a3326d478611f7f2962e2a641968da86023
Signed-off-by: Juan Hernandez <59e5b8140de97cc91c3fb6c5342dce948469af8c@redhat.com>
