Allow max_connections to be overridden for mysql server

The default of 151 is very small for most openstack use cases.
Picked a higher recommended default that can be overridden as
necessary.
Added stub for newer postgresql cookbook level spec tests.

Change-Id: I0d7b0893d143202f55f04ddcdbc8618aaaacef25
Closes-Bug: #1398527
This commit is contained in:
Mark Vanderwiel 2014-12-02 14:59:05 -06:00
parent 5af34f8e29
commit a27cfab06e
6 changed files with 22 additions and 1 deletions

View File

@ -9,6 +9,7 @@ This file is used to list changes made in each version of the openstack-ops-data
directly
* Bump mysql cookbook version for above password patch
* Bump Chef gem to 11.16
* Allow max_connections override for mysql server
## 9.2.0
* Update database and mysql dependency

View File

@ -86,6 +86,20 @@ The following attributes are defined in attributes/database.rb of the common coo
If the value of the "bind_interface" attribute is non-nil, then the database service will be bound to the first IP address on that interface. If the value of the "bind_interface" attribute is nil, then the database service will be bound to the IP address specified in the host attribute.
The following mysql specific attributes are available:
* `['mysql']['tunable']['default-storage-engine']`
* `['mysql']['bind_address']`
* `['mysql']['tunable']['innodb_thread_concurrency']`
* `['mysql']['tunable']['innodb_commit_concurrency']`
* `['mysql']['tunable']['innodb_read_io_threads']`
* `['mysql']['tunable']['innodb_flush_log_at_trx_commit']`
* `['mysql']['tunable']['skip-name-resolve']`
* `['mysql']['tunable']['character-set-server']`
* `['mysql']['tunable']['max_connections']`
For more information see: http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html
Testing
=====

View File

@ -41,6 +41,7 @@ node.override['mysql']['tunable']['innodb_read_io_threads'] = '4'
node.override['mysql']['tunable']['innodb_flush_log_at_trx_commit'] = '2'
node.override['mysql']['tunable']['skip-name-resolve'] = true
node.override['mysql']['tunable']['character-set-server'] = 'utf8'
node.override['mysql']['tunable']['max_connections'] = '1024'
include_recipe 'openstack-ops-database::mysql-client'

View File

@ -23,6 +23,7 @@ describe 'openstack-ops-database::mysql-server' do
expect(chef_run.node['mysql']['tunable']['innodb_flush_log_at_trx_commit']).to eql '2'
expect(chef_run.node['mysql']['tunable']['skip-name-resolve']).to eql true
expect(chef_run.node['mysql']['tunable']['character-set-server']).to eql 'utf8'
expect(chef_run.node['mysql']['tunable']['max_connections']).to eql '1024'
end
it 'includes mysql recipes' do
@ -46,7 +47,8 @@ describe 'openstack-ops-database::mysql-server' do
/^innodb_read_io_threads = 4$/,
/^innodb_flush_log_at_trx_commit = 2$/,
/^skip-name-resolve$/,
/^character-set-server = utf8$/].each do |line|
/^character-set-server = utf8$/,
/^max_connections = 1024$/].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
end
end

View File

@ -27,6 +27,8 @@ shared_context 'database-stubs' do
stub_command("/usr/bin/mysql -u root -e 'show databases;'")
# for debian
stub_command("\"/usr/bin/mysql\" -u root -e 'show databases;'")
# for postgresql
stub_command('ls /var/lib/postgresql/9.1/main/recovery.conf')
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
.with('lo')

View File

@ -12,3 +12,4 @@ innodb_flush_log_at_trx_commit = <%= node['mysql']['tunable']['innodb_flush_log_
skip-name-resolve
<% end %>
character-set-server = <%= node['mysql']['tunable']['character-set-server'] %>
max_connections = <%= node['mysql']['tunable']['max_connections'] %>