Browse Source

Deprecate idle_timeout option

The idle_timeout parameter is deprecated, use connection_recycle_time
instead[1].

[1]https://review.opendev.org/#/c/334182/

Change-Id: I5e4f19fc4b98f19e380e7884cfcd6f112e350680
Closes-Bug: #1826692
changes/06/656106/2
ZhongShengping 3 years ago
parent
commit
3eb0e70947
  1. 100
      manifests/db.pp
  2. 4
      releasenotes/notes/deprecate_idle_timeout_parameter-90814e13548fd549.yaml
  3. 42
      spec/defines/oslo_db_spec.rb

100
manifests/db.pp

@ -42,7 +42,7 @@
# (Optional) The SQL mode to be used for MySQL sessions.
# Defaults to $::os_service_default
#
# [*idle_timeout*]
# [*connection_recycle_time*]
# (Optional) Timeout before idle SQL connections are reaped.
# Defaults to $::os_service_default
#
@ -106,30 +106,38 @@
# (Optional) Enable the experimental use of thread pooling for all DB API calls (boolean value)
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*idle_timeout*]
# (Optional) Timeout before idle SQL connections are reaped.
# Defaults to undef
#
define oslo::db(
$config_group = 'database',
$sqlite_synchronous = $::os_service_default,
$backend = $::os_service_default,
$manage_backend_package = true,
$backend_package_ensure = present,
$connection = $::os_service_default,
$slave_connection = $::os_service_default,
$mysql_sql_mode = $::os_service_default,
$idle_timeout = $::os_service_default,
$min_pool_size = $::os_service_default,
$max_pool_size = $::os_service_default,
$max_retries = $::os_service_default,
$retry_interval = $::os_service_default,
$max_overflow = $::os_service_default,
$connection_debug = $::os_service_default,
$connection_trace = $::os_service_default,
$pool_timeout = $::os_service_default,
$use_db_reconnect = $::os_service_default,
$db_retry_interval = $::os_service_default,
$db_inc_retry_interval = $::os_service_default,
$db_max_retry_interval = $::os_service_default,
$db_max_retries = $::os_service_default,
$use_tpool = $::os_service_default,
$config_group = 'database',
$sqlite_synchronous = $::os_service_default,
$backend = $::os_service_default,
$manage_backend_package = true,
$backend_package_ensure = present,
$connection = $::os_service_default,
$slave_connection = $::os_service_default,
$mysql_sql_mode = $::os_service_default,
$connection_recycle_time = $::os_service_default,
$min_pool_size = $::os_service_default,
$max_pool_size = $::os_service_default,
$max_retries = $::os_service_default,
$retry_interval = $::os_service_default,
$max_overflow = $::os_service_default,
$connection_debug = $::os_service_default,
$connection_trace = $::os_service_default,
$pool_timeout = $::os_service_default,
$use_db_reconnect = $::os_service_default,
$db_retry_interval = $::os_service_default,
$db_inc_retry_interval = $::os_service_default,
$db_max_retry_interval = $::os_service_default,
$db_max_retries = $::os_service_default,
$use_tpool = $::os_service_default,
# DEPRCATED PARAMETERS
$idle_timeout = $::os_service_default,
) {
include ::oslo::params
@ -175,27 +183,31 @@ define oslo::db(
}
}
if $idle_timeout {
warning('The idle_timeout parameter is deprecated. Please use connection_recycle_time instead.')
}
$database_options = {
"${config_group}/sqlite_synchronous" => { value => $sqlite_synchronous },
"${config_group}/backend" => { value => $backend },
"${config_group}/connection" => { value => $connection, secret => true },
"${config_group}/slave_connection" => { value => $slave_connection, secret => true },
"${config_group}/mysql_sql_mode" => { value => $mysql_sql_mode },
"${config_group}/idle_timeout" => { value => $idle_timeout },
"${config_group}/min_pool_size" => { value => $min_pool_size },
"${config_group}/max_pool_size" => { value => $max_pool_size },
"${config_group}/max_retries" => { value => $max_retries },
"${config_group}/retry_interval" => { value => $retry_interval },
"${config_group}/max_overflow" => { value => $max_overflow },
"${config_group}/connection_debug" => { value => $connection_debug },
"${config_group}/connection_trace" => { value => $connection_trace },
"${config_group}/pool_timeout" => { value => $pool_timeout },
"${config_group}/use_db_reconnect" => { value => $use_db_reconnect },
"${config_group}/db_retry_interval" => { value => $db_retry_interval },
"${config_group}/db_inc_retry_interval" => { value => $db_inc_retry_interval },
"${config_group}/db_max_retry_interval" => { value => $db_max_retry_interval },
"${config_group}/db_max_retries" => { value => $db_max_retries },
"${config_group}/use_tpool" => { value => $use_tpool },
"${config_group}/sqlite_synchronous" => { value => $sqlite_synchronous },
"${config_group}/backend" => { value => $backend },
"${config_group}/connection" => { value => $connection, secret => true },
"${config_group}/slave_connection" => { value => $slave_connection, secret => true },
"${config_group}/mysql_sql_mode" => { value => $mysql_sql_mode },
"${config_group}/connection_recycle_time" => { value => $connection_recycle_time },
"${config_group}/min_pool_size" => { value => $min_pool_size },
"${config_group}/max_pool_size" => { value => $max_pool_size },
"${config_group}/max_retries" => { value => $max_retries },
"${config_group}/retry_interval" => { value => $retry_interval },
"${config_group}/max_overflow" => { value => $max_overflow },
"${config_group}/connection_debug" => { value => $connection_debug },
"${config_group}/connection_trace" => { value => $connection_trace },
"${config_group}/pool_timeout" => { value => $pool_timeout },
"${config_group}/use_db_reconnect" => { value => $use_db_reconnect },
"${config_group}/db_retry_interval" => { value => $db_retry_interval },
"${config_group}/db_inc_retry_interval" => { value => $db_inc_retry_interval },
"${config_group}/db_max_retry_interval" => { value => $db_max_retry_interval },
"${config_group}/db_max_retries" => { value => $db_max_retries },
"${config_group}/use_tpool" => { value => $use_tpool },
}
create_resources($name, $database_options)

4
releasenotes/notes/deprecate_idle_timeout_parameter-90814e13548fd549.yaml

@ -0,0 +1,4 @@
---
deprecations:
- db::idle_timeout is deprecated and will be removed in a future
release. Please use db::connection_recycle_time instead.

42
spec/defines/oslo_db_spec.rb

@ -13,7 +13,7 @@ describe 'oslo::db' do
is_expected.to contain_keystone_config('database/connection').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/slave_connection').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/mysql_sql_mode').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/idle_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/connection_recycle_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/min_pool_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/max_pool_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('database/max_retries').with_value('<SERVICE DEFAULT>')
@ -34,25 +34,25 @@ describe 'oslo::db' do
context 'with overridden parameters' do
let :params do
{
:config_group => 'custom_group',
:backend => 'sqlalchemy',
:connection => 'mysql+pymysql://db:db@localhost/db',
:mysql_sql_mode => 'TRADITIONAL',
:idle_timeout => '3601',
:min_pool_size => '2',
:max_pool_size => '100',
:max_retries => '10',
:retry_interval => '10',
:max_overflow => '50',
:connection_debug => '0',
:connection_trace => true,
:pool_timeout => '10',
:use_db_reconnect => true,
:db_retry_interval => '1',
:db_inc_retry_interval => true,
:db_max_retry_interval => '10',
:db_max_retries => '20',
:use_tpool => true,
:config_group => 'custom_group',
:backend => 'sqlalchemy',
:connection => 'mysql+pymysql://db:db@localhost/db',
:mysql_sql_mode => 'TRADITIONAL',
:connection_recycle_time => '3601',
:min_pool_size => '2',
:max_pool_size => '100',
:max_retries => '10',
:retry_interval => '10',
:max_overflow => '50',
:connection_debug => '0',
:connection_trace => true,
:pool_timeout => '10',
:use_db_reconnect => true,
:db_retry_interval => '1',
:db_inc_retry_interval => true,
:db_max_retry_interval => '10',
:db_max_retries => '20',
:use_tpool => true,
}
end
@ -60,7 +60,7 @@ describe 'oslo::db' do
is_expected.to contain_keystone_config('custom_group/backend').with_value('sqlalchemy')
is_expected.to contain_keystone_config('custom_group/connection').with_value('mysql+pymysql://db:db@localhost/db').with_secret(true)
is_expected.to contain_keystone_config('custom_group/mysql_sql_mode').with_value('TRADITIONAL')
is_expected.to contain_keystone_config('custom_group/idle_timeout').with_value('3601')
is_expected.to contain_keystone_config('custom_group/connection_recycle_time').with_value('3601')
is_expected.to contain_keystone_config('custom_group/min_pool_size').with_value('2')
is_expected.to contain_keystone_config('custom_group/max_pool_size').with_value('100')
is_expected.to contain_keystone_config('custom_group/max_retries').with_value('10')

Loading…
Cancel
Save