[ARVADOS] created: 2.1.0-1684-g69ff5df9c

Git user git at public.arvados.org
Mon Nov 29 21:16:27 UTC 2021


        at  69ff5df9ce5c4fc0a6a8cbf08e630f62bd16e746 (commit)


commit 69ff5df9ce5c4fc0a6a8cbf08e630f62bd16e746
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Mon Nov 29 16:15:23 2021 -0500

    18490: tweak incremental permission update
    
    Add a where clause to avoid updating identical rows.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/services/api/lib/update_permissions.rb b/services/api/lib/update_permissions.rb
index 23e60c8ed..0c46cd673 100644
--- a/services/api/lib/update_permissions.rb
+++ b/services/api/lib/update_permissions.rb
@@ -131,7 +131,9 @@ delete from #{PERMISSION_VIEW} where
     ActiveRecord::Base.connection.exec_query %{
 insert into #{PERMISSION_VIEW} (user_uuid, target_uuid, perm_level, traverse_owned)
   select user_uuid, target_uuid, val as perm_level, traverse_owned from #{temptable_perms} where val>0
-on conflict (user_uuid, target_uuid) do update set perm_level=EXCLUDED.perm_level, traverse_owned=EXCLUDED.traverse_owned;
+on conflict (user_uuid, target_uuid) do update
+set perm_level=EXCLUDED.perm_level, traverse_owned=EXCLUDED.traverse_owned
+where perm_level != EXCLUDED.perm_level or traverse_owned != EXCLUDED.traverse_owned;
 },
                                              "update_permissions.insert"
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list