Uploaded image for project: 'LAVA'
  1. LAVA
  2. LAVA-83

Improve lava-master SQL atomicity

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed
    • Priority: Major
    • Resolution: Deferred
    • Fix Version/s: LAVA Community Project
    • Labels:
      None

      Description

      Database accesses done by the dispatcher-master are partially atomic as we are using:

      • transaction: the full block is executed. If an exception is raised, changes are rollbacked
      • select_for_update: lock a row that will be updated in the block.

      The select_for_update() is the right way to make calls atomic. However, PostgreSQL does not allow to use select_for_update() with JOIN.
      So for the moment, we are only locking the Job table and not the Device one.

      Doing two calls:
      1/ Job.objects.select_for_update(). ...
      then
      2/ Device.objects.select_for_update().get(jop_id=...)
      should be enough to make the calls fully atomic.

      But, if their is a path somewhere in lava that does the reverse we will have a deadlock.

      So this task is to:
      1/ make the dispatcher-master fully atomic (two select_for_update)
      2/ check that lava-server is always blocking in the same order (job then device).

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  remi.duraffort@linaro.org Remi Duraffort
                  Reporter:
                  david.zinman@linaro.org david.zinman@linaro.org
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 1 day
                    1d
                    Remaining:
                    Remaining Estimate - 1 day
                    1d
                    Logged:
                    Time Spent - Not Specified
                    Not Specified

                      Structure Helper Panel