[ARVADOS] created: 2.1.0-1180-gabbafae32

Git user git at public.arvados.org
Wed Aug 11 18:38:27 UTC 2021


        at  abbafae32db8ac8c216ca34d37ae76e86d10de60 (commit)


commit abbafae32db8ac8c216ca34d37ae76e86d10de60
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed Aug 11 15:37:46 2021 -0300

    18005: Fixes the bug.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index d1d5ace0c..f54465bb6 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -148,7 +148,9 @@ class Collection < ArvadosModel
   end
 
   def strip_signatures_and_update_replication_confirmed
-    if self.manifest_text_changed?
+    # manifest_text_was could be nil when dealing with a freshly created snapshot,
+    # so we skip this case because there was no real manifest change. (Bug #18005)
+    if self.manifest_text_changed? and (not self.manifest_text_was.nil?)
       in_old_manifest = {}
       if not self.replication_confirmed.nil?
         self.class.each_manifest_locator(manifest_text_was) do |match|

commit 5861d894b9b6614437fadfa261b7db1d4920d729
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed Aug 11 15:31:11 2021 -0300

    18005: Exposes the bug by simulating a keep-balance run a making a new version.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index e6912217d..8b8edbc15 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -185,6 +185,23 @@ class CollectionTest < ActiveSupport::TestCase
       c.reload
       assert_equal 'foobar', c.name
       assert_equal 2, c.version
+      # Simulate a keep-balance run and trigger a new versionable update
+      # This tests bug #18005
+      assert_nil c.replication_confirmed
+      assert_nil c.replication_confirmed_at
+      # Updates without validations/callbacks
+      c.update_column('modified_at', fifteen_min_ago)
+      c.update_column('replication_confirmed_at', Time.now)
+      c.update_column('replication_confirmed', 2)
+      c.reload
+      assert_equal fifteen_min_ago.to_i, c.modified_at.to_i
+      assert_not_nil c.replication_confirmed_at
+      assert_not_nil c.replication_confirmed
+      # Make the versionable update
+      c.update_attributes!({'name' => 'foobarbaz'})
+      c.reload
+      assert_equal 'foobarbaz', c.name
+      assert_equal 3, c.version
     end
   end
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list