Skip to content

Commit

Permalink
feat(Ranger): Pull policies from the Ranger Service and update using …
Browse files Browse the repository at this point in the history
…resources policies (#1388)

#1054

This patch implements how to pull policies from the Ranger Service
and dump policies to remote storage.

- Pull policies in JSON format from Ranger service and parse
  policies from JSON formated string.
- Create the path to save policies in remote storage, and update
  using resources policies.
- Dump policies to remote storage.
- Sync policies to app envs.
- Update the cached global/database resources policies.
  • Loading branch information
WHBANG authored Mar 17, 2023
1 parent e4fee11 commit 034cb9d
Show file tree
Hide file tree
Showing 8 changed files with 509 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/common/replica_envs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class replica_envs
static const std::string MANUAL_COMPACT_PERIODIC_BOTTOMMOST_LEVEL_COMPACTION;
static const std::string BUSINESS_INFO;
static const std::string REPLICA_ACCESS_CONTROLLER_ALLOWED_USERS;
static const std::string REPLICA_ACCESS_CONTROLLER_RANGER_POLICIES;
static const std::string READ_QPS_THROTTLING;
static const std::string READ_SIZE_THROTTLING;
static const std::string BACKUP_REQUEST_QPS_THROTTLING;
Expand Down
1 change: 1 addition & 0 deletions src/common/replication.codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ MAKE_EVENT_CODE_RPC(RPC_CM_START_MANUAL_COMPACT, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_QUERY_MANUAL_COMPACT_STATUS, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_GET_MAX_REPLICA_COUNT, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_SET_MAX_REPLICA_COUNT, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE(LPC_USE_RANGER_ACCESS_CONTROL, TASK_PRIORITY_COMMON)
#undef CURRENT_THREAD_POOL

#define CURRENT_THREAD_POOL THREAD_POOL_META_STATE
Expand Down
2 changes: 2 additions & 0 deletions src/common/replication_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ const std::string replica_envs::ROCKSDB_BLOCK_CACHE_ENABLED("replica.rocksdb_blo
const std::string replica_envs::BUSINESS_INFO("business.info");
const std::string replica_envs::REPLICA_ACCESS_CONTROLLER_ALLOWED_USERS(
"replica_access_controller.allowed_users");
const std::string replica_envs::REPLICA_ACCESS_CONTROLLER_RANGER_POLICIES(
"replica_access_controller.ranger_policies");
const std::string replica_envs::READ_QPS_THROTTLING("replica.read_throttling");
const std::string replica_envs::READ_SIZE_THROTTLING("replica.read_throttling_by_size");
const std::string
Expand Down
3 changes: 2 additions & 1 deletion src/meta/app_env_validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ void app_env_validator::register_all_validators()
{replica_envs::MANUAL_COMPACT_PERIODIC_TRIGGER_TIME, nullptr},
{replica_envs::MANUAL_COMPACT_PERIODIC_TARGET_LEVEL, nullptr},
{replica_envs::MANUAL_COMPACT_PERIODIC_BOTTOMMOST_LEVEL_COMPACTION, nullptr},
{replica_envs::REPLICA_ACCESS_CONTROLLER_ALLOWED_USERS, nullptr}};
{replica_envs::REPLICA_ACCESS_CONTROLLER_ALLOWED_USERS, nullptr},
{replica_envs::REPLICA_ACCESS_CONTROLLER_RANGER_POLICIES, nullptr}};
}

} // namespace replication
Expand Down
Loading

0 comments on commit 034cb9d

Please sign in to comment.