[ARVADOS] updated: 2.1.0-1690-gb0654eb57

Git user git at public.arvados.org
Wed Dec 1 22:27:36 UTC 2021


Summary of changes:
 services/api/lib/update_permissions.rb | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

       via  b0654eb575e9b914999c34984f3f47b3918e9e5e (commit)
       via  d86b27a0d966287ef454492da6327d876fc116a9 (commit)
       via  26aa25c76d3ea4285e724fe874c76aa9da03b4c9 (commit)
      from  af2b71f33797d13896cef7a591ef28cfc09159c4 (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 b0654eb575e9b914999c34984f3f47b3918e9e5e
Merge: af2b71f33 d86b27a0d
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Dec 1 17:27:15 2021 -0500

    Merge branch '18490-redundant-updates' refs #18490
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>


commit d86b27a0d966287ef454492da6327d876fc116a9
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Dec 1 17:26:47 2021 -0500

    18490: Add comments.
    
    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 f782ac5cd..b7e547640 100644
--- a/services/api/lib/update_permissions.rb
+++ b/services/api/lib/update_permissions.rb
@@ -118,6 +118,10 @@ as select * from compute_permission_subgraph($1, $2, $3, $4)
 
     ActiveRecord::Base.connection.exec_query "SET LOCAL enable_mergejoin to true;"
 
+    # Now that we have recomputed a set of permissions, delete any
+    # rows from the materialized_permissions table where (target_uuid,
+    # user_uuid) is not present or has perm_level=0 in the recomputed
+    # set.
     ActiveRecord::Base.connection.exec_delete %{
 delete from #{PERMISSION_VIEW} where
   target_uuid in (select target_uuid from #{temptable_perms}) and
@@ -128,6 +132,9 @@ delete from #{PERMISSION_VIEW} where
 },
                                               "update_permissions.delete"
 
+    # Now insert-or-update permissions in the recomputed set.  The
+    # WHERE clause is important to avoid redundantly updating rows
+    # that haven't actually changed.
     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

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list