[ARVADOS] created: 1.1.4-166-g2ee4ee2
Git user
git at public.curoverse.com
Thu Apr 26 16:01:27 EDT 2018
at 2ee4ee2bb666835c41019b475dd2e286604bdd35 (commit)
commit 2ee4ee2bb666835c41019b475dd2e286604bdd35
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Thu Apr 26 16:00:11 2018 -0400
13377: Ensure that collection fetched by PDH has longest available lifetime.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/app/controllers/arvados/v1/collections_controller.rb b/services/api/app/controllers/arvados/v1/collections_controller.rb
index fb75007..6e77c12 100644
--- a/services/api/app/controllers/arvados/v1/collections_controller.rb
+++ b/services/api/app/controllers/arvados/v1/collections_controller.rb
@@ -36,7 +36,19 @@ class Arvados::V1::CollectionsController < ApplicationController
def find_object_by_uuid
if loc = Keep::Locator.parse(params[:id])
loc.strip_hints!
- if c = Collection.readable_by(*@read_users).where({ portable_data_hash: loc.to_s }).limit(1).first
+
+ # It matters which Collection object we pick because we use it to get signed_manifest_text,
+ # the value of which is affected by the value of trash_at.
+ #
+ # From postgres doc: "By default, null values sort as if larger than any non-null
+ # value; that is, NULLS FIRST is the default for DESC order, and
+ # NULLS LAST otherwise."
+ #
+ # "trash_at desc" sorts null first, then latest to earliest, so
+ # it will select the Collection object with the longest
+ # available lifetime.
+
+ if c = Collection.readable_by(*@read_users).where({ portable_data_hash: loc.to_s }).order("trash_at desc").limit(1).first
@object = {
uuid: c.portable_data_hash,
portable_data_hash: c.portable_data_hash,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list