The string greater than the declared on column in MySQL silently truncated.

Bug #1224898 reported by Ilya Pekelny
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Unassigned
oslo-incubator
Fix Released
High
Ilya Pekelny

Bug Description

Each string greater than the maximum length of the field that is being recorded, silently truncated. This is a mysql specific issue, which can be resolved by setting sql_mode to "traditional", after which an error is raised on truncation, allowing us to catch the error before the data is stored. See also the mailing with discussion of this problem: http://<email address hidden>/msg04439.html

Tags: db mysql oslo
Ilya Pekelny (i159)
Changed in oslo:
assignee: nobody → Ilya Pekelny (i159)
summary: - The string longer than the declared on column in MySQL silently
+ The string greater than the declared on column in MySQL silently
truncated.
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
status: New → In Progress
Ilya Pekelny (i159)
Changed in oslo:
status: In Progress → Confirmed
Changed in oslo:
status: Confirmed → In Progress
Revision history for this message
Mark McLoughlin (markmc) wrote :

Would probably make sense to add this bug to all projects which suffer from it - even when the fix lands in Oslo, it still needs to be used in Nova, etc.

Changed in oslo:
importance: Undecided → High
Ilya Pekelny (i159)
Changed in heat:
status: New → In Progress
status: In Progress → New
Changed in heat:
status: New → Triaged
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/47820
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=e40903be454757cd46ac17fca171de7e6350328e
Submitter: Jenkins
Branch: master

commit e40903be454757cd46ac17fca171de7e6350328e
Author: Pekelny Ilya <email address hidden>
Date: Fri Sep 13 18:39:06 2013 +0300

    Database hook enabling traditional mode at MySQL

    The MySQL server can operate in different SQL modes, and can apply these
    modes differently for different clients, depending on the value of the
    sql_mode system variable. Traditional mode makes MySQL behave like a
    "traditional" SQL database system. A simple description of this mode is
    "give an error instead of a warning" when inserting an incorrect value
    into a column including the case when the input string is surpassing the
    maximum data length of the field.

    Closes-Bug: #1224898
    Change-Id: I2960435c81d21f5a65ea7fa4dc5c100880cf6aef

Changed in oslo:
status: In Progress → Fix Committed
Changed in oslo:
milestone: none → icehouse-2
Thierry Carrez (ttx)
Changed in oslo:
status: Fix Committed → Fix Released
Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

does it still affect heat? the code from oslo is already synced in.

Revision history for this message
Ilya Pekelny (i159) wrote :

@Pavlo, please check is heat synced with Oslo of version later than bug fix had been merged.

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

@Ilya, in the current heat master I already see the changes introduced in this patch [1], so yes, looks like the fix is applied

[1] https://github.com/openstack/heat/blob/master/heat/openstack/common/db/sqlalchemy/session.py#L672

Ilya Pekelny (i159)
Changed in heat:
status: Triaged → Fix Released
Revision history for this message
Ben Nemec (bnemec) wrote :

I don't believe this is fixed in Heat yet. The current version in Heat still defaults to not using traditional mode, and I don't see anywhere that it is enabled.

This will be fixed on the next oslo db sync because we changed the default to True.

Reference: https://github.com/openstack/heat/blob/master/heat/openstack/common/db/sqlalchemy/session.py#L696

Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-2 → 2014.1
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.