Bug #8840

[API] Locking job doesn't lock record

Added by Peter Amstutz over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
03/30/2016
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
0.5

Description

API server Job.lock uses a "transaction" but this doesn't guarantee atomic read-update-write operations. Need to use "with_lock" instead.

http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html

with_lock "Wraps the passed block in a transaction, locking the object before yielding. You can pass the SQL locking clause as argument (see lock!)."

lock! "Obtain a row lock on this record. Reloads the record to obtain the requested lock. Pass an SQL locking clause to append the end of the SELECT statement or pass true for “FOR UPDATE” (the default, an exclusive row lock). Returns the locked record.

Implemented in branch 8840-lock-job-record.


Subtasks

Task #8856: Review 8840 branchResolvedBrett Smith

Associated revisions

Revision c020dd44
Added by Peter Amstutz over 5 years ago

Merge branch '8840-lock-job-record' closes #8840

History

#1 Updated by Peter Amstutz over 5 years ago

  • Description updated (diff)
  • Story points set to 0.5

#2 Updated by Brett Smith over 5 years ago

  • Assigned To set to Peter Amstutz
  • Target version set to 2016-04-13 sprint

#3 Updated by Peter Amstutz over 5 years ago

  • Description updated (diff)

#4 Updated by Peter Amstutz over 5 years ago

  • Description updated (diff)

#5 Updated by Brett Smith over 5 years ago

505b768 looks great, please merge. Thanks.

https://ci.curoverse.com/job/developer-test-job/98/console (failed in a FUSE test, but that looks like a teardown race condition or similar to me)

#6 Updated by Peter Amstutz over 5 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:c020dd4470a5f8cbcfe15e764553622828f69ab5.

Also available in: Atom PDF