Database migrations fail when schema includes dash

Bug #1892370 reported by Mohammed Naser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Mohammed Naser

Bug Description

In our database migrations, we run the following:

'ALTER DATABASE %s DEFAULT CHARACTER SET utf8'

If usnig a database name that includes a dash, the migration fails because it requires to be wrapped by `.

Tags: db
Changed in nova:
assignee: nobody → Mohammed Naser (mnaser)
status: New → In Progress
Revision history for this message
Mohammed Naser (mnaser) wrote :
melanie witt (melwitt)
Changed in nova:
importance: Undecided → Medium
tags: added: db
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/747164
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b39d8b8c9675d554791511a13b62651c8546e7b9
Submitter: Zuul
Branch: master

commit b39d8b8c9675d554791511a13b62651c8546e7b9
Author: Mohammed Naser <email address hidden>
Date: Thu Aug 20 09:42:57 2020 -0400

    db: fix database migrations when name includes dash

    If the name of the database used includes a dash, it will fail the
    migrations with an error like this:

      You have an error in your SQL syntax; check the manual that corresponds to
      your MySQL server version for the right syntax to use near '-cell0 DEFAULT
      CHARACTER SET utf8' at line 1

    Even more difficult, any future migration fails with the instances table
    already existing making it very hard to troubleshoot. This patch fixes
    it by wrapping the schema name in the query.

    Closes-Bug: #1892370
    Change-Id: Ic96dc415396985737b5bdeffed61077af5f245e6

Changed in nova:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.