Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3421 closed undecided (fixed)

OperationalError "Unknown system variable 'storage_engine'" when using MySQL 5.7

Reported by: rutsky Owned by: dustin
Priority: major Milestone: undecided
Version: master Keywords:


$ pip install MySQL-python
$ sudo docker run --name bb-test-mysql -e MYSQL_ROOT_PASSWORD=password \
       -p -d mysql:5.7
$ BUILDBOT_TEST_DB_URL=mysql+mysqldb://root:password@ trial --reporter=text -x buildbot.test.integration.test_upgrade.TestWeirdChanges.testUpgradeChangeNoRevision
Traceback (most recent call last):
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/twisted/python/", line 246, in inContext
    result = inContext.theWork()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/twisted/python/", line 262, in <lambda>
    inContext.theWork = lambda:, func, *args, **kw)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/twisted/python/", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/twisted/python/", line 81, in callWithContext
    return func(*args,**kw)
  File "/home/bob/stuff/buildbot/buildbot-master/master/buildbot/db/", line 186, in __thd
    arg = self.engine.contextual_connect()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 55, in contextual_connect
    connection = self._tl_connection_cls(self, self.pool.connect(), **kw)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/", line 236, in connect
    return _ConnectionFairy(self).checkout()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/", line 401, in __init__
    rec = self._connection_record = pool._do_get()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/", line 746, in _do_get
    con = self._create_connection()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/", line 189, in _create_connection
    return _ConnectionRecord(self)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/", line 282, in __init__
    self.connection = self.__connect()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/", line 344, in __connect
    connection = self.__pool._creator()
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 80, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 281, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/MySQLdb/", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/home/bob/stuff/buildbot/env-master/local/lib/python2.7/site-packages/MySQLdb/", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (OperationalError) (1193, "Unknown system variable 'storage_engine'") None None

Ran 1 tests in 0.015s

FAILED (errors=1)

I tested with MySQL 5.7 image from Docker.

IMO it's either SQLAlchemy doesn't play nicely with MySQL 5.7, or default MySQL image from Docker requires additional configuration (however with MySQL 5.5 all works fine). Needs further investigation.

Change History (7)

comment:1 Changed 5 years ago by dustin

I saw this too. The "storage_engine" bit is something Buildbot tries to set (since it's not compatible with InnoDB). Apparently MySQL removed the option to set that option on a per-connection basis.

comment:2 Changed 5 years ago by tardyp

This is related to this bug:

also, google found confluence has similar bug:'Unknown+system+variable+'storage_engine''+using+MySQL+5.7.x

Cause MySQL 5.7.x uses InnoDB by default, and has removed the storage_engine system variable.

comment:3 Changed 5 years ago by dustin

  • Owner set to dustin
  • Status changed from new to assigned

comment:4 Changed 5 years ago by dustin

  • master/buildbot/db/

    diff --git a/master/buildbot/db/ b/master/buildbot/db/
    index 0bd22af..ee0cc42 100644
    a b class BuildbotEngineStrategy(strategies.ThreadLocalEngineStrategy): 
    129129        charset to be True and 'utf8', failing if they were set to
    130130        anything else."""
    132132        kwargs['pool_recycle'] = int(u.query.pop('max_idle', 3600))
    134134        # default to the MyISAM storage engine; InnoDB is not supported
    135135        storage_engine = u.query.pop('storage_engine', 'MyISAM')
    136136        kwargs['connect_args'] = {
    137             'init_command': 'SET storage_engine=%s' % storage_engine,
     137            'init_command': 'SET default_storage_engine=%s' % storage_engine,
    138138        }
    140140        if 'use_unicode' in u.query:
    141141            if u.query['use_unicode'] != "True":
    142142                raise TypeError("Buildbot requires use_unicode=True " +
    143143                                "(and adds it automatically)")
    144144        else:
    145145            u.query['use_unicode'] = True

seems to help, but the warnings about blob columns having default values are now errors :(

Last edited 5 years ago by dustin (previous) (diff)

comment:6 Changed 5 years ago by dustin

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:7 Changed 5 years ago by rutsky

I can confirm that now tests are passing on MySQL 5.7.

Note: See TracTickets for help on using tickets.