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

Fix 9.1 config parsing: wal_buffers configuration #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions pg_settings-9.1-64
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ vacuum_defer_cleanup_age 0 Replication / Master Server Number of transactions b
vacuum_freeze_min_age 50000000 Client Connection Defaults / Statement Behavior Minimum age at which VACUUM should freeze a table row. \N user integer 0 1000000000 \N 50000000
vacuum_freeze_table_age 150000000 Client Connection Defaults / Statement Behavior Age at which VACUUM should scan whole table to freeze tuples. \N user integer 0 2000000000 \N 150000000
wal_block_size 8192 Preset Options Shows the block size in the write ahead log. \N internal integer 8192 8192 \N 8192
wal_buffers -1 8kB Write-Ahead Log / Settings Sets the number of disk-page buffers in shared memory for WAL. \N postmaster integer 4 2147483647 \N 8
wal_keep_segments 0 Replication / Master Server Sets the number of WAL files held for standby servers. \N sighup integer 0 2147483647 \N 0
wal_level minimal \N Write-Ahead Log / Settings Set the level of information written to the WAL. \N postmaster enum \N \N {minimal,archive,hot_standby} minimal
wal_receiver_status_interval 10 s Replication / Standby Servers Sets the maximum interval between WAL receiver status reports to the primary. \N sighup integer 0 2147483 \N 10
Expand Down
23 changes: 12 additions & 11 deletions pgtune
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,18 @@ def wizard_tune(config, options, settings):
s['checkpoint_completion_target'] = {'web':0.7, 'oltp':0.9, 'dw':0.9,
'mixed':0.9, 'desktop':0.5}[db_type]

# Follow auto-tuning guideline for wal_buffers added in 9.1, where it's
# set to 3% of shared_buffers up to a maximum of 16MB.
# TODO Eliminate setting this at all on 9.1 and later
s['wal_buffers'] = 3 * s['shared_buffers'] / 100
if s['wal_buffers'] > 16*MB / KB:
s['wal_buffers'] = 16*MB / KB
# It's nice if wal_buffers is an even 16MB if it's near that number. Since
# that is a common case on Windows, where shared_buffers is clipped to 512MB,
# round upwards in that situation
if s['wal_buffers'] > 14*MB / KB and s['wal_buffers'] < 16*MB / KB:
s['wal_buffers'] = 16*MB / KB
# For versions < 9.1, follow auto-tuning guideline for wal_buffers added
# in 9.1, where it's set to 3% of shared_buffers up to a maximum of 16MB.
# Starting with 9.1, the default value of -1 should be fine.
if float(options.db_version) < 9.1:
s['wal_buffers'] = 3 * s['shared_buffers'] / 100
if s['wal_buffers'] > 16*MB / KB:
s['wal_buffers'] = 16*MB / KB
# It's nice if wal_buffers is an even 16MB if it's near that number. Since
# that is a common case on Windows, where shared_buffers is clipped to 512MB,
# round upwards in that situation
if s['wal_buffers'] > 14*MB / KB and s['wal_buffers'] < 16*MB / KB:
s['wal_buffers'] = 16*MB / KB

# TODO Eliminate setting this needlessly when on a version that
# defaults to 100
Expand Down