Race condition in db floating_ip_create and floating_ip_bulk_create

Bug #1145216 reported by Boris Pavlovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Boris Pavlovic

Bug Description

floating_ip rows should have a unique value in address column.

At this moment we are checking that it doesn't exists in DB and then if it doesn't then we save it in DB.

Select then Insert and this will cause race conditions.

We should add unique constraint on (address, deleted) columns and then just try to insert.

Tags: db
Changed in nova:
assignee: nobody → Boris Pavlovic (boris-42)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
aeva black (tenbrae)
Changed in nova:
milestone: none → havana-1
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/23466
Committed: http://github.com/openstack/nova/commit/6dc7dedaf08de70264a00824dfd35e8e03ffb610
Submitter: Jenkins
Branch: master

commit 6dc7dedaf08de70264a00824dfd35e8e03ffb610
Author: Boris Pavlovic <email address hidden>
Date: Tue Mar 5 00:58:14 2013 +0400

    Remove race condition (in FloatingIps)

    Soft delete all duplicate rows with the same address except one with
    the biggest value in `id` column.

    Create UC on columns (address, deleted)

    Fix floating_ip_create
      Replace Select then Insert -> Try to Insert.

    Fix floating_ip_bulk_create
      Replace get all and locally compare -> Try to Insert

    Fix floating_ip_update
      If we update floating_ip with existing address, raise
      rollback and raise FloatingIpExists

    Add missing test for floating_ip_update to duplicate

    Fixes bug 1145216

    blueprint db-enforce-unique-keys

    Change-Id: Idd0c8305ca348700235f757a29fc7998edca576b

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.2
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.