Skip to content

Commit 086910c

Browse files
committed
Merge PR ceph#59088 into main
* refs/pull/59088/head: mds: add compile time checks for sortedness mds: sort conf keys Reviewed-by: Dhairya Parmar <[email protected]>
2 parents 305235f + 5c3dddf commit 086910c

File tree

1 file changed

+101
-89
lines changed

1 file changed

+101
-89
lines changed

src/mds/MDSRank.cc

Lines changed: 101 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*
1313
*/
1414

15+
#include <array>
1516
#include <string_view>
1617
#include <typeinfo>
1718
#include "common/debug.h"
@@ -4053,95 +4054,106 @@ epoch_t MDSRank::get_osd_epoch() const
40534054

40544055
const char** MDSRankDispatcher::get_tracked_conf_keys() const
40554056
{
4056-
static const char* KEYS[] = {
4057-
"clog_to_graylog",
4058-
"clog_to_graylog_host",
4059-
"clog_to_graylog_port",
4060-
"clog_to_monitors",
4061-
"clog_to_syslog",
4062-
"clog_to_syslog_facility",
4063-
"clog_to_syslog_level",
4064-
"fsid",
4065-
"host",
4066-
"mds_alternate_name_max",
4067-
"mds_bal_export_pin",
4068-
"mds_bal_fragment_dirs",
4069-
"mds_bal_fragment_fast_factor",
4070-
"mds_bal_fragment_interval",
4071-
"mds_bal_fragment_size_max",
4072-
"mds_bal_interval",
4073-
"mds_bal_max",
4074-
"mds_bal_max_until",
4075-
"mds_bal_merge_size",
4076-
"mds_bal_mode",
4077-
"mds_bal_replicate_threshold",
4078-
"mds_bal_sample_interval",
4079-
"mds_bal_split_bits",
4080-
"mds_bal_split_rd",
4081-
"mds_bal_split_size",
4082-
"mds_bal_split_wr",
4083-
"mds_bal_unreplicate_threshold",
4084-
"mds_cache_memory_limit",
4085-
"mds_cache_mid",
4086-
"mds_cache_reservation",
4087-
"mds_cache_quiesce_decay_rate",
4088-
"mds_cache_quiesce_threshold",
4089-
"mds_cache_quiesce_sleep",
4090-
"mds_cache_trim_decay_rate",
4091-
"mds_cap_acquisition_throttle_retry_request_time",
4092-
"mds_cap_revoke_eviction_timeout",
4093-
"mds_debug_subtrees",
4094-
"mds_dir_max_entries",
4095-
"mds_dump_cache_threshold_file",
4096-
"mds_server_dispatch_client_request_delay",
4097-
"mds_server_dispatch_killpoint_random",
4098-
"mds_dump_cache_threshold_formatter",
4099-
"mds_enable_op_tracker",
4100-
"mds_export_ephemeral_distributed",
4101-
"mds_export_ephemeral_random",
4102-
"mds_export_ephemeral_random_max",
4103-
"mds_extraordinary_events_dump_interval",
4104-
"mds_forward_all_requests_to_auth",
4105-
"mds_health_cache_threshold",
4106-
"mds_heartbeat_grace",
4107-
"mds_heartbeat_reset_grace",
4108-
"mds_inject_journal_corrupt_dentry_first",
4109-
"mds_inject_migrator_session_race",
4110-
"mds_inject_rename_corrupt_dentry_first",
4111-
"mds_kill_dirfrag_at",
4112-
"mds_kill_shutdown_at",
4113-
"mds_log_event_large_threshold",
4114-
"mds_log_events_per_segment",
4115-
"mds_log_major_segment_event_ratio",
4116-
"mds_log_max_events",
4117-
"mds_log_max_segments",
4118-
"mds_log_pause",
4119-
"mds_log_skip_corrupt_events",
4120-
"mds_log_skip_unbounded_events",
4121-
"mds_max_caps_per_client",
4122-
"mds_max_export_size",
4123-
"mds_max_purge_files",
4124-
"mds_max_purge_ops",
4125-
"mds_max_purge_ops_per_pg",
4126-
"mds_max_snaps_per_dir",
4127-
"mds_op_complaint_time",
4128-
"mds_op_history_duration",
4129-
"mds_op_history_size",
4130-
"mds_op_log_threshold",
4131-
"mds_recall_max_decay_rate",
4132-
"mds_recall_warning_decay_rate",
4133-
"mds_request_load_average_decay_rate",
4134-
"mds_session_cache_liveness_decay_rate",
4135-
"mds_session_cap_acquisition_decay_rate",
4136-
"mds_session_cap_acquisition_throttle",
4137-
"mds_session_max_caps_throttle_ratio",
4138-
"mds_symlink_recovery",
4139-
"mds_session_metadata_threshold",
4140-
"mds_log_trim_threshold",
4141-
"mds_log_trim_decay_rate",
4142-
NULL
4143-
};
4144-
return KEYS;
4057+
#define KEYS \
4058+
"clog_to_graylog", \
4059+
"clog_to_graylog_host", \
4060+
"clog_to_graylog_port", \
4061+
"clog_to_monitors", \
4062+
"clog_to_syslog", \
4063+
"clog_to_syslog_facility", \
4064+
"clog_to_syslog_level", \
4065+
"fsid", \
4066+
"host", \
4067+
"mds_alternate_name_max", \
4068+
"mds_bal_export_pin", \
4069+
"mds_bal_fragment_dirs", \
4070+
"mds_bal_fragment_fast_factor", \
4071+
"mds_bal_fragment_interval", \
4072+
"mds_bal_fragment_size_max", \
4073+
"mds_bal_interval", \
4074+
"mds_bal_max", \
4075+
"mds_bal_max_until", \
4076+
"mds_bal_merge_size", \
4077+
"mds_bal_mode", \
4078+
"mds_bal_replicate_threshold", \
4079+
"mds_bal_sample_interval", \
4080+
"mds_bal_split_bits", \
4081+
"mds_bal_split_rd", \
4082+
"mds_bal_split_size", \
4083+
"mds_bal_split_wr", \
4084+
"mds_bal_unreplicate_threshold", \
4085+
"mds_cache_memory_limit", \
4086+
"mds_cache_mid", \
4087+
"mds_cache_quiesce_decay_rate", \
4088+
"mds_cache_quiesce_sleep", \
4089+
"mds_cache_quiesce_threshold", \
4090+
"mds_cache_reservation", \
4091+
"mds_cache_trim_decay_rate", \
4092+
"mds_cap_acquisition_throttle_retry_request_time", \
4093+
"mds_cap_revoke_eviction_timeout", \
4094+
"mds_debug_subtrees", \
4095+
"mds_dir_max_entries", \
4096+
"mds_dump_cache_threshold_file", \
4097+
"mds_dump_cache_threshold_formatter", \
4098+
"mds_enable_op_tracker", \
4099+
"mds_export_ephemeral_distributed", \
4100+
"mds_export_ephemeral_random", \
4101+
"mds_export_ephemeral_random_max", \
4102+
"mds_extraordinary_events_dump_interval", \
4103+
"mds_forward_all_requests_to_auth", \
4104+
"mds_health_cache_threshold", \
4105+
"mds_heartbeat_grace", \
4106+
"mds_heartbeat_reset_grace", \
4107+
"mds_inject_journal_corrupt_dentry_first", \
4108+
"mds_inject_migrator_session_race", \
4109+
"mds_inject_rename_corrupt_dentry_first", \
4110+
"mds_kill_dirfrag_at", \
4111+
"mds_kill_shutdown_at", \
4112+
"mds_log_event_large_threshold", \
4113+
"mds_log_events_per_segment", \
4114+
"mds_log_major_segment_event_ratio", \
4115+
"mds_log_max_events", \
4116+
"mds_log_max_segments", \
4117+
"mds_log_pause", \
4118+
"mds_log_skip_corrupt_events", \
4119+
"mds_log_skip_unbounded_events", \
4120+
"mds_log_trim_decay_rate", \
4121+
"mds_log_trim_threshold", \
4122+
"mds_max_caps_per_client", \
4123+
"mds_max_export_size", \
4124+
"mds_max_purge_files", \
4125+
"mds_max_purge_ops", \
4126+
"mds_max_purge_ops_per_pg", \
4127+
"mds_max_snaps_per_dir", \
4128+
"mds_op_complaint_time", \
4129+
"mds_op_history_duration", \
4130+
"mds_op_history_size", \
4131+
"mds_op_log_threshold", \
4132+
"mds_recall_max_decay_rate", \
4133+
"mds_recall_warning_decay_rate", \
4134+
"mds_request_load_average_decay_rate", \
4135+
"mds_server_dispatch_client_request_delay", \
4136+
"mds_server_dispatch_killpoint_random", \
4137+
"mds_session_cache_liveness_decay_rate", \
4138+
"mds_session_cap_acquisition_decay_rate", \
4139+
"mds_session_cap_acquisition_throttle", \
4140+
"mds_session_max_caps_throttle_ratio", \
4141+
"mds_session_metadata_threshold", \
4142+
"mds_symlink_recovery"
4143+
4144+
constexpr bool is_sorted = [] () constexpr {
4145+
constexpr auto arr = std::to_array<std::string_view>({KEYS});
4146+
for (unsigned long i = 0; i < arr.size()-1; ++i) {
4147+
if (arr[i] > arr[i+1]) {
4148+
return false;
4149+
}
4150+
}
4151+
return true;
4152+
}();
4153+
static_assert(is_sorted, "keys are not sorted!");
4154+
4155+
static char const* keys[] = {KEYS, nullptr};
4156+
return keys;
41454157
}
41464158

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

0 commit comments

Comments
 (0)