Skip to content

Commit 4325a50

Browse files
committed
mds: replace obsolete get_tracked_conf_keys()
.. with get_tracked_keys(). As per the original code in this specific case: the vector of keys is expected to be sorted. Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
1 parent bb2ac32 commit 4325a50

File tree

2 files changed

+94
-103
lines changed

2 files changed

+94
-103
lines changed

src/mds/MDSRank.cc

Lines changed: 93 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -4026,112 +4026,103 @@ void MDSRank::command_cache_drop(uint64_t timeout, Formatter *f, Context *on_fin
40264026

40274027
epoch_t MDSRank::get_osd_epoch() const
40284028
{
4029-
return objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch));
4029+
return objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch));
40304030
}
40314031

4032-
const char** MDSRankDispatcher::get_tracked_conf_keys() const
4032+
std::vector<std::string> MDSRankDispatcher::get_tracked_keys()
4033+
const noexcept
40334034
{
4034-
#define KEYS \
4035-
"clog_to_graylog", \
4036-
"clog_to_graylog_host", \
4037-
"clog_to_graylog_port", \
4038-
"clog_to_monitors", \
4039-
"clog_to_syslog", \
4040-
"clog_to_syslog_facility", \
4041-
"clog_to_syslog_level", \
4042-
"fsid", \
4043-
"host", \
4044-
"mds_allow_async_dirops", \
4045-
"mds_alternate_name_max", \
4046-
"mds_bal_export_pin", \
4047-
"mds_bal_fragment_dirs", \
4048-
"mds_bal_fragment_fast_factor", \
4049-
"mds_bal_fragment_interval", \
4050-
"mds_bal_fragment_size_max", \
4051-
"mds_bal_interval", \
4052-
"mds_bal_max", \
4053-
"mds_bal_max_until", \
4054-
"mds_bal_merge_size", \
4055-
"mds_bal_mode", \
4056-
"mds_bal_replicate_threshold", \
4057-
"mds_bal_sample_interval", \
4058-
"mds_bal_split_bits", \
4059-
"mds_bal_split_rd", \
4060-
"mds_bal_split_size", \
4061-
"mds_bal_split_wr", \
4062-
"mds_bal_unreplicate_threshold", \
4063-
"mds_cache_memory_limit", \
4064-
"mds_cache_mid", \
4065-
"mds_cache_quiesce_decay_rate", \
4066-
"mds_cache_quiesce_sleep", \
4067-
"mds_cache_quiesce_threshold", \
4068-
"mds_cache_reservation", \
4069-
"mds_cache_trim_decay_rate", \
4070-
"mds_cap_acquisition_throttle_retry_request_time", \
4071-
"mds_cap_revoke_eviction_timeout", \
4072-
"mds_debug_subtrees", \
4073-
"mds_dir_max_entries", \
4074-
"mds_dump_cache_threshold_file", \
4075-
"mds_dump_cache_threshold_formatter", \
4076-
"mds_enable_op_tracker", \
4077-
"mds_export_ephemeral_distributed", \
4078-
"mds_export_ephemeral_random", \
4079-
"mds_export_ephemeral_random_max", \
4080-
"mds_extraordinary_events_dump_interval", \
4081-
"mds_forward_all_requests_to_auth", \
4082-
"mds_health_cache_threshold", \
4083-
"mds_heartbeat_grace", \
4084-
"mds_heartbeat_reset_grace", \
4085-
"mds_inject_journal_corrupt_dentry_first", \
4086-
"mds_inject_migrator_session_race", \
4087-
"mds_inject_rename_corrupt_dentry_first", \
4088-
"mds_kill_dirfrag_at", \
4089-
"mds_kill_shutdown_at", \
4090-
"mds_log_event_large_threshold", \
4091-
"mds_log_events_per_segment", \
4092-
"mds_log_major_segment_event_ratio", \
4093-
"mds_log_max_events", \
4094-
"mds_log_max_segments", \
4095-
"mds_log_pause", \
4096-
"mds_log_skip_corrupt_events", \
4097-
"mds_log_skip_unbounded_events", \
4098-
"mds_log_trim_decay_rate", \
4099-
"mds_log_trim_threshold", \
4100-
"mds_max_caps_per_client", \
4101-
"mds_max_export_size", \
4102-
"mds_max_purge_files", \
4103-
"mds_max_purge_ops", \
4104-
"mds_max_purge_ops_per_pg", \
4105-
"mds_max_snaps_per_dir", \
4106-
"mds_op_complaint_time", \
4107-
"mds_op_history_duration", \
4108-
"mds_op_history_size", \
4109-
"mds_op_log_threshold", \
4110-
"mds_recall_max_decay_rate", \
4111-
"mds_recall_warning_decay_rate", \
4112-
"mds_request_load_average_decay_rate", \
4113-
"mds_server_dispatch_client_request_delay", \
4114-
"mds_server_dispatch_killpoint_random", \
4115-
"mds_session_cache_liveness_decay_rate", \
4116-
"mds_session_cap_acquisition_decay_rate", \
4117-
"mds_session_cap_acquisition_throttle", \
4118-
"mds_session_max_caps_throttle_ratio", \
4119-
"mds_session_metadata_threshold", \
4035+
static constexpr auto as_sv = std::to_array<std::string_view>({
4036+
"clog_to_graylog",
4037+
"clog_to_graylog_host",
4038+
"clog_to_graylog_port",
4039+
"clog_to_monitors",
4040+
"clog_to_syslog",
4041+
"clog_to_syslog_facility",
4042+
"clog_to_syslog_level",
4043+
"fsid",
4044+
"host",
4045+
"mds_allow_async_dirops",
4046+
"mds_alternate_name_max",
4047+
"mds_bal_export_pin",
4048+
"mds_bal_fragment_dirs",
4049+
"mds_bal_fragment_fast_factor",
4050+
"mds_bal_fragment_interval",
4051+
"mds_bal_fragment_size_max",
4052+
"mds_bal_interval",
4053+
"mds_bal_max",
4054+
"mds_bal_max_until",
4055+
"mds_bal_merge_size",
4056+
"mds_bal_mode",
4057+
"mds_bal_replicate_threshold",
4058+
"mds_bal_sample_interval",
4059+
"mds_bal_split_bits",
4060+
"mds_bal_split_rd",
4061+
"mds_bal_split_size",
4062+
"mds_bal_split_wr",
4063+
"mds_bal_unreplicate_threshold",
4064+
"mds_cache_memory_limit",
4065+
"mds_cache_mid",
4066+
"mds_cache_quiesce_decay_rate",
4067+
"mds_cache_quiesce_sleep",
4068+
"mds_cache_quiesce_threshold",
4069+
"mds_cache_reservation",
4070+
"mds_cache_trim_decay_rate",
4071+
"mds_cap_acquisition_throttle_retry_request_time",
4072+
"mds_cap_revoke_eviction_timeout",
4073+
"mds_debug_subtrees",
4074+
"mds_dir_max_entries",
4075+
"mds_dump_cache_threshold_file",
4076+
"mds_dump_cache_threshold_formatter",
4077+
"mds_enable_op_tracker",
4078+
"mds_export_ephemeral_distributed",
4079+
"mds_export_ephemeral_random",
4080+
"mds_export_ephemeral_random_max",
4081+
"mds_extraordinary_events_dump_interval",
4082+
"mds_forward_all_requests_to_auth",
4083+
"mds_health_cache_threshold",
4084+
"mds_heartbeat_grace",
4085+
"mds_heartbeat_reset_grace",
4086+
"mds_inject_journal_corrupt_dentry_first",
4087+
"mds_inject_migrator_session_race",
4088+
"mds_inject_rename_corrupt_dentry_first",
4089+
"mds_kill_dirfrag_at",
4090+
"mds_kill_shutdown_at",
4091+
"mds_log_event_large_threshold",
4092+
"mds_log_events_per_segment",
4093+
"mds_log_major_segment_event_ratio",
4094+
"mds_log_max_events",
4095+
"mds_log_max_segments",
4096+
"mds_log_pause",
4097+
"mds_log_skip_corrupt_events",
4098+
"mds_log_skip_unbounded_events",
4099+
"mds_log_trim_decay_rate",
4100+
"mds_log_trim_threshold",
4101+
"mds_max_caps_per_client",
4102+
"mds_max_export_size",
4103+
"mds_max_purge_files",
4104+
"mds_max_purge_ops",
4105+
"mds_max_purge_ops_per_pg",
4106+
"mds_max_snaps_per_dir",
4107+
"mds_op_complaint_time",
4108+
"mds_op_history_duration",
4109+
"mds_op_history_size",
4110+
"mds_op_log_threshold",
4111+
"mds_recall_max_decay_rate",
4112+
"mds_recall_warning_decay_rate",
4113+
"mds_request_load_average_decay_rate",
4114+
"mds_server_dispatch_client_request_delay",
4115+
"mds_server_dispatch_killpoint_random",
4116+
"mds_session_cache_liveness_decay_rate",
4117+
"mds_session_cap_acquisition_decay_rate",
4118+
"mds_session_cap_acquisition_throttle",
4119+
"mds_session_max_caps_throttle_ratio",
4120+
"mds_session_metadata_threshold",
41204121
"mds_symlink_recovery"
4121-
4122-
constexpr bool is_sorted = [] () constexpr {
4123-
constexpr auto arr = std::to_array<std::string_view>({KEYS});
4124-
for (unsigned long i = 0; i < arr.size()-1; ++i) {
4125-
if (arr[i] > arr[i+1]) {
4126-
return false;
4127-
}
4128-
}
4129-
return true;
4130-
}();
4131-
static_assert(is_sorted, "keys are not sorted!");
4132-
4133-
static char const* keys[] = {KEYS, nullptr};
4134-
return keys;
4122+
});
4123+
static_assert(std::is_sorted(as_sv.begin(), as_sv.end()),
4124+
"keys are not sorted!");
4125+
return {as_sv.begin(), as_sv.end()};
41354126
}
41364127

41374128
void MDSRankDispatcher::handle_conf_change(const ConfigProxy& conf, const std::set<std::string>& changed)

src/mds/MDSRank.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ class MDSRankDispatcher : public MDSRank, public md_config_obs_t
736736
void handle_osd_map();
737737
void update_log_config();
738738

739-
const char** get_tracked_conf_keys() const override final;
739+
std::vector<std::string> get_tracked_keys() const noexcept final;
740740
void handle_conf_change(const ConfigProxy& conf, const std::set<std::string>& changed) override;
741741

742742
void dump_sessions(const SessionFilter &filter, Formatter *f, bool cap_dump=false) const;

0 commit comments

Comments
 (0)