Fix default value for wsrep_sync_wait option
The default value for wsrep_sync_wait option should be `None`. However, since 0 is set incorrectly, an unintended process is executed. This patch fixes default value for wsrep_sync_wait option to `None` instead of `0`. Change-Id: Ifb1dc7ddcb127a69ea01234922caa7ca5ab111ce
This commit is contained in:
parent
32b042e706
commit
b689b6320c
@ -64,7 +64,8 @@ database_opts = [
|
|||||||
default=None,
|
default=None,
|
||||||
help=(
|
help=(
|
||||||
'For Galera only, configure wsrep_sync_wait causality '
|
'For Galera only, configure wsrep_sync_wait causality '
|
||||||
'checks on new connections'
|
'checks on new connections. Default is None, meaning don\'t '
|
||||||
|
'configure any setting.'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
cfg.BoolOpt(
|
cfg.BoolOpt(
|
||||||
|
@ -145,7 +145,7 @@ class _TransactionFactory(object):
|
|||||||
self._engine_cfg = {
|
self._engine_cfg = {
|
||||||
'sqlite_fk': _Default(False),
|
'sqlite_fk': _Default(False),
|
||||||
'mysql_sql_mode': _Default('TRADITIONAL'),
|
'mysql_sql_mode': _Default('TRADITIONAL'),
|
||||||
'mysql_wsrep_sync_wait': _Default(0),
|
'mysql_wsrep_sync_wait': _Default(),
|
||||||
'mysql_enable_ndb': _Default(False),
|
'mysql_enable_ndb': _Default(False),
|
||||||
'connection_recycle_time': _Default(3600),
|
'connection_recycle_time': _Default(3600),
|
||||||
'connection_debug': _Default(0),
|
'connection_debug': _Default(0),
|
||||||
@ -219,8 +219,8 @@ class _TransactionFactory(object):
|
|||||||
|
|
||||||
:param mysql_sql_mode: MySQL SQL mode, defaults to TRADITIONAL
|
:param mysql_sql_mode: MySQL SQL mode, defaults to TRADITIONAL
|
||||||
|
|
||||||
:param mysql_wsrep_sync_wait: MySQL wsrep_sync_wait, defaults to False
|
:param mysql_wsrep_sync_wait: MySQL wsrep_sync_wait, defaults to None,
|
||||||
(i.e. '0')
|
which indicates no setting will be passed
|
||||||
|
|
||||||
:param mysql_enable_ndb: enable MySQL Cluster (NDB) support
|
:param mysql_enable_ndb: enable MySQL Cluster (NDB) support
|
||||||
|
|
||||||
@ -1249,7 +1249,8 @@ class LegacyEngineFacade(object):
|
|||||||
:keyword mysql_sql_mode: the SQL mode to be used for MySQL sessions.
|
:keyword mysql_sql_mode: the SQL mode to be used for MySQL sessions.
|
||||||
(defaults to TRADITIONAL)
|
(defaults to TRADITIONAL)
|
||||||
:keyword mysql_wsrep_sync_wait: value of wsrep_sync_wait for Galera
|
:keyword mysql_wsrep_sync_wait: value of wsrep_sync_wait for Galera
|
||||||
(defaults to '0')
|
(defaults to None, which indicates no setting
|
||||||
|
will be passed)
|
||||||
:keyword mysql_enable_ndb: If True, transparently enables support for
|
:keyword mysql_enable_ndb: If True, transparently enables support for
|
||||||
handling MySQL Cluster (NDB).
|
handling MySQL Cluster (NDB).
|
||||||
(defaults to False)
|
(defaults to False)
|
||||||
|
@ -1379,6 +1379,19 @@ class PatchFactoryTest(test_base.BaseTestCase):
|
|||||||
self.assertTrue(engine_args['sqlite_fk'])
|
self.assertTrue(engine_args['sqlite_fk'])
|
||||||
self.assertEqual("FOOBAR", engine_args["mysql_sql_mode"])
|
self.assertEqual("FOOBAR", engine_args["mysql_sql_mode"])
|
||||||
self.assertEqual(38, engine_args["max_overflow"])
|
self.assertEqual(38, engine_args["max_overflow"])
|
||||||
|
self.assertNotIn("mysql_wsrep_sync_wait", engine_args)
|
||||||
|
|
||||||
|
def test_new_manager_from_options(self):
|
||||||
|
"""test enginefacade's defaults given a default structure from opts"""
|
||||||
|
|
||||||
|
factory = enginefacade._TransactionFactory()
|
||||||
|
cfg.CONF.register_opts(options.database_opts, 'database')
|
||||||
|
factory.configure(**dict(cfg.CONF.database.items()))
|
||||||
|
engine_args = factory._engine_args_for_conf(None)
|
||||||
|
|
||||||
|
self.assertEqual(None, engine_args["mysql_wsrep_sync_wait"])
|
||||||
|
self.assertEqual(True, engine_args["sqlite_synchronous"])
|
||||||
|
self.assertEqual("TRADITIONAL", engine_args["mysql_sql_mode"])
|
||||||
|
|
||||||
|
|
||||||
class SynchronousReaderWSlaveMockFacadeTest(MockFacadeTest):
|
class SynchronousReaderWSlaveMockFacadeTest(MockFacadeTest):
|
||||||
|
@ -110,3 +110,4 @@ pool_timeout=7
|
|||||||
|
|
||||||
self.assertTrue(len(conf.database.items()) > 1)
|
self.assertTrue(len(conf.database.items()) > 1)
|
||||||
self.assertEqual('sqlite:///:memory:', conf.database.connection)
|
self.assertEqual('sqlite:///:memory:', conf.database.connection)
|
||||||
|
self.assertEqual(None, self.conf.database.mysql_wsrep_sync_wait)
|
||||||
|
9
releasenotes/notes/fix_mysql_wsrsp-0ef98dec5ea3759f.yaml
Normal file
9
releasenotes/notes/fix_mysql_wsrsp-0ef98dec5ea3759f.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The newly added mysql_wsrep_sync_wait parameter now defaults to non-present
|
||||||
|
in the enginefacade's default configuration options, so that it is not
|
||||||
|
configured in a MySQL / MariaDB database by default, unless passed in the
|
||||||
|
options explicitly. Previously, the default value was "0", meaning the
|
||||||
|
wsrep_sync_wait parameter would be set unconditionally on new connections,
|
||||||
|
which would fail for MySQL backends that don't provide for this setting.
|
Loading…
x
Reference in New Issue
Block a user