DB migration problem with federation extension

Bug #1426334 reported by Marco Fargetta
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Morgan Fainberg

Bug Description

Running a keystone-manage db_sync with extension federation fails if the tables already exist.

See http://paste.openstack.org/show/182962/

The problem is that the table created to support the federation are not forced to be in utf8 but the migration script check they are in utf8 and fails otherwise.

Tags: federation sql
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/159803

Changed in keystone:
assignee: nobody → Marco Fargetta (marco-fargetta)
status: New → In Progress
Revision history for this message
Boris Bobrov (bbobrov) wrote :

Sorry, but I don't run into this bug. In session http://paste.openstack.org/show/182968/ I pull latest master, downgrade the table and upgrade it, and it works OK.

Maybe there are some special cases where the bug occurs?

Revision history for this message
Marco Fargetta (fmarco76) wrote :

In your test you remote the table by downgrade. If you do not downgrade but run again the db_sync you should get the error (existing installation will not remove the DB before to upgrade it).

Revision history for this message
Boris Bobrov (bbobrov) wrote :

OK, should I hit the bug if I do "db_sync --extension federation 4" and after that "db_sync --extension federation 5"?

Revision history for this message
Marco Fargetta (fmarco76) wrote :

Yes, if I do before 4 and after 5 I get the error

Revision history for this message
Boris Bobrov (bbobrov) wrote :
Revision history for this message
Marco Fargetta (fmarco76) wrote :

It is very strange. I repeated the test many time and always with the same result:

http://paste.openstack.org/show/183030/

Is the table in you DB created as utf8 or latin (show create table identity_provider)?

Revision history for this message
Boris Bobrov (bbobrov) wrote :

http://paste.openstack.org/show/183039/ . That's MySQL in default configuration from Debian stable.

Revision history for this message
Marco Fargetta (fmarco76) wrote :

I am analysing the reasons of this difference between my test and Boris test. If I create the keystone DB with utf8 default encoding it works properly otherwise not. Devstack creates the DB with utf8 as default.

In the guideline there is not indication that utf8 is requested. Therefore, we should specify utf8 in all the table as it is except the 3 for the federation.

Revision history for this message
Marco Fargetta (fmarco76) wrote :

If I do not specify nothing my database default is latin1, this is the reason of the difference. I am on Ubuntu and there is not specification for the encoding (in my installation). If Debian put utf8 as default then you should not get any error in any test with the DB for this utf8 problem.

Revision history for this message
Boris Bobrov (bbobrov) wrote :

OK, I hit the bug now. And my "show create table identity_provider" now shows collation latin1. I have absolutely no idea why it was utf8 in the paste above.

But. I don't understand, why I hit the bug when I db_sync from 0 to 1 and then from 1 to 2 and don't when I do db_sync 2.

Revision history for this message
Marco Fargetta (fmarco76) wrote :

The reason is that before any change in the DB there is a conformity chack of all the tables and if it is OK than the downgrade/upgrade is performed. There is not check after. As a result if you create a table with some problems it is verified the next time you perform the upgrade/downgrade. So when you run db_sync <any_value> there are not table and that is OK, if you run again there is the sanity check and it fail.

Changed in keystone:
milestone: none → kilo-3
importance: Undecided → High
Changed in keystone:
assignee: Marco Fargetta (marco-fargetta) → Adam Young (ayoung)
Adam Young (ayoung)
Changed in keystone:
assignee: Adam Young (ayoung) → Marco Fargetta (marco-fargetta)
Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

@Borris,

Likely your DB has correct defaults set. This can occur when the defaults for the DB installation is not innodb/utf8

Changed in keystone:
assignee: Marco Fargetta (marco-fargetta) → Morgan Fainberg (mdrnstm)
Changed in keystone:
assignee: Morgan Fainberg (mdrnstm) → Marek Denis (marek-denis)
Changed in keystone:
assignee: Marek Denis (marek-denis) → Marco Fargetta (marco-fargetta)
tags: added: federation
tags: added: sql
Changed in keystone:
assignee: Marco Fargetta (marco-fargetta) → Morgan Fainberg (mdrnstm)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/159803
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=684a0db51cceba7e62609cc02dd9f18bbef62e5c
Submitter: Jenkins
Branch: master

commit 684a0db51cceba7e62609cc02dd9f18bbef62e5c
Author: Marco Fargetta <email address hidden>
Date: Fri Feb 27 12:43:48 2015 +0100

    Adding utf8 to federation tables

    Tables have to be in utf8 for the migration utility
    to work properly. This fixes the UTF8 issues with the
    federation tables in-line and should be able to be
    backported. A subsequent change to handle sanity checks
    in a more sane way (post migrations) will be implemented
    going forward.

    Change-Id: Id68c3f307f53b6a4de011e2608d899d044aced68
    Closes-Bug: 1426334

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: kilo-3 → 2015.1.0
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.