-
Notifications
You must be signed in to change notification settings - Fork 2
Added ENV for autovacuum_vacuum_scale_factor and autovacuum_analyze_scale_factor #4
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
base: main
Are you sure you want to change the base?
Conversation
0ba4bb8
to
98e0202
Compare
I ran the current commit locally and with
Please confirm functionality locally both with existing storage volume and without. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to deal with the crond file permission issue I mentioned in the comments
scripts/vacuum_full.sh
Outdated
# Log file for vacuum operations | ||
LOG_FILE="/var/lib/postgresql/vacuum_full.log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log to standard out
scripts/start_cron.sh
Outdated
# Check if VACUUM FULL schedule is set | ||
if [ -n "${OR_VACUUM_FULL_CRON_SCHEDULE}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this outer if in the entrypoint for ease of reading
Additional tasks:
|
Removed alpine dockerfile as it became obsolete because of timescaledb arm64 support
#!/bin/bash | ||
set -e | ||
|
||
echo "-------------------------------------------------------------------------------------" | ||
echo "Setting autovacuum parameters during initialization..." | ||
echo "-------------------------------------------------------------------------------------" | ||
|
||
# Set vacuum parameters | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
ALTER SYSTEM SET autovacuum_vacuum_scale_factor = $OR_AUTOVACUUM_VACUUM_SCALE_FACTOR; | ||
ALTER SYSTEM SET autovacuum_analyze_scale_factor = $OR_AUTOVACUUM_ANALYZE_SCALE_FACTOR; | ||
SELECT pg_reload_conf(); | ||
EOSQL | ||
|
||
echo "-----------------------------------------------------------------------------------" | ||
echo "Autovacuum parameters set: " | ||
echo " - autovacuum_vacuum_scale_factor = $OR_AUTOVACUUM_VACUUM_SCALE_FACTOR" | ||
echo " - autovacuum_analyze_scale_factor = $OR_AUTOVACUUM_ANALYZE_SCALE_FACTOR" | ||
echo "-----------------------------------------------------------------------------------" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this now I don't see value in having this init script and the logic in the entrypoint, the entrypoint logic should be sufficient I think
# Extract current setting if it exists (commented or uncommented) | ||
CURRENT_AUTOVAC_SETTING=$(grep -E "^[#]*autovacuum_vacuum_scale_factor" "$PGDATA/postgresql.conf" | grep -oE "[0-9]\.[0-9]+" || echo "") | ||
|
||
if [ -z "$CURRENT_AUTOVAC_SETTING" ] || [ "$CURRENT_AUTOVAC_SETTING" != "$OR_AUTOVACUUM_VACUUM_SCALE_FACTOR" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check OR_AUTOVACUUM_VACUUM_SCALE_FACTOR
is set if not then leave this setting alone (just in case DBA has configured this manually)
# Extract current setting if it exists (commented or uncommented) | ||
CURRENT_AUTOVAC_ANALYZE_SETTING=$(grep -E "^[#]*autovacuum_analyze_scale_factor" "$PGDATA/postgresql.conf" | grep -oE "[0-9]\.[0-9]+" || echo "") | ||
|
||
if [ -z "$CURRENT_AUTOVAC_ANALYZE_SETTING" ] || [ "$CURRENT_AUTOVAC_ANALYZE_SETTING" != "$OR_AUTOVACUUM_ANALYZE_SCALE_FACTOR" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check OR_AUTOVACUUM_VACUUM_SCALE_FACTOR
is set if not then leave this setting alone (just in case DBA has configured this manually)
No description provided.