Skip to content

Commit

Permalink
Crosscheck, and fix all missing parameters, defaults, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Clough committed Mar 27, 2018
1 parent 28a6e9c commit 68359af
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 6 deletions.
21 changes: 21 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ postgresql_log_rotation_size: 10MB
# These are relevant when logging to syslog:
postgresql_syslog_facility: "LOCAL0"
postgresql_syslog_ident: "postgres"
silent_mode: off # (<= 9.1)
postgresql_syslog_sequence_numbers: on # (>= 9.6)
postgresql_syslog_split_messages: on # (>= 9.6)
# This is only relevant when logging to eventlog (win32) (>= 9.2):
Expand Down Expand Up @@ -499,6 +500,7 @@ postgresql_log_line_prefix: "%t "
# log lock waits >= deadlock_timeout
postgresql_log_lock_waits: off
postgresql_log_statement: "none" # none, ddl, mod, all
postgresql_log_replication_commands: off
# log temporary files equal or larger
postgresql_log_temp_files: -1
postgresql_log_timezone: "UTC"
Expand Down Expand Up @@ -588,6 +590,7 @@ postgresql_bytea_output: "hex" # hex, escape
postgresql_xmlbinary: "base64"
postgresql_xmloption: "content"
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2)
postgresql_gin_pending_list_limit: "4MB" # (>= 9.5)


# - Locale and Formatting -
Expand Down Expand Up @@ -651,6 +654,7 @@ postgresql_backslash_quote: "safe_encoding" # on, off, or safe_encod
postgresql_default_with_oids: off
postgresql_escape_string_warning: on
postgresql_lo_compat_privileges: off
postgresql_operator_precedence_warning: off # (>= 9.5)
postgresql_quote_all_identifiers: off
postgresql_sql_inheritance: on
postgresql_standard_conforming_strings: on
Expand All @@ -662,6 +666,16 @@ postgresql_synchronize_seqscans: on
postgresql_transform_null_equals: off


#------------------------------------------------------------------------------
# CONFIG FILE INCLUDES
#------------------------------------------------------------------------------

# These options allow settings to be loaded from files other than the
# default postgresql.conf.
postgresql_include_dir: "conf.d" # (>= 9.3)
postgresql_include_if_exists: "exists.conf" # (>= 9.3)
postgresql_include: "special.conf" # (>= 9.3)

#------------------------------------------------------------------------------
# ERROR HANDLING
#------------------------------------------------------------------------------
Expand All @@ -672,6 +686,13 @@ postgresql_exit_on_error: off
postgresql_restart_after_crash: on


#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

postgresql_custom_variable_classes: "" # (<= 9.1)


#------------------------------------------------------------------------------
# PGTUNE
#------------------------------------------------------------------------------
Expand Down
47 changes: 47 additions & 0 deletions templates/crosscheck_parameters.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash -

#
# Identify a unique filename
#
TEMP_FILE=/tmp/`basename $0`.$$

#
# Loop through all postgresql.conf.orig files, and compare them to the j2 files
#
for FILE in postgresql.conf-[0-9]*\.orig; do
#
# Extract the base filename, removing ".orig"
#
BASE_FILE="`echo $FILE | sed s/\.orig\$//`"

#
# If we crash, then cleanup
#
trap 'rm -f ${TEMP_FILE}.orig ${TEMP_FILE}.j2 ${TEMP_FILE}.defaults' 0

#
# Extract a unique, sorted list of the parameter names
#
cat ${BASE_FILE}.orig | sed s/\#// | grep ^[a-z] | cut -f1 -d' ' | sort | uniq > ${TEMP_FILE}.orig
cat ${BASE_FILE}.j2 | sed s/\#// | grep ^[a-z] | cut -f1 -d' ' | sort | uniq > ${TEMP_FILE}.j2
cat ../defaults/main.yml | sed s/\#// | grep ^[a-z] | cut -f1 -d':' | sed s/^postgresql_// | sort | uniq > ${TEMP_FILE}.defaults

#
# Output a comparision
#
echo ================================================================================
echo ${BASE_FILE}.orig ${BASE_FILE}.j2
diff ${TEMP_FILE}.orig ${TEMP_FILE}.j2 && echo All parameters exist in both files
echo --------------------------------------------------------------------------------
echo ${BASE_FILE}.defaults ${BASE_FILE}.j2
cat ${TEMP_FILE}.j2 | while read PARAM; do
grep ^postgresql_${PARAM}: ../defaults/main.yml > /dev/null 2>&1 || echo "Missing $PARAM in ../defaults/main.yml"
done
echo ================================================================================
echo

#
# Cleanup
#
rm -f ${TEMP_FILE}.orig ${TEMP_FILE}.j2 ${TEMP_FILE}.defaults
done
1 change: 1 addition & 0 deletions templates/postgresql.conf-9.3.j2
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ vacuum_multixact_freeze_table_age = {{postgresql_vacuum_multixact_freeze_table_a
bytea_output = '{{postgresql_bytea_output}}' # hex, escape
xmlbinary = '{{postgresql_xmlbinary}}'
xmloption = '{{postgresql_xmloption}}'
gin_fuzzy_search_limit = '{{postgresql_gin_fuzzy_search_limit}}'

# - Locale and Formatting -

Expand Down
3 changes: 2 additions & 1 deletion templates/postgresql.conf-9.3.orig
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
#ssl = off # (change requires restart)
#ssl_ciphers = 'DEFAULT:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
# (change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
#ssl_renegotiation_limit = 0 # amount of data between renegotiations
#ssl_cert_file = 'server.crt' # (change requires restart)
#ssl_key_file = 'server.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
Expand Down Expand Up @@ -500,6 +500,7 @@
#bytea_output = 'hex' # hex, escape
#xmlbinary = 'base64'
#xmloption = 'content'
#gin_fuzzy_search_limit = 0

# - Locale and Formatting -

Expand Down
1 change: 1 addition & 0 deletions templates/postgresql.conf-9.4.j2
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ vacuum_multixact_freeze_table_age = {{postgresql_vacuum_multixact_freeze_table_a
bytea_output = '{{postgresql_bytea_output}}' # hex, escape
xmlbinary = '{{postgresql_xmlbinary}}'
xmloption = '{{postgresql_xmloption}}'
gin_fuzzy_search_limit = '{{postgresql_gin_fuzzy_search_limit}}'

# - Locale and Formatting -

Expand Down
3 changes: 2 additions & 1 deletion templates/postgresql.conf-9.4.orig
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
# (change requires restart)
#ssl_prefer_server_ciphers = on # (change requires restart)
#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
#ssl_renegotiation_limit = 0 # amount of data between renegotiations
#ssl_cert_file = 'server.crt' # (change requires restart)
#ssl_key_file = 'server.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
Expand Down Expand Up @@ -517,6 +517,7 @@
#bytea_output = 'hex' # hex, escape
#xmlbinary = 'base64'
#xmloption = 'content'
#gin_fuzzy_search_limit = 0

# - Locale and Formatting -

Expand Down
12 changes: 11 additions & 1 deletion templates/postgresql.conf-9.5.j2
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,20 @@ log_line_prefix = '{{postgresql_log_line_prefix}}' # special values:
# e.g. '<%u%%%d> '
log_lock_waits = {{'on' if postgresql_log_lock_waits else 'off'}} # log lock waits >= deadlock_timeout
log_statement = '{{postgresql_log_statement}}' # none, ddl, mod, all
log_replication_commands = {{'on' if postgresql_log_replication_commands else 'off'}}
log_temp_files = {{postgresql_log_temp_files}} # log temporary files equal or larger
# than the specified size in kilobytes;
# -1 disables, 0 logs all temp files
log_timezone = '{{postgresql_log_timezone}}'


# - Process Title -

cluster_name = '{{postgresql_cluster_name}}' # added to process titles if nonempty
# (change requires restart)
update_process_title = {{'on' if postgresql_update_process_title else 'off'}}


#------------------------------------------------------------------------------
# RUNTIME STATISTICS
#------------------------------------------------------------------------------
Expand All @@ -454,7 +462,6 @@ track_counts = {{'on' if postgresql_track_counts else 'off'}}
track_io_timing = {{'on' if postgresql_track_io_timing else 'off'}}
track_functions = {{postgresql_track_functions}} # none, pl, all
track_activity_query_size = {{postgresql_track_activity_query_size}} # (change requires restart)
update_process_title = {{'on' if postgresql_update_process_title else 'off'}}
stats_temp_directory = '{{postgresql_stats_temp_directory}}'


Expand Down Expand Up @@ -522,6 +529,8 @@ vacuum_multixact_freeze_table_age = {{postgresql_vacuum_multixact_freeze_table_a
bytea_output = '{{postgresql_bytea_output}}' # hex, escape
xmlbinary = '{{postgresql_xmlbinary}}'
xmloption = '{{postgresql_xmloption}}'
gin_fuzzy_search_limit = '{{postgresql_gin_fuzzy_search_limit}}'
gin_pending_list_limit = '{{postgresql_gin_pending_list_limit}}'

# - Locale and Formatting -

Expand Down Expand Up @@ -585,6 +594,7 @@ backslash_quote = {{postgresql_backslash_quote}} # on, off, or safe_encoding
default_with_oids = {{'on' if postgresql_default_with_oids else 'off'}}
escape_string_warning = {{'on' if postgresql_escape_string_warning else 'off'}}
lo_compat_privileges = {{'on' if postgresql_lo_compat_privileges else 'off'}}
operator_precedence_warning = {{'on' if postgresql_operator_precedence_warning else 'off'}}
quote_all_identifiers = {{'on' if postgresql_quote_all_identifiers else 'off'}}
sql_inheritance = {{'on' if postgresql_sql_inheritance else 'off'}}
standard_conforming_strings = {{'on' if postgresql_standard_conforming_strings else 'off'}}
Expand Down
12 changes: 11 additions & 1 deletion templates/postgresql.conf-9.6.j2
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,20 @@ log_line_prefix = '{{postgresql_log_line_prefix}}' # special values:
# e.g. '<%u%%%d> '
log_lock_waits = {{'on' if postgresql_log_lock_waits else 'off'}} # log lock waits >= deadlock_timeout
log_statement = '{{postgresql_log_statement}}' # none, ddl, mod, all
log_replication_commands = {{'on' if postgresql_log_replication_commands else 'off'}}
log_temp_files = {{postgresql_log_temp_files}} # log temporary files equal or larger
# than the specified size in kilobytes;
# -1 disables, 0 logs all temp files
log_timezone = '{{postgresql_log_timezone}}'


# - Process Title -

cluster_name = '{{postgresql_cluster_name}}' # added to process titles if nonempty
# (change requires restart)
update_process_title = {{'on' if postgresql_update_process_title else 'off'}}


#------------------------------------------------------------------------------
# RUNTIME STATISTICS
#------------------------------------------------------------------------------
Expand All @@ -468,7 +476,6 @@ track_counts = {{'on' if postgresql_track_counts else 'off'}}
track_io_timing = {{'on' if postgresql_track_io_timing else 'off'}}
track_functions = {{postgresql_track_functions}} # none, pl, all
track_activity_query_size = {{postgresql_track_activity_query_size}} # (change requires restart)
update_process_title = {{'on' if postgresql_update_process_title else 'off'}}
stats_temp_directory = '{{postgresql_stats_temp_directory}}'


Expand Down Expand Up @@ -537,6 +544,8 @@ vacuum_multixact_freeze_table_age = {{postgresql_vacuum_multixact_freeze_table_a
bytea_output = '{{postgresql_bytea_output}}' # hex, escape
xmlbinary = '{{postgresql_xmlbinary}}'
xmloption = '{{postgresql_xmloption}}'
gin_fuzzy_search_limit = '{{postgresql_gin_fuzzy_search_limit}}'
gin_pending_list_limit = '{{postgresql_gin_pending_list_limit}}'

# - Locale and Formatting -

Expand Down Expand Up @@ -597,6 +606,7 @@ backslash_quote = {{postgresql_backslash_quote}} # on, off, or safe_encoding
default_with_oids = {{'on' if postgresql_default_with_oids else 'off'}}
escape_string_warning = {{'on' if postgresql_escape_string_warning else 'off'}}
lo_compat_privileges = {{'on' if postgresql_lo_compat_privileges else 'off'}}
operator_precedence_warning = {{'on' if postgresql_operator_precedence_warning else 'off'}}
quote_all_identifiers = {{'on' if postgresql_quote_all_identifiers else 'off'}}
sql_inheritance = {{'on' if postgresql_sql_inheritance else 'off'}}
standard_conforming_strings = {{'on' if postgresql_standard_conforming_strings else 'off'}}
Expand Down
4 changes: 2 additions & 2 deletions templates/postgresql.conf-9.6.orig
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
#bgwriter_delay = 200ms # 10-10000ms between rounds
#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
#bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round
#bgwriter_flush_after = 0 # 0 disables,
#bgwriter_flush_after = 512kB # 0 disables,
# default is 512kB on linux, 0 otherwise

# - Asynchronous Behavior -
Expand Down Expand Up @@ -207,7 +207,7 @@
#max_wal_size = 1GB
#min_wal_size = 80MB
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
#checkpoint_flush_after = 0 # 0 disables,
#checkpoint_flush_after = 256kB # 0 disables,
# default is 256kB on linux, 0 otherwise
#checkpoint_warning = 30s # 0 disables

Expand Down

0 comments on commit 68359af

Please sign in to comment.