Reviewed: https://review.openstack.org/250807 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=51575f872218df16c4e43f242f1db3eab792a332 Submitter: Jenkins Branch: master
commit 51575f872218df16c4e43f242f1db3eab792a332 Author: Pavel Kholkin <[email protected]> Date: Fri Nov 27 16:19:46 2015 +0300 removed db_exc.DBDuplicateEntry in bw_usage_update BandwidthUsage model has no UniqueConstraints. In 'bw_usage_cache' table in nova db there is single primary autoincrement key. So the duplicate entry problem is solved by db itself and db_exc.DBDuplicateEntry could not be raised in Nova. Ideally we should add UniqueConstraint 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(). The current code that uses .first() is not correct because there is no order_by() applied on the SQL query and therefore the returned "first record" is indeterminate. This workaround fix removed misleading note and exception and added order_by() to ensure that the same record is updated every time. Co-Authored-By: Sergey Nikitin <[email protected]> Closes-bug: #1614561 Change-Id: I408bc3a3e5623965a619d8c7241e4e77c8bf44f5 ** Changed in: nova Status: In Progress => Fix Released -- 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): Fix Released 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 -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

