WHBANG commented on code in PR #1518:
URL: 
https://github.com/apache/incubator-pegasus/pull/1518#discussion_r1226898354


##########
src/runtime/ranger/ranger_resource_policy_manager.cpp:
##########
@@ -599,34 +586,50 @@ dsn::error_code 
ranger_resource_policy_manager::sync_policies_to_app_envs()
         req->__set_app_name(app.app_name);
         req->__set_keys(
             
{dsn::replication::replica_envs::REPLICA_ACCESS_CONTROLLER_RANGER_POLICIES});
-        bool is_policy_matched = false;
+        std::vector<matched_database_table_policy> 
matched_database_table_policies;
         for (const auto &policy : table_policies->second) {
             // If this table does not match any database, its Ranger policies 
will be cleaned up.
             if (policy.database_names.count(database_name) == 0 &&
                 policy.database_names.count("*") == 0) {
                 continue;
             }
+            // If this table does not match any database table, its Ranger 
policies will be cleaned
+            // up.
+            if (policy.table_names.count(table_name) == 0 && 
policy.table_names.count("*") == 0) {
+                continue;
+            }
+            // This table matches a policy.
+            matched_database_table_policy database_table_policy(
+                {database_name, table_name, policy.policies});
+            // This table matches the policy whose database is "*".
+            if (policy.database_names.count(database_name) == 0) {
+                database_table_policy.matched_database_name = "*";
+            }
+            // This table matches the policy whose database table is "*".
+            if (policy.table_names.count(table_name) == 0) {

Review Comment:
   As described above in database, at least one of `table_name` and * is in the 
`policy.table_names`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to