diff --git a/.travis.yml b/.travis.yml index 677b2717cf..b5e4187aad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: trusty # precise doesn't have pg 9.6 yet sudo: false branches: only: @@ -21,7 +22,7 @@ language: erlang otp_release: - 18.3 addons: - postgresql: "9.3" + postgresql: "9.6" apt: sources: - chef-stable-precise diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d9f72b9a7f..0ecc544ebc 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -14,6 +14,31 @@ For prior releases, see [PRIOR\_RELEASE\_NOTES.md](PRIOR_RELEASE_NOTES.md). the secret being changed. With the optional flag `--with-restart`, `chef-server-ctl set-secret` will attempt to automatically restart the dependent services. +* [Upgrade to PostgreSQL 9.6](https://github.com/chef/chef-server/pull/1310), + Chef Server now uses the latest stable version of the 9.6 series (9.6.3). Upgrades of existing + installations are done automatically, but creating backups is advised. + + The information below only applies if you have set a custom value for `checkpoint_segments` + in your `/etc/opscode/chef-server.rb`. If you have not set a custom value, there is nothing to + change: + + The `checkpoint_segments` configuration setting is gone, so if you before have set + + postgresql['checkpoint_segments'] = 10 + + you now have to specify (for example, please consult the documentation linked below) + + postgresql['max_wal_size'] = '3G' + + The default setting for `max_wal_size` is 1G. [The PostgreSQL release notes](https://www.postgresql.org/docs/9.6/static/release-9-5.html) mention a conversion + rule: `max_wal_size = (3 * checkpoint_segments) * 16MB`. They also say that the default value + for `max_wal_size` (1GB) should fit in most settings, so this conversion is not done automatically. + + This update also adds two further new configurables in the ["Checkpoints" group](https://www.postgresql.org/docs/9.6/static/runtime-config-wal.html#RUNTIME-CONFIG-WAL-CHECKPOINTS), `min_wal_size` and + `checkpoint_flush_after`. + + As part of the upgrade procdure, running `chef-server-ctl cleanup` will remove Postgres 9.2's data + and logs. ## 12.15.8 (2017-06-20) diff --git a/omnibus/config/software/oc_id.rb b/omnibus/config/software/oc_id.rb index 15a246aa48..46aa59b180 100644 --- a/omnibus/config/software/oc_id.rb +++ b/omnibus/config/software/oc_id.rb @@ -27,7 +27,7 @@ # and makeds more sense than adding the thing that is stopping # it from building on s390 (libxml2). dependency "nokogiri" -dependency "postgresql92" # for libpq +dependency "postgresql96" # for libpq dependency "nodejs-binary" dependency "ruby" dependency "bundler" diff --git a/omnibus/config/software/partybus.rb b/omnibus/config/software/partybus.rb index 3783b16cdc..bde95edd05 100644 --- a/omnibus/config/software/partybus.rb +++ b/omnibus/config/software/partybus.rb @@ -21,7 +21,7 @@ license :project_license dependency "bundler" -dependency "postgresql92" +dependency "postgresql96" build do env = with_standard_compiler_flags(with_embedded_path) diff --git a/omnibus/config/software/perl_pg_driver.rb b/omnibus/config/software/perl_pg_driver.rb index d4fd54081a..34acea3cca 100644 --- a/omnibus/config/software/perl_pg_driver.rb +++ b/omnibus/config/software/perl_pg_driver.rb @@ -22,7 +22,7 @@ dependency "perl" dependency "cpanminus" -dependency "postgresql92" +dependency "postgresql96" source url: "http://search.cpan.org/CPAN/authors/id/T/TU/TURNSTEP/DBD-Pg-#{version}.tar.gz", md5: "547de1382a47d66872912fe64282ff55" diff --git a/omnibus/config/software/postgresql92-bin.rb b/omnibus/config/software/postgresql92-bin.rb new file mode 100644 index 0000000000..4abea34720 --- /dev/null +++ b/omnibus/config/software/postgresql92-bin.rb @@ -0,0 +1,57 @@ +# +# Copyright 2017 Chef Software, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name "postgresql92-bin" + +default_version "9.2.21" + +license "PostgreSQL" +license_file "COPYRIGHT" +skip_transitive_dependency_licensing true + +dependency "zlib" +dependency "openssl" +dependency "libedit" +dependency "ncurses" +dependency "libossp-uuid" +dependency "config_guess" + +source url: "https://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2" + +version("9.2.21") { source sha256: "0697e843523ee60c563f987f9c65bc4201294b18525d6e5e4b2c50c6d4058ef9" } + +relative_path "postgresql-#{version}" + +build do + env = with_standard_compiler_flags(with_embedded_path) + short_version = version.gsub(/^([0-9]+).([0-9]+).[0-9]+$/, '\1.\2') + + update_config_guess(target: "config") + + command "./configure" \ + " --prefix=#{install_dir}/embedded/postgresql/#{short_version}" \ + " --with-libedit-preferred" \ + " --with-openssl" \ + " --with-ossp-uuid" \ + " --with-includes=#{install_dir}/embedded/include" \ + " --with-libraries=#{install_dir}/embedded/lib", env: env + + make "world -j #{workers}", env: env + make "-C src/interfaces/libpq install", env: env # libpq.so + make "-C src/backend install-bin", env: env # postgres binary + make "-C src/timezone/tznames install", env: env # share/timezonesets + make "-C src/bin install", env: env # pg_*, psql binaries +end diff --git a/omnibus/config/software/postgresql92.rb b/omnibus/config/software/postgresql96.rb similarity index 66% rename from omnibus/config/software/postgresql92.rb rename to omnibus/config/software/postgresql96.rb index 2fabb3a6ea..1c503133eb 100644 --- a/omnibus/config/software/postgresql92.rb +++ b/omnibus/config/software/postgresql96.rb @@ -1,5 +1,5 @@ # -# Copyright 2012-2017 Chef Software, Inc. +# Copyright 2017 Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,16 +14,14 @@ # limitations under the License. # -name "postgresql92" -default_version "9.2.21" +name "postgresql96" + +default_version "9.6.3" license "PostgreSQL" license_file "COPYRIGHT" skip_transitive_dependency_licensing true -source url: "https://ftp.postgresql.org/pub/source/v9.2.21/postgresql-9.2.21.tar.bz2", - sha256: "0697e843523ee60c563f987f9c65bc4201294b18525d6e5e4b2c50c6d4058ef9" - dependency "zlib" dependency "openssl" dependency "libedit" @@ -31,15 +29,19 @@ dependency "libossp-uuid" dependency "config_guess" -relative_path "postgresql-9.2.21" +source url: "https://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2" +version("9.6.3") { source sha256: "1645b3736901f6d854e695a937389e68ff2066ce0cde9d73919d6ab7c995b9c6" } + +relative_path "postgresql-#{version}" build do env = with_standard_compiler_flags(with_embedded_path) + short_version = version.gsub(/^([0-9]+).([0-9]+).[0-9]+$/, '\1.\2') update_config_guess(target: "config") command "./configure" \ - " --prefix=#{install_dir}/embedded/postgresql/9.2" \ + " --prefix=#{install_dir}/embedded/postgresql/#{short_version}" \ " --with-libedit-preferred" \ " --with-openssl" \ " --with-ossp-uuid" \ @@ -49,13 +51,8 @@ make "world -j #{workers}", env: env make "install-world -j #{workers}", env: env - - # Postgres 9.2 is our "real" Postgres installation (prior versions - # that are installed are solely to facilitate upgrades). As a - # result, we need to have the binaries for this version available - # with the other binaries used by Private Chef. block do - Dir.glob("#{install_dir}/embedded/postgresql/9.2/bin/*").sort.each do |bin| + Dir.glob("#{install_dir}/embedded/postgresql/#{short_version}/bin/*").sort.each do |bin| link bin, "#{install_dir}/embedded/bin/#{File.basename(bin)}" end end diff --git a/omnibus/config/software/private-chef-cookbooks.rb b/omnibus/config/software/private-chef-cookbooks.rb index 01d65364e4..13d42a59d3 100644 --- a/omnibus/config/software/private-chef-cookbooks.rb +++ b/omnibus/config/software/private-chef-cookbooks.rb @@ -53,7 +53,8 @@ run_list: [ 'recipe[private-chef::post_11_upgrade_cleanup]', 'recipe[private-chef::post_12_upgrade_cleanup]', - 'recipe[private-chef::solr4_gclog_cleanup]' + 'recipe[private-chef::solr4_gclog_cleanup]', + 'recipe[private-chef::postgres_upgrade_cleanup]' ] ) end diff --git a/omnibus/config/software/server-complete.rb b/omnibus/config/software/server-complete.rb index afe41eccef..f9e141787c 100644 --- a/omnibus/config/software/server-complete.rb +++ b/omnibus/config/software/server-complete.rb @@ -33,7 +33,8 @@ dependency "erlang-crypto2" # the backend -dependency "postgresql92" +dependency "postgresql92-bin" # for upgrading 9.2 -> 9.6 +dependency "postgresql96" dependency "rabbitmq" dependency "redis" # dynamic routing controls dependency "opscode-solr4" diff --git a/omnibus/files/private-chef-cookbooks/private-chef/attributes/default.rb b/omnibus/files/private-chef-cookbooks/private-chef/attributes/default.rb index b58a11b82f..66358f8f12 100755 --- a/omnibus/files/private-chef-cookbooks/private-chef/attributes/default.rb +++ b/omnibus/files/private-chef-cookbooks/private-chef/attributes/default.rb @@ -562,7 +562,7 @@ # PostgreSQL ### # For now, we're hardcoding the version directory suffix here: -default['private_chef']['postgresql']['version'] = "9.2" +default['private_chef']['postgresql']['version'] = "9.6" # In the future, we're probably going to want to do something more elegant so we # don't accidentally overwrite this directory if we upgrade PG to 9.3: keeping these # directories straight is important because in the distant future (the year 2000) @@ -593,7 +593,7 @@ default['private_chef']['postgresql']['shmmax'] = 17179869184 default['private_chef']['postgresql']['shmall'] = 4194304 default['private_chef']['postgresql']['wal_level'] = "minimal" -default['private_chef']['postgresql']['archive_mode'] = "off" +default['private_chef']['postgresql']['archive_mode'] = "off" # "cannot be enabled when wal_level is set to minimal" default['private_chef']['postgresql']['archive_command'] = "" default['private_chef']['postgresql']['archive_timeout'] = 0 # 0 is disabled. @@ -617,10 +617,19 @@ default['private_chef']['postgresql']['shared_buffers'] = "#{(shared_bytes/1024).to_i}MB" default['private_chef']['postgresql']['work_mem'] = "8MB" -default['private_chef']['postgresql']['effective_cache_size'] = "#{(node['memory']['total'].to_i / 2) / (1024)}MB" -default['private_chef']['postgresql']['checkpoint_segments'] = 3 +default['private_chef']['postgresql']['effective_cache_size'] = "#{(node['memory']['total'].to_i / 2)/1024}MB" +# Note: the checkpoint_segments setting was removed. +# https://www.postgresql.org/docs/9.6/static/release-9-5.html says +# max_wal_size = (3 * checkpoint_segments) * 16MB +# would be a usable conversion rule, but it also says the new setting's default +# should be OK for most people. Since the conversion rule yields a value that +# is so much smaller than the default, we don't do the conversion, but merely +# allow for overriding the default setting. +default['private_chef']['postgresql']['max_wal_size'] = "1GB" +default['private_chef']['postgresql']['min_wal_size'] = "80MB" default['private_chef']['postgresql']['checkpoint_timeout'] = "5min" default['private_chef']['postgresql']['checkpoint_completion_target'] = 0.5 +default['private_chef']['postgresql']['checkpoint_flush_after'] = "256kB" default['private_chef']['postgresql']['checkpoint_warning'] = "30s" ### diff --git a/omnibus/files/private-chef-cookbooks/private-chef/libraries/preflight_postgres_validator.rb b/omnibus/files/private-chef-cookbooks/private-chef/libraries/preflight_postgres_validator.rb index d118f23f00..b9a1e405d3 100644 --- a/omnibus/files/private-chef-cookbooks/private-chef/libraries/preflight_postgres_validator.rb +++ b/omnibus/files/private-chef-cookbooks/private-chef/libraries/preflight_postgres_validator.rb @@ -13,14 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -class PostgresqlPreflightValidator < PreflightValidator - - def initialize(node) - super +require_relative "./warnings.rb" - end +class PostgresqlPreflightValidator < PreflightValidator + # This check used to verify that the external PG version matches the version + # we ship. When we bumped the version we ship to 9.6, we haven't yet + # introduced any changes that _require_ 9.6. So, these constants reflect the + # actually required PG version. + REQUIRED_MAJOR = 9 + REQUIRED_MINOR = 2 def run! + warn_about_removed_attribute('checkpoint_segments') verify_unchanged_external_flag # Our additional validations only apply when a database server exists, @@ -88,6 +92,16 @@ def verify_unchanged_external_flag end end + # When upgrading to 9.6, checkpoint_segments config was removed. The new + # configurables' defaults are such that they should not need tuning. However, + # we warn users that have changed the old attribute that their changes don't + # have any effect anymore. + def warn_about_removed_attribute(attr) + return unless cs_pg_attr[attr] + + ChefServer::Warnings.warn err_unused_postgres_configurable(attr) + end + def connectivity_validation # all nodes are expected to be able to reach the database node # and connect to it - let's make a connection intended to fail @@ -170,16 +184,12 @@ def backend_verify_postgres_version(connection) # Make sure the server is a supported version. r = connection.exec("SHOW server_version;") v = r[0]['server_version'] - major, minor = v.split(".") - # Load up our required major/minor: - # NOTE: our current entry in version-manifest.json is 'postgres92',effectively hardcoding the version. Necessary - # change is captured here: https://github.com/chef/chef-server/issues/441 - manifest = JSON.parse(File.read("/opt/opscode/version-manifest.json")) - required_major, required_minor = manifest['software']['postgresql92']['locked_version'].split(".") + major, minor = v.split(".").map(&:to_i) # Note that we're looking for the same major, and using our minor as the minimum version - # This provides compatibility with external databases that use 9.3+ before we officially upgrade to it. - unless major == required_major and minor >= required_minor + # This provides compatibility with external databases that use < 9.6 before we make use + # of any features available in > 9.2. + unless major == REQUIRED_MAJOR and minor >= REQUIRED_MINOR fail_with err_CSPG014_bad_postgres_version(v) end end @@ -298,7 +308,7 @@ def err_CSPG013_not_superuser def err_CSPG014_bad_postgres_version(ver) < Gem::Version.new(b[1]) ? -1 : 1 } + .map(&:first) # drop the versions again + .first +end + def new_data_dir node['private_chef']['postgresql']['data_dir'] end @@ -66,25 +88,25 @@ def sentinel_file ::File.join(new_data_dir, "upgraded.sentinel") end -# @return [Array] Whether or not an upgrade is -# needed, and the why-run message to describe what we're doing (or why -# we're not doing anything) -def upgrade_status +# @return [Boolean] Whether or not an upgrade is needed, and the +# why-run message to describe what we're doing (or why we're not doing +# anything) +def upgrade_required? if old_data_dir.nil? # This will only happen if we've never successfully completed a # Private Chef installation on this machine before. In that case, # there is (by definition) nothing to upgrade - [false, "No prior database cluster detected; nothing to upgrade"] - + Chef::Log.debug "No prior database cluster detected; nothing to upgrade" + false elsif old_data_dir == new_data_dir # If the directories are the same, then we're not changing anything # (since we keep data directories in version-scoped # directories); i.e., this is just another garden-variety chef run - [false, "Database cluster is unchanged; nothing to upgrade"] - elsif - Dir.exists?(new_data_dir) && - cluster_initialized?(new_data_dir) && - ::File.exists?(sentinel_file) + Chef::Log.debug "Database cluster is unchanged; nothing to upgrade" + false + elsif Dir.exists?(new_data_dir) && + cluster_initialized?(new_data_dir) && + ::File.exists?(sentinel_file) # If the directories are different, we may need to do an upgrade, # but only if all the steps along the way haven't been completed # yet. We'll look for a sentinel file (which we'll write out @@ -93,31 +115,17 @@ def upgrade_status # If we then make it all the way through the chef run, then the next # time through, the old_data_dir will be the same as our # new_data_dir - - [false, "Database cluster already upgraded from previous installation; nothing to do"] + Chef::Log.debug "Database cluster already upgraded from previous installation; nothing to do" + false else # Hmm, looks like we need to upgrade after all - [true, "Upgrading database cluster"] - end -end - -action :upgrade do - anything_to_do, why_run_message = upgrade_status - - converge_by(why_run_message) do - if anything_to_do - shutdown_postgres - initialize_new_cluster - update_to_latest_version - end - new_resource.updated_by_last_action(anything_to_do) + true end end # If a pre-existing postgres service exists it will need to be shut # down prior to running the upgrade step. def shutdown_postgres - runit_service "postgresql" do action :nothing # can this just be 'action :stop'? end diff --git a/omnibus/files/private-chef-cookbooks/private-chef/recipes/post_11_upgrade_cleanup.rb b/omnibus/files/private-chef-cookbooks/private-chef/recipes/post_11_upgrade_cleanup.rb index 95aabf2b36..e0b9271cba 100644 --- a/omnibus/files/private-chef-cookbooks/private-chef/recipes/post_11_upgrade_cleanup.rb +++ b/omnibus/files/private-chef-cookbooks/private-chef/recipes/post_11_upgrade_cleanup.rb @@ -65,16 +65,3 @@ end private_chef_package_cleaner "varnish" - -# Remove old PostgreSQL data directory -# -# pg_upgrade will helpfully generate a cleanup script which removes -# the previous database cluster. This is nice, because we don't have -# to worry about keeping track of the location of the old cluster. -execute "remove_old_postgres_data_directory" do - cleanup_script = "#{node['private_chef']['postgresql']['data_dir']}/delete_old_cluster.sh" - command cleanup_script - only_if {File.exists? cleanup_script} - # The script itself is idempotent; it just runs an 'rm -Rf' on the - # old $PG_DATA directory -end diff --git a/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgres_upgrade_cleanup.rb b/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgres_upgrade_cleanup.rb new file mode 100644 index 0000000000..18527c36e8 --- /dev/null +++ b/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgres_upgrade_cleanup.rb @@ -0,0 +1,32 @@ +# +# Copyright:: Copyright (c) 2017 Chef Software, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Remove old PostgreSQL data directory +# +# pg_upgrade will helpfully generate a cleanup script which removes +# the previous database cluster. This is nice, because we don't have +# to worry about keeping track of the location of the old cluster. +execute "remove_old_postgres_data_directory" do + cleanup_script = "#{node['private_chef']['postgresql']['data_dir']}/delete_old_cluster.sh" + command cleanup_script + only_if {File.exists? cleanup_script} + # The script itself is idempotent; it just runs an 'rm -Rf' on the + # old $PG_DATA directory +end + +directory '/var/log/opscode/postgresql/9.2' do + recursive true + action :delete +end diff --git a/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgresql.rb b/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgresql.rb index 784b2ba099..4526a8583c 100644 --- a/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgresql.rb +++ b/omnibus/files/private-chef-cookbooks/private-chef/recipes/postgresql.rb @@ -143,7 +143,7 @@ Chef::Log.fatal <<-ERR Could not connect to the postgresql database. -Please check /var/log/opscode/posgresql/current for more information. +Please check 'chef-server-ctl tail postgresql' for more information. ERR exit!(1) diff --git a/omnibus/files/private-chef-cookbooks/private-chef/spec/libraries/preflight_postgres_validator_spec.rb b/omnibus/files/private-chef-cookbooks/private-chef/spec/libraries/preflight_postgres_validator_spec.rb index 6241950bf2..922151185b 100644 --- a/omnibus/files/private-chef-cookbooks/private-chef/spec/libraries/preflight_postgres_validator_spec.rb +++ b/omnibus/files/private-chef-cookbooks/private-chef/spec/libraries/preflight_postgres_validator_spec.rb @@ -9,7 +9,15 @@ class ConnectionBad < RuntimeError; end end describe PostgresqlPreflightValidator do - let(:node) { { 'private_chef' => {'opscode-erchef' => { 'sql_user' => 'blah' }, 'oc_bifrost' => { 'sql_user' => 'blah' }, 'oc_id' => { 'sql_user' => 'blah' }} } } + let(:node) do + { + 'private_chef' => { + 'opscode-erchef' => { 'sql_user' => 'blah' }, + 'oc_bifrost' => { 'sql_user' => 'blah' }, + 'oc_id' => { 'sql_user' => 'blah' }, + } + } + end let(:first_run_response) { false } let(:secrets_exists_response) { false } let(:postgres_validator) { @@ -39,6 +47,89 @@ class ConnectionBad < RuntimeError; end validator } + context "#warn_about_removed_attribute" do + before do + allow(PrivateChef).to receive(:[]).with('postgresql').and_return(pg_attrs) + end + + context "when the attribute is configured" do + let(:pg_attrs) { {'foo' => 3000, 'bar' => true } } + + it "adds a warning to the ChefServer::Warnings" do + expect(ChefServer::Warnings).to receive(:warn) + postgres_validator.warn_about_removed_attribute('foo') + end + end + + context "when the attribute is not configured" do + let(:pg_attrs) { { 'bar' => true } } + + it "adds a warning to the ChefServer::Warnings" do + expect(ChefServer::Warnings).not_to receive(:warn) + postgres_validator.warn_about_removed_attribute('foo') + end + end + end + + context "#backend_verify_postgres_version" do + # shadow other definition so we can call backend_verify_postgres_version + let(:postgres_validator) { PostgresqlPreflightValidator.new(node) } + + let(:connection) { double('connection') } + let(:version_reply) { [{ 'server_version' => version }] } + let(:error_message) { /PostgreSQL version 9\.2 or greater/ } + + before do + allow(connection).to receive(:exec).with('SHOW server_version;') + .and_return(version_reply) + end + + context "when external version is <= 8.x" do + let(:version) { '8.100' } + + it "fails with a CSPG014 error" do + expect(postgres_validator).to receive(:fail_with).with(error_message) + postgres_validator.backend_verify_postgres_version(connection) + end + end + + context "when external version is <= 9.1" do + let(:version) { '9.1' } + + it "fails with a CSPG014 error" do + expect(postgres_validator).to receive(:fail_with).with(error_message) + postgres_validator.backend_verify_postgres_version(connection) + end + end + + context "when external version is > 9.x" do + let(:version) { '10.0' } + + it "fails with a CSPG014 error" do + expect(postgres_validator).to receive(:fail_with).with(error_message) + postgres_validator.backend_verify_postgres_version(connection) + end + end + + context "when external version is == 9.2" do + let(:version) { '9.2' } + + it "does not fail with a CSPG014 error" do + expect(postgres_validator).to_not receive(:fail_with) + postgres_validator.backend_verify_postgres_version(connection) + end + end + + context "when external version is >= 9.2" do + let(:version) { '9.6' } + + it "does not fail with a CSPG014 error" do + expect(postgres_validator).to_not receive(:fail_with) + postgres_validator.backend_verify_postgres_version(connection) + end + end + end + context "#connectivity_validation" do context "when a postgres exception is raised" do before do diff --git a/omnibus/files/private-chef-cookbooks/private-chef/templates/default/postgresql.conf.erb b/omnibus/files/private-chef-cookbooks/private-chef/templates/default/postgresql.conf.erb index abb4527c3b..593eeefa0b 100644 --- a/omnibus/files/private-chef-cookbooks/private-chef/templates/default/postgresql.conf.erb +++ b/omnibus/files/private-chef-cookbooks/private-chef/templates/default/postgresql.conf.erb @@ -152,8 +152,9 @@ work_mem = <%= node['private_chef']['postgresql']['work_mem'] %> # min 64kB # - Settings - -wal_level = <%= node['private_chef']['postgresql']['wal_level'] %> # minimal, archive, or hot_standby +wal_level = <%= node['private_chef']['postgresql']['wal_level'] %> # minimal, logical, or replica # (change requires restart) + # old names "archive" and "hot_standby" are accepted, too, but mapped to "replica" #fsync = on # turns forced synchronization on or off #synchronous_commit = on # synchronization level; on, off, or local #wal_sync_method = fsync # the default is the first option @@ -173,10 +174,12 @@ wal_level = <%= node['private_chef']['postgresql']['wal_level'] %> # minimal, # - Checkpoints - -checkpoint_segments = <%= node['private_chef']['postgresql']['checkpoint_segments'] %> # in logfile segments, min 1, 16MB each, default 3 checkpoint_timeout = <%= node['private_chef']['postgresql']['checkpoint_timeout'] %> # range 30s-1h, default 5min checkpoint_completion_target = <%= node['private_chef']['postgresql']['checkpoint_completion_target'] %> # checkpoint target duration, 0.0 - 1.0, default 0.5 +checkpoint_flush_after = <%= node['private_chef']['postgresql']['checkpoint_flush_after'] %> checkpoint_warning = <%= node['private_chef']['postgresql']['checkpoint_warning'] %> # 0 disables, default 30s +max_wal_size = <%= node['private_chef']['postgresql']['max_wal_size'] %> # integer, defaults to 1GB +min_wal_size = <%= node['private_chef']['postgresql']['min_wal_size'] %> # integer, defaults to 80MB # - Archiving -