Skip to content
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

update autotuning #19

Merged
merged 5 commits into from
Aug 21, 2017
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/smdba/postgresqlgate.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,8 @@ def do_system_check(self, *args, **params):
"""
Common backend healthcheck.
@help
autotuning\tperform initial autotuning of the database
autotuning\t\tperform initial autotuning of the database
--max_connections=<num>\tdefine maximal number of database connections (default: 400)
"""
# Check enough space

Expand All @@ -910,8 +911,9 @@ def do_system_check(self, *args, **params):
#

# Built-in tuner
conn_lowest = 400
max_conn = int(params.get('max_connections', conn_lowest))
conn_lowest = 270
conn_default = 400
max_conn = int(params.get('max_connections', conn_default))
if max_conn < conn_lowest:
print >> sys.stdout, 'INFO: max_connections should be at least {0}'.format(conn_lowest)
max_conn = conn_lowest
Expand All @@ -928,7 +930,7 @@ def do_system_check(self, *args, **params):
changed = True

# WAL senders at least 5
if not conf.get('max_wal_senders') or conf.get('max_wal_senders') < '5':
if not conf.get('max_wal_senders') or int(conf.get('max_wal_senders')) < 5:
conf['max_wal_senders'] = 5
changed = True

Expand All @@ -948,7 +950,7 @@ def do_system_check(self, *args, **params):
changed = True

# max_locks_per_transaction
if not conf.get('max_locks_per_transaction') or conf.get('max_locks_per_transaction') < '100':
if not conf.get('max_locks_per_transaction') or int(conf.get('max_locks_per_transaction')) < 100:
conf['max_locks_per_transaction'] = 100
changed = True

Expand All @@ -962,6 +964,11 @@ def do_system_check(self, *args, **params):
conf['bytea_output'] = "'escape'"
changed = True

# bsc#1022286 - too low value for statistic_target
if int(conf.get('default_statistics_target', 100)) <= 10:
del conf['default_statistics_target']
changed = True

#
# Setup pg_hba.conf
# Format is pretty specific :-)
Expand Down