20240: Change locking mode to EXCLUSIVE.
[arvados.git] / services / api / app / controllers / arvados / v1 / container_requests_controller.rb
index 86b4b648605922bc0fb9e5b31fbba7a1c4bd47a5..75f70b1a2d7a8637cccad16e353b3ee757743171 100644 (file)
@@ -32,7 +32,7 @@ class Arvados::V1::ContainerRequestsController < ApplicationController
   def create
     # Lock containers table to avoid deadlock in cascading priority update (see #20240)
     Container.transaction do
-      ActiveRecord::Base.connection.execute "LOCK TABLE containers IN SHARE ROW EXCLUSIVE MODE"
+      ActiveRecord::Base.connection.execute "LOCK TABLE containers IN EXCLUSIVE MODE"
       super
     end
   end
@@ -40,7 +40,7 @@ class Arvados::V1::ContainerRequestsController < ApplicationController
   def update
     # Lock containers table to avoid deadlock in cascading priority update (see #20240)
     Container.transaction do
-      ActiveRecord::Base.connection.execute "LOCK TABLE containers IN SHARE ROW EXCLUSIVE MODE"
+      ActiveRecord::Base.connection.execute "LOCK TABLE containers IN EXCLUSIVE MODE"
       super
     end
   end