[ARVADOS] updated: 22c8b6367a9cd79b17240b7dca1ac8f7d8e7ee77

git at public.curoverse.com git at public.curoverse.com
Wed Jun 3 16:38:08 EDT 2015


Summary of changes:
 services/api/app/controllers/application_controller.rb   |  9 +++++++--
 .../functional/arvados/v1/collections_controller_test.rb | 16 ++++++++++++----
 2 files changed, 19 insertions(+), 6 deletions(-)

       via  22c8b6367a9cd79b17240b7dca1ac8f7d8e7ee77 (commit)
       via  de8324b3fbbf3f67f0f61c162f5895e8dcd3142d (commit)
      from  69f592e029493afb8a0709811b5be1fefabafb4b (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 22c8b6367a9cd79b17240b7dca1ac8f7d8e7ee77
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Jun 3 16:37:39 2015 -0400

    6074: Never exceed the configured max_index_database_read (even by one
    record) unless necessary to return one row.
    
    Fix copy&paste error in test case.

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 3a3f6d3..1c8450b 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -309,8 +309,12 @@ class ApplicationController < ActionController::Base
       limit_query.find_each do |record|
         new_limit += 1
         read_total += record.read_length.to_i
-        break if ((read_total >= Rails.configuration.max_index_database_read) or
-                  (new_limit >= @limit))
+        if read_total >= Rails.configuration.max_index_database_read
+          new_limit -= 1 if new_limit > 1
+          break
+        elsif new_limit >= @limit
+          break
+        end
       end
       @limit = new_limit
       @objects = @objects.limit(@limit)
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index 3257e49..28de3f8 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -103,11 +103,19 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
     }.merge(params)
   end
 
+  test "index with manifest_text limited by max_index_database_read returns non-empty" do
+    request_capped_index() { |_| 1 }
+    assert_response :success
+    assert_equal(1, json_response["items"].size)
+    assert_equal(1, json_response["limit"])
+    assert_equal(201, json_response["items_available"])
+  end
+
   test "index with manifest_text limited by max_index_database_read" do
     request_capped_index() { |size| (size * 3) + 1 }
     assert_response :success
-    assert_equal(4, json_response["items"].size)
-    assert_equal(4, json_response["limit"])
+    assert_equal(3, json_response["items"].size)
+    assert_equal(3, json_response["limit"])
     assert_equal(201, json_response["items_available"])
   end
 
@@ -122,11 +130,11 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
   test "max_index_database_read does not interfere with order" do
     request_capped_index(order: "name DESC") { |size| (size * 15) + 1 }
     assert_response :success
-    assert_equal(16, json_response["items"].size)
+    assert_equal(15, json_response["items"].size)
     assert_empty(json_response["items"].reject do |coll|
                    coll["name"] !~ /^Collection_9/
                  end)
-    assert_equal(16, json_response["limit"])
+    assert_equal(15, json_response["limit"])
     assert_equal(201, json_response["items_available"])
   end
 

commit de8324b3fbbf3f67f0f61c162f5895e8dcd3142d
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Jun 3 16:28:01 2015 -0400

    6074: Clear any existing ActiveRecord select() before adding our own,
    otherwise we'll read all the big values when we're really just trying
    to predict the result size.

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index e6a02b1..3a3f6d3 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -301,6 +301,7 @@ class ApplicationController < ActionController::Base
     return if limit_columns.empty?
     model_class.transaction do
       limit_query = @objects.
+        except(:select).
         select("(%s) as read_length" %
                limit_columns.map { |s| "octet_length(#{s})" }.join(" + "))
       new_limit = 0

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list