Browse Source

Remove the idle_timeout option.

The option was replaced 4 years ago[1] by connection_recycle_time. The
option is not anymore present in sqlalchemy. It's the good time to
remove it.

[1] 6634218415

Change-Id: I0c26c3e14ad9ad9a4f30af80757e369d6042441a
changes/41/778441/7
Daniel Bengtsson 1 year ago
parent
commit
a857b83c9c
  1. 12
      oslo_db/options.py
  2. 4
      oslo_db/sqlalchemy/enginefacade.py
  3. 6
      oslo_db/tests/sqlalchemy/test_options.py
  4. 4
      oslo_db/tests/sqlalchemy/test_sqlalchemy.py
  5. 7
      releasenotes/notes/removed-deprecated-idle-timeout-051a6a9a792bd8de.yaml

12
oslo_db/options.py

@ -51,18 +51,6 @@ database_opts = [
cfg.IntOpt(
'connection_recycle_time',
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 '
'pool longer than this number of seconds will be replaced '
'with a new one the next time they are checked out from '

4
oslo_db/sqlalchemy/enginefacade.py

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

6
oslo_db/tests/sqlalchemy/test_options.py

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

4
oslo_db/tests/sqlalchemy/test_sqlalchemy.py

@ -404,10 +404,6 @@ class EngineFacadeTestCase(oslo_test.BaseTestCase):
self.assertFalse(ses.autocommit)
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.engines.create_engine')
def test_creation_from_config(self, create_engine, get_maker):

7
releasenotes/notes/removed-deprecated-idle-timeout-051a6a9a792bd8de.yaml

@ -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``.
Loading…
Cancel
Save