[ARVADOS] created: 2.1.0-1180-gc3481a620
Git user
git at public.arvados.org
Wed Aug 11 19:12:15 UTC 2021
at c3481a62091153eb0f74cd2f769d46c552765fcb (commit)
commit c3481a62091153eb0f74cd2f769d46c552765fcb
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..1bbe8cc66 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -150,7 +150,9 @@ class Collection < ArvadosModel
def strip_signatures_and_update_replication_confirmed
if self.manifest_text_changed?
in_old_manifest = {}
- if not self.replication_confirmed.nil?
+ # 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 (not self.replication_confirmed.nil?) and (not self.manifest_text_was.nil?)
self.class.each_manifest_locator(manifest_text_was) do |match|
in_old_manifest[match[1]] = true
end
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