[ARVADOS] updated: 6f1d38549672212d67fc40268fd10b9926f6d6ad

git at public.curoverse.com git at public.curoverse.com
Mon Feb 8 13:56:07 EST 2016


Summary of changes:
 services/api/test/functional/arvados/v1/query_test.rb | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

  discards  67a057010e3381ae66fc8fe78f1d5a368325fb9a (commit)
       via  6f1d38549672212d67fc40268fd10b9926f6d6ad (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (67a057010e3381ae66fc8fe78f1d5a368325fb9a)
            \
             N -- N -- N (6f1d38549672212d67fc40268fd10b9926f6d6ad)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 6f1d38549672212d67fc40268fd10b9926f6d6ad
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Feb 8 13:56:02 2016 -0500

    8289: Strip redundant orders, even when provided explicitly by client.

diff --git a/services/api/lib/load_param.rb b/services/api/lib/load_param.rb
index c6c8ddf..929d739 100644
--- a/services/api/lib/load_param.rb
+++ b/services/api/lib/load_param.rb
@@ -111,11 +111,26 @@ module LoadParam
     # (e.g., [] or ['owner_uuid desc']), fall back on the default
     # orders to ensure repeating the same request (possibly with
     # different limit/offset) will return records in the same order.
-    unless @orders.any? do |order|
-        otable, ocol = order.split(' ')[0].split('.')
-        otable == table_name and model_class.unique_columns.include?(ocol)
+    # Here we also truncate the given list of orders after the first
+    # unique column, and make sure we don't list the same column
+    # twice.
+    orders_given_and_default = @orders + model_class.default_orders
+    order_cols_used = {}
+    @orders = []
+    orders_given_and_default.each do |order|
+      otablecol = order.split(' ')[0]
+
+      next if order_cols_used[otablecol]
+      order_cols_used[otablecol] = true
+
+      @orders << order
+
+      otable, ocol = otablecol.split('.')
+      if otable == table_name and model_class.unique_columns.include?(ocol)
+        # we already have a full ordering; subsequent entries would be
+        # superfluous
+        break
       end
-      @orders += model_class.default_orders
     end
 
     case params[:select]
diff --git a/services/api/test/functional/arvados/v1/query_test.rb b/services/api/test/functional/arvados/v1/query_test.rb
index 56db54c..91fe077 100644
--- a/services/api/test/functional/arvados/v1/query_test.rb
+++ b/services/api/test/functional/arvados/v1/query_test.rb
@@ -23,4 +23,46 @@ class Arvados::V1::QueryTest < ActionController::TestCase
     assert_equal('logs.event_type asc, logs.modified_at desc, logs.uuid',
                  assigns(:objects).order_values.join(', '))
   end
+
+  test 'skip fallback orders already given by client' do
+    @controller = Arvados::V1::LogsController.new
+    authorize_with :active
+    get :index, {
+      order: ['modified_at asc'],
+      controller: 'logs',
+    }
+    assert_response :success
+    assert_equal('logs.modified_at asc, logs.uuid',
+                 assigns(:objects).order_values.join(', '))
+  end
+
+  test 'eliminate superfluous orders' do
+    @controller = Arvados::V1::LogsController.new
+    authorize_with :active
+    get :index, {
+      order: ['logs.modified_at asc',
+              'modified_at desc',
+              'event_type desc',
+              'logs.event_type asc'],
+      controller: 'logs',
+    }
+    assert_response :success
+    assert_equal('logs.modified_at asc, logs.event_type desc, logs.uuid',
+                 assigns(:objects).order_values.join(', '))
+  end
+
+  test 'eliminate orders after the first unique column' do
+    @controller = Arvados::V1::LogsController.new
+    authorize_with :active
+    get :index, {
+      order: ['event_type asc',
+              'id asc',
+              'uuid asc',
+              'modified_at desc'],
+      controller: 'logs',
+    }
+    assert_response :success
+    assert_equal('logs.event_type asc, logs.id asc',
+                 assigns(:objects).order_values.join(', '))
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list