[ARVADOS] updated: 1.3.0-2756-g36644eb53

Git user git at public.arvados.org
Mon Jul 20 18:49:03 UTC 2020


Summary of changes:
 services/api/app/models/arvados_model.rb                         | 1 +
 services/api/app/models/collection.rb                            | 3 +--
 services/api/lib/audit_logs.rb                                   | 7 ++++++-
 services/api/lib/sweep_trashed_objects.rb                        | 7 ++++++-
 services/api/lib/update_priority.rb                              | 9 +++++++--
 .../test/functional/arvados/v1/keep_services_controller_test.rb  | 3 +--
 6 files changed, 22 insertions(+), 8 deletions(-)

       via  36644eb5315cdc6579dbd11aa595e3c9fa14e278 (commit)
       via  005e3934713f6c2c53cd6d8f4ce33fef138ce12e (commit)
       via  e15dc4c80a73752137c275b93e77be8cdd9a8f22 (commit)
       via  16bce05426a518db7687250ad627c7d5e03ffde8 (commit)
      from  3a4549443764478128837d7b0996e4bcc91e85fd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 36644eb5315cdc6579dbd11aa595e3c9fa14e278
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Mon Jul 20 11:40:38 2020 -0300

    16470: Fixes reload() API to match the overridden function.
    
    reload()'s documentation states: "...in addition to the in-place modification
    the method returns self for convenience."
    
    https://api.rubyonrails.org/v5.1.7/classes/ActiveRecord/Persistence.html#method-i-reload
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 01a31adb9..80ea0c0b7 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -137,6 +137,7 @@ class ArvadosModel < ApplicationRecord
   def reload(*args)
     super
     log_start_state
+    self
   end
 
   def self.create raw_params={}, *args
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 996981dba..8f724e1f5 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -262,8 +262,7 @@ class Collection < ArvadosModel
     # Put aside the changes because with_lock requires an explicit record reload
     changes = self.changes
     snapshot = nil
-    reload
-    with_lock do
+    reload.with_lock do
       # Copy the original state to save it as old version
       if should_preserve_version
         snapshot = self.dup

commit 005e3934713f6c2c53cd6d8f4ce33fef138ce12e
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Mon Jul 20 11:36:06 2020 -0300

    16470: Avoids DB connection closing when running tests on missing places.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/lib/audit_logs.rb b/services/api/lib/audit_logs.rb
index 886c88738..2b5e3b8ab 100644
--- a/services/api/lib/audit_logs.rb
+++ b/services/api/lib/audit_logs.rb
@@ -62,7 +62,12 @@ module AuditLogs
       rescue => e
         Rails.logger.error "#{e.class}: #{e}\n#{e.backtrace.join("\n\t")}"
       ensure
-        ActiveRecord::Base.connection.close
+        # Rails 5.1+ makes test threads share a database connection, so we can't
+        # close a connection shared with other threads.
+        # https://github.com/rails/rails/commit/deba47799ff905f778e0c98a015789a1327d5087
+        if Rails.env != "test"
+          ActiveRecord::Base.connection.close
+        end
       end
     end
   end
diff --git a/services/api/lib/sweep_trashed_objects.rb b/services/api/lib/sweep_trashed_objects.rb
index 8613c749c..c09896567 100644
--- a/services/api/lib/sweep_trashed_objects.rb
+++ b/services/api/lib/sweep_trashed_objects.rb
@@ -69,7 +69,12 @@ module SweepTrashedObjects
         rescue => e
           Rails.logger.error "#{e.class}: #{e}\n#{e.backtrace.join("\n\t")}"
         ensure
-          ActiveRecord::Base.connection.close
+          # Rails 5.1+ makes test threads share a database connection, so we can't
+          # close a connection shared with other threads.
+          # https://github.com/rails/rails/commit/deba47799ff905f778e0c98a015789a1327d5087
+          if Rails.env != "test"
+            ActiveRecord::Base.connection.close
+          end
         end
       end
     end

commit e15dc4c80a73752137c275b93e77be8cdd9a8f22
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Mon Jul 20 11:35:00 2020 -0300

    16470: Fixes internal API usage.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/lib/update_priority.rb b/services/api/lib/update_priority.rb
index 3a65c71fe..6c17f1bd0 100644
--- a/services/api/lib/update_priority.rb
+++ b/services/api/lib/update_priority.rb
@@ -33,7 +33,7 @@ module UpdatePriority
       # priority==0 but should be >0:
       act_as_system_user do
         Container.
-          joins("JOIN container_requests ON container_requests.container_uuid=containers.uuid AND container_requests.state=#{Container.sanitize(ContainerRequest::Committed)} AND container_requests.priority>0").
+          joins("JOIN container_requests ON container_requests.container_uuid=containers.uuid AND container_requests.state=#{ActiveRecord::Base.connection.quote(ContainerRequest::Committed)} AND container_requests.priority>0").
           where('containers.state IN (?) AND containers.priority=0 AND container_requests.uuid IS NOT NULL',
                 [Container::Queued, Container::Locked, Container::Running]).
           map(&:update_priority!)

commit 16bce05426a518db7687250ad627c7d5e03ffde8
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Jul 15 11:14:09 2020 -0300

    16470: Fixes tests. Avoids closing a DB connection when using threads on tests.
    
    From Rails 5.1, test threads share a database connection, so UpdatePriority
    won't try to close DB connections when running from tests.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/lib/update_priority.rb b/services/api/lib/update_priority.rb
index c688ac008..3a65c71fe 100644
--- a/services/api/lib/update_priority.rb
+++ b/services/api/lib/update_priority.rb
@@ -55,7 +55,12 @@ module UpdatePriority
       rescue => e
         Rails.logger.error "#{e.class}: #{e}\n#{e.backtrace.join("\n\t")}"
       ensure
-        ActiveRecord::Base.connection.close
+        # Rails 5.1+ makes test threads share a database connection, so we can't
+        # close a connection shared with other threads.
+        # https://github.com/rails/rails/commit/deba47799ff905f778e0c98a015789a1327d5087
+        if Rails.env != "test"
+          ActiveRecord::Base.connection.close
+        end
       end
     end
   end
diff --git a/services/api/test/functional/arvados/v1/keep_services_controller_test.rb b/services/api/test/functional/arvados/v1/keep_services_controller_test.rb
index ce1d447f1..0fbc7625c 100644
--- a/services/api/test/functional/arvados/v1/keep_services_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/keep_services_controller_test.rb
@@ -50,8 +50,7 @@ class Arvados::V1::KeepServicesControllerTest < ActionController::TestCase
     refute_empty expect_rvz
     authorize_with :active
     get :index,
-      params: {:format => :json},
-      headers: auth(:active)
+      params: {:format => :json}
     assert_response :success
     json_response['items'].each do |svc|
       url = "#{svc['service_ssl_flag'] ? 'https' : 'http'}://#{svc['service_host']}:#{svc['service_port']}/"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list