← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1614561] [NEW] db.bw_usage_update can update multiple db records

 

Public bug reported:

The current code in db.bw_usage_update() function uses .first() and is
not correct because there is no order_by() applied on the SQL query and
therefore the returned "first record" is indeterminate. We should remove
misleading note about possible race and exception and added order_by()
to ensure that the same record is updated every time.

Ideally we should add UniqueConstraint for BandwidthUsage model to
prevent multiple bw usage records existing for the same date range and
UUID. That fix for this will mean we should be able to remove the
.first() call and instead use .one().

** Affects: nova
     Importance: Undecided
     Assignee: Pavel Kholkin (pkholkin)
         Status: In Progress

-- 
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/1614561

Title:
  db.bw_usage_update can update multiple db records

Status in OpenStack Compute (nova):
  In Progress

Bug description:
  The current code in db.bw_usage_update() function uses .first() and is
  not correct because there is no order_by() applied on the SQL query
  and therefore the returned "first record" is indeterminate. We should
  remove misleading note about possible race and exception and added
  order_by() to ensure that the same record is updated every time.

  Ideally we should add UniqueConstraint for BandwidthUsage model to
  prevent multiple bw usage records existing for the same date range and
  UUID. That fix for this will mean we should be able to remove the
  .first() call and instead use .one().

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


Follow ups