← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1298690] Re: sqlite regexp() function doesn't behave like mysql

 

Sorry, script misdetected " (tracked under bug 1298690)" from commit
40ae1eefe42f093631e2988814e60f45defdb3c3

** Changed in: nova/icehouse
    Milestone: 2014.1.1 => None

** Changed in: nova/icehouse
       Status: Fix Released => New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1298690

Title:
  sqlite regexp() function doesn't behave like mysql

Status in OpenStack Compute (Nova):
  Confirmed
Status in OpenStack Compute (nova) icehouse series:
  New

Bug description:
  In bug 1298494 I recently saw a case where the unit tests (using
  sqlite) behaved differently than devstack with mysql.

  The issue seems to be when we do

  filters = {'uuid': group.members, 'deleted_at': None}
  instances = instance_obj.InstanceList.get_by_filters(
                  context, filters=filters)

  
  Eventually down in db/sqlalchemy/api.py we end up calling

  query = query.filter(column_attr.op(db_regexp_op)(
                                   str(filters[filter_name])))

  where str(filters[filter_name]) is the string 'None'.

  When using mysql, a regexp comparison of the string 'None' against a
  NULL field fails to match.

  Since sqlite doesn't have its own regexp function we provide one in
  openstack/common/db/sqlalchemy/session.py.  In the buggy case we end
  up calling it as regexp('None', None), where the types are "unicode"
  and "NoneType".  However, we end up converting the second arg to text
  type before calling reg.search() on it, so it matches.

  This is a bug, we want the unit tests to behave like the real system.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1298690/+subscriptions


References