[arvados] created: 2.6.0-80-gf4667c534
git repository hosting
git at public.arvados.org
Fri Apr 28 17:54:25 UTC 2023
at f4667c5346cff5c91c6e75476d624c974c4857f0 (commit)
commit f4667c5346cff5c91c6e75476d624c974c4857f0
Author: Tom Clegg <tom at curii.com>
Date: Fri Apr 28 13:53:57 2023 -0400
20447: Don't lock containers table for cost updates.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/services/api/app/controllers/arvados/v1/containers_controller.rb b/services/api/app/controllers/arvados/v1/containers_controller.rb
index b06d65a36..83f99bf92 100644
--- a/services/api/app/controllers/arvados/v1/containers_controller.rb
+++ b/services/api/app/controllers/arvados/v1/containers_controller.rb
@@ -29,10 +29,19 @@ class Arvados::V1::ContainersController < ApplicationController
end
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 EXCLUSIVE MODE"
+ if (resource_attrs.keys - [:cost, :gateway_address, :output_properties, :progress, :runtime_status]).empty?
+ # If no attributes are being updated besides these, there are no
+ # cascading changes to other rows/tables, so we should just use
+ # row locking.
+ @object.reload(lock: true)
super
+ else
+ # Lock containers table to avoid deadlock in cascading priority
+ # update (see #20240)
+ Container.transaction do
+ ActiveRecord::Base.connection.execute "LOCK TABLE containers IN EXCLUSIVE MODE"
+ super
+ end
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list