Merge "Remove the idle_timeout option."

This commit is contained in:
Zuul 2021-06-23 14:41:58 +00:00 committed by Gerrit Code Review
commit 0e76c02160
5 changed files with 7 additions and 26 deletions

View File

@ -51,18 +51,6 @@ database_opts = [
cfg.IntOpt( cfg.IntOpt(
'connection_recycle_time', 'connection_recycle_time',
default=3600, default=3600,
deprecated_opts=[
cfg.DeprecatedOpt('idle_timeout',
group="DATABASE"),
cfg.DeprecatedOpt('idle_timeout',
group="database"),
cfg.DeprecatedOpt('sql_idle_timeout',
group='DEFAULT'),
cfg.DeprecatedOpt('sql_idle_timeout',
group='DATABASE'),
cfg.DeprecatedOpt('idle_timeout',
group='sql')
],
help='Connections which have been present in the connection ' help='Connections which have been present in the connection '
'pool longer than this number of seconds will be replaced ' 'pool longer than this number of seconds will be replaced '
'with a new one the next time they are checked out from ' 'with a new one the next time they are checked out from '

View File

@ -188,8 +188,6 @@ class _TransactionFactory(object):
self._legacy_facade = None self._legacy_facade = None
self._start_lock = threading.Lock() self._start_lock = threading.Lock()
@debtcollector.renames.renamed_kwarg(
"idle_timeout", "connection_recycle_time", replace=True)
def configure_defaults(self, **kw): def configure_defaults(self, **kw):
"""Apply default configurational options. """Apply default configurational options.
@ -298,8 +296,6 @@ class _TransactionFactory(object):
""" """
self._configure(True, kw) self._configure(True, kw)
@debtcollector.renames.renamed_kwarg(
"idle_timeout", "connection_recycle_time", replace=True)
def configure(self, **kw): def configure(self, **kw):
"""Apply configurational options. """Apply configurational options.

View File

@ -68,7 +68,6 @@ pool_timeout=7
def test_dbapi_database_deprecated_parameters(self): def test_dbapi_database_deprecated_parameters(self):
path = self.create_tempfiles([['tmp', b'[DATABASE]\n' path = self.create_tempfiles([['tmp', b'[DATABASE]\n'
b'sql_connection=fake_connection\n' b'sql_connection=fake_connection\n'
b'sql_idle_timeout=100\n'
b'sql_max_retries=22\n' b'sql_max_retries=22\n'
b'reconnect_interval=17\n' b'reconnect_interval=17\n'
b'sqlalchemy_max_overflow=101\n' b'sqlalchemy_max_overflow=101\n'
@ -76,8 +75,6 @@ pool_timeout=7
]])[0] ]])[0]
self.conf(['--config-file', path]) self.conf(['--config-file', path])
self.assertEqual('fake_connection', self.conf.database.connection) self.assertEqual('fake_connection', self.conf.database.connection)
self.assertEqual(100, self.conf.database.connection_recycle_time)
self.assertEqual(100, self.conf.database.idle_timeout)
self.assertEqual(22, self.conf.database.max_retries) self.assertEqual(22, self.conf.database.max_retries)
self.assertEqual(17, self.conf.database.retry_interval) self.assertEqual(17, self.conf.database.retry_interval)
self.assertEqual(101, self.conf.database.max_overflow) self.assertEqual(101, self.conf.database.max_overflow)
@ -86,12 +83,9 @@ pool_timeout=7
def test_dbapi_database_deprecated_parameters_sql(self): def test_dbapi_database_deprecated_parameters_sql(self):
path = self.create_tempfiles([['tmp', b'[sql]\n' path = self.create_tempfiles([['tmp', b'[sql]\n'
b'connection=test_sql_connection\n' b'connection=test_sql_connection\n'
b'idle_timeout=99\n'
]])[0] ]])[0]
self.conf(['--config-file', path]) self.conf(['--config-file', path])
self.assertEqual('test_sql_connection', self.conf.database.connection) self.assertEqual('test_sql_connection', self.conf.database.connection)
self.assertEqual(99, self.conf.database.connection_recycle_time)
self.assertEqual(99, self.conf.database.idle_timeout)
def test_deprecated_dbapi_parameters(self): def test_deprecated_dbapi_parameters(self):
path = self.create_tempfiles([['tmp', b'[DEFAULT]\n' path = self.create_tempfiles([['tmp', b'[DEFAULT]\n'

View File

@ -404,10 +404,6 @@ class EngineFacadeTestCase(oslo_test.BaseTestCase):
self.assertFalse(ses.autocommit) self.assertFalse(ses.autocommit)
self.assertTrue(ses.expire_on_commit) self.assertTrue(ses.expire_on_commit)
def test_direct_invocation_deprecated_args(self):
facade = session.EngineFacade("sqlite://", idle_timeout=59)
self.assertEqual(59, facade.get_engine().pool._recycle)
@mock.patch('oslo_db.sqlalchemy.orm.get_maker') @mock.patch('oslo_db.sqlalchemy.orm.get_maker')
@mock.patch('oslo_db.sqlalchemy.engines.create_engine') @mock.patch('oslo_db.sqlalchemy.engines.create_engine')
def test_creation_from_config(self, create_engine, get_maker): def test_creation_from_config(self, create_engine, get_maker):

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Removed the ``[DATABASE] idle_timeout``, ``[database] idle_timeout``,
``[sql] idle_timeout``, ``[DEFAULT] sql_idle_timeout`` and
``[DATABASE] sql_idle_timeout`` options. These were all legacy
aliases for ``[database] connection_recycle_time``.