This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new a40c768f9 refactor(configs): Clearify more configs (#1955)
a40c768f9 is described below
commit a40c768f9e9e112f49c4accbe5aa48f2ceb9dd72
Author: Yingchun Lai <[email protected]>
AuthorDate: Mon Apr 8 23:00:41 2024 +0800
refactor(configs): Clearify more configs (#1955)
- Update some configuration descriptions
- Remove duplicate functions dsn_config_get_all_sections() and
dsn_config_get_all_keys()
- Refactor the code of loading configurations from section
"network.server.xxx",
"network.client.", "meta_server.apps" and "replication.app"
- Separate function load_meta_servers() to parse_server_list() and
load_servers_from_config()
- Remove the useless `name` key in `apps.xxx` sections from ini files
---
src/client_lib/pegasus_client_impl.cpp | 4 +-
src/common/replication_common.cpp | 38 ++--
src/common/replication_other_types.h | 16 +-
src/geo/test/geo_test.cpp | 6 +-
src/meta/duplication/duplication_info.cpp | 4 +-
src/meta/duplication/meta_duplication_service.cpp | 17 +-
src/meta/server_state.cpp | 43 +++--
src/redis_protocol/proxy/config.ini | 2 -
src/redis_protocol/proxy_lib/redis_parser.cpp | 4 +-
src/redis_protocol/proxy_ut/config.ini | 2 -
src/replica/disk_cleaner.cpp | 2 +-
src/replica/mutation.cpp | 9 +-
src/replica/replica_chkpt.cpp | 14 +-
src/replica/replica_init.cpp | 8 +-
src/replica/replica_stub.cpp | 28 +--
src/replica/storage/simple_kv/test/case-003.ini | 1 -
src/replica/storage/simple_kv/test/case-004.ini | 1 -
src/replica/storage/simple_kv/test/case-101.ini | 4 -
src/replica/storage/simple_kv/test/case-102.ini | 4 -
src/replica/storage/simple_kv/test/case-105.ini | 1 -
src/replica/storage/simple_kv/test/case-106.ini | 4 -
src/replica/storage/simple_kv/test/case-201.ini | 2 -
src/replica/storage/simple_kv/test/case-202-1.ini | 2 -
src/replica/storage/simple_kv/test/case-205.ini | 2 -
src/replica/storage/simple_kv/test/case-206.ini | 1 -
src/replica/storage/simple_kv/test/case-210.ini | 2 -
src/replica/storage/simple_kv/test/case-213.ini | 2 -
src/replica/storage/simple_kv/test/case-214.ini | 2 -
src/replica/storage/simple_kv/test/case-215.ini | 1 -
src/replica/storage/simple_kv/test/client.cpp | 5 +-
src/replica/test/replica_http_service_test.cpp | 2 +-
src/runtime/global_config.cpp | 201 ++++++++++++----------
src/runtime/global_config.h | 24 ++-
src/runtime/profiler.cpp | 47 +++--
src/runtime/rpc/network.cpp | 2 +-
src/runtime/service_api_c.cpp | 2 +-
src/runtime/task/task_spec.h | 14 +-
src/runtime/test/service_api_c.cpp | 6 +-
src/runtime/tracer.cpp | 2 +-
src/server/available_detector.cpp | 4 +-
src/server/config.ini | 4 -
src/server/config.min.ini | 3 -
src/server/info_collector.cpp | 4 +-
src/server/pegasus_server_impl_init.cpp | 3 +-
src/server/test/config.ini | 1 -
src/shell/main.cpp | 5 +-
src/test/function_test/config.ini | 1 -
src/test/function_test/security/config.ini | 1 -
src/test/function_test/utils/test_util.cpp | 4 +-
src/test/kill_test/config.ini | 1 -
src/test/kill_test/kill_testor.cpp | 5 +-
src/test/pressure_test/config-pressure.ini | 1 -
src/utils/config_api.cpp | 10 --
src/utils/config_api.h | 8 -
src/utils/simple_logger.cpp | 22 +--
55 files changed, 301 insertions(+), 307 deletions(-)
diff --git a/src/client_lib/pegasus_client_impl.cpp
b/src/client_lib/pegasus_client_impl.cpp
index 917c7b39c..c6dfeb44f 100644
--- a/src/client_lib/pegasus_client_impl.cpp
+++ b/src/client_lib/pegasus_client_impl.cpp
@@ -64,8 +64,8 @@ pegasus_client_impl::pegasus_client_impl(const char
*cluster_name, const char *a
: _cluster_name(cluster_name), _app_name(app_name)
{
std::vector<dsn::host_port> meta_servers;
- dsn::replication::replica_helper::load_meta_servers(
- meta_servers, dsn::PEGASUS_CLUSTER_SECTION_NAME.c_str(), cluster_name);
+ dsn::replication::replica_helper::load_servers_from_config(
+ dsn::PEGASUS_CLUSTER_SECTION_NAME, cluster_name, meta_servers);
CHECK_GT(meta_servers.size(), 0);
_meta_server.assign_group("meta-servers");
_meta_server.group_host_port()->add_list(meta_servers);
diff --git a/src/common/replication_common.cpp
b/src/common/replication_common.cpp
index e823772a4..e2fae570a 100644
--- a/src/common/replication_common.cpp
+++ b/src/common/replication_common.cpp
@@ -59,7 +59,7 @@ DSN_DEFINE_int32(replication,
DSN_DEFINE_int32(replication,
fd_check_interval_seconds,
2,
- "The interval seconds of failure detector to check healthness
of remote peers");
+ "The interval seconds of failure detector to check
healthiness of remote peers");
DSN_DEFINE_int32(replication,
fd_beacon_interval_seconds,
3,
@@ -107,6 +107,10 @@ DSN_DEFINE_string(replication,
cold_backup_root,
"",
"The prefix of cold backup data path on remote storage");
+DSN_DEFINE_string(meta_server,
+ server_list,
+ "",
+ "Comma-separated list of MetaServers in the Pegasus
cluster");
namespace dsn {
namespace replication {
@@ -148,8 +152,8 @@ void replication_options::initialize()
}
CHECK(!data_dirs.empty(), "no replica data dir found, maybe not set or
excluded by black list");
-
- CHECK(replica_helper::load_meta_servers(meta_servers), "invalid meta
server config");
+ CHECK(replica_helper::parse_server_list(FLAGS_server_list, meta_servers),
+ "invalid meta server config");
}
int32_t replication_options::app_mutation_2pc_min_replica_count(int32_t
app_max_replica_count) const
@@ -186,28 +190,34 @@ int32_t
replication_options::app_mutation_2pc_min_replica_count(int32_t app_max_
}
}
-bool replica_helper::load_meta_servers(/*out*/ std::vector<dsn::host_port>
&servers,
- const char *section,
- const char *key)
+bool replica_helper::load_servers_from_config(const std::string §ion,
+ const std::string &key,
+ /*out*/
std::vector<dsn::host_port> &servers)
+{
+ const auto *server_list = dsn_config_get_value_string(section.c_str(),
key.c_str(), "", "");
+ return dsn::replication::replica_helper::parse_server_list(server_list,
servers);
+}
+
+bool replica_helper::parse_server_list(const char *server_list,
+ /*out*/ std::vector<dsn::host_port>
&servers)
{
servers.clear();
- std::string server_list = dsn_config_get_value_string(section, key, "",
"");
- std::vector<std::string> host_ports;
- ::dsn::utils::split_args(server_list.c_str(), host_ports, ',');
- for (const auto &host_port : host_ports) {
- auto hp = dsn::host_port::from_string(host_port);
+ std::vector<std::string> host_port_strs;
+ ::dsn::utils::split_args(server_list, host_port_strs, ',');
+ for (const auto &host_port_str : host_port_strs) {
+ const auto hp = dsn::host_port::from_string(host_port_str);
if (!hp) {
- LOG_ERROR("invalid host_port '{}' specified in config [{}]{}",
host_port, section, key);
+ LOG_ERROR("invalid host_port '{}' specified in '{}'",
host_port_str, server_list);
return false;
}
servers.push_back(hp);
}
if (servers.empty()) {
- LOG_ERROR("no meta server specified in config [{}].{}", section, key);
+ LOG_ERROR("no meta server specified");
return false;
}
- if (servers.size() != host_ports.size()) {
+ if (servers.size() != host_port_strs.size()) {
LOG_ERROR("server_list {} have duplicate server", server_list);
return false;
}
diff --git a/src/common/replication_other_types.h
b/src/common/replication_other_types.h
index ee441711f..fe0ed7212 100644
--- a/src/common/replication_other_types.h
+++ b/src/common/replication_other_types.h
@@ -97,10 +97,18 @@ public:
static bool get_replica_config(const partition_configuration
&partition_config,
::dsn::host_port node,
/*out*/ replica_configuration
&replica_config);
- // true if meta_list's value of config is valid, otherwise return false
- static bool load_meta_servers(/*out*/ std::vector<dsn::host_port> &servers,
- const char *section = "meta_server",
- const char *key = "server_list");
+
+ // Return true if 'server_list' is a valid comma-separated list of
servers, otherwise return
+ // false. The result is filled into 'servers' if success.
+ static bool parse_server_list(const char *server_list,
+ /*out*/ std::vector<dsn::host_port>
&servers);
+
+ // Return true if load server list from config value located in 'section'
and 'key', the value
+ // should be a valid comma-separated list of servers, otherwise return
false. The result is
+ // filled into 'servers' if success.
+ static bool load_servers_from_config(const std::string §ion,
+ const std::string &key,
+ /*out*/ std::vector<dsn::host_port>
&servers);
};
}
} // namespace
diff --git a/src/geo/test/geo_test.cpp b/src/geo/test/geo_test.cpp
index a553122e4..e66a251d0 100644
--- a/src/geo/test/geo_test.cpp
+++ b/src/geo/test/geo_test.cpp
@@ -62,9 +62,9 @@ public:
geo_client_test()
{
std::vector<dsn::host_port> meta_list;
- bool ok = dsn::replication::replica_helper::load_meta_servers(
- meta_list, dsn::PEGASUS_CLUSTER_SECTION_NAME.c_str(), "onebox");
- CHECK(ok, "load_meta_servers failed");
+ CHECK(dsn::replication::replica_helper::load_servers_from_config(
+ dsn::PEGASUS_CLUSTER_SECTION_NAME, "onebox", meta_list),
+ "load_servers_from_config failed");
auto ddl_client = new
dsn::replication::replication_ddl_client(meta_list);
dsn::error_code error = ddl_client->create_app("temp_geo", "pegasus",
4, 3, {}, false);
CHECK_EQ(dsn::ERR_OK, error);
diff --git a/src/meta/duplication/duplication_info.cpp
b/src/meta/duplication/duplication_info.cpp
index 3f080959f..85a4413d1 100644
--- a/src/meta/duplication/duplication_info.cpp
+++ b/src/meta/duplication/duplication_info.cpp
@@ -221,8 +221,8 @@ duplication_info_s_ptr
duplication_info::decode_from_blob(dupid_t dup_id,
}
std::vector<host_port> meta_list;
- if (!dsn::replication::replica_helper::load_meta_servers(
- meta_list, duplication_constants::kClustersSectionName.c_str(),
info.remote.c_str())) {
+ if (!dsn::replication::replica_helper::load_servers_from_config(
+ duplication_constants::kClustersSectionName, info.remote,
meta_list)) {
return nullptr;
}
diff --git a/src/meta/duplication/meta_duplication_service.cpp
b/src/meta/duplication/meta_duplication_service.cpp
index 8feaa52db..ef75c20f7 100644
--- a/src/meta/duplication/meta_duplication_service.cpp
+++ b/src/meta/duplication/meta_duplication_service.cpp
@@ -214,15 +214,14 @@ void
meta_duplication_service::add_duplication(duplication_add_rpc rpc)
remote_cluster_id.get_error());
std::vector<host_port> meta_list;
-
LOG_WARNING_DUP_HINT_AND_RETURN_IF_NOT(dsn::replication::replica_helper::load_meta_servers(
- meta_list,
-
duplication_constants::kClustersSectionName.c_str(),
-
request.remote_cluster_name.c_str()),
- response,
- ERR_INVALID_PARAMETERS,
- "failed to find cluster[{}] address
in config [{}]",
- request.remote_cluster_name,
-
duplication_constants::kClustersSectionName);
+ LOG_WARNING_DUP_HINT_AND_RETURN_IF_NOT(
+ dsn::replication::replica_helper::load_servers_from_config(
+ duplication_constants::kClustersSectionName,
request.remote_cluster_name, meta_list),
+ response,
+ ERR_INVALID_PARAMETERS,
+ "failed to find cluster[{}] address in config [{}]",
+ request.remote_cluster_name,
+ duplication_constants::kClustersSectionName);
std::shared_ptr<app_state> app;
duplication_info_s_ptr dup;
diff --git a/src/meta/server_state.cpp b/src/meta/server_state.cpp
index 0a5e4ccf6..c9fec739e 100644
--- a/src/meta/server_state.cpp
+++ b/src/meta/server_state.cpp
@@ -410,52 +410,59 @@ error_code server_state::restore_from_local_storage(const
char *local_path)
error_code server_state::initialize_default_apps()
{
- std::vector<const char *> sections;
+ std::vector<std::string> sections;
dsn_config_get_all_sections(sections);
LOG_INFO("start to do initialize");
app_info default_app;
- for (int i = 0; i < sections.size(); i++) {
- // TODO(yingchun): dose it mean sections[i] equals to
"meta_server.apps" or
- // "replication.app" ?
- if (strstr(sections[i], "meta_server.apps") == sections[i] ||
- utils::equals(sections[i], "replication.app")) {
- const char *s = sections[i];
-
+ for (const auto §ion : sections) {
+ // Match a section prefixed by "meta_server.apps" or equal to
"replication.app"
+ // TODO(yingchun): Move "replication.app" out of the loop, and define
it as flags, then we
+ // can get it by HTTP.
+ if (section.find("meta_server.apps") == 0 || section ==
"replication.app") {
default_app.status = app_status::AS_CREATING;
default_app.app_id = _all_apps.size() + 1;
// TODO(yingchun): the old configuration launch methods should be
kept to launch repeat
// configs.
- default_app.app_name = dsn_config_get_value_string(s, "app_name",
"", "Table name");
+ default_app.app_name =
+ dsn_config_get_value_string(section.c_str(), "app_name", "",
"Table name");
if (default_app.app_name.length() == 0) {
- LOG_WARNING("'[{}] app_name' not specified, ignore this
section", s);
+ LOG_WARNING("'[{}] app_name' not specified, ignore this
section", section);
continue;
}
default_app.app_type = dsn_config_get_value_string(
- s,
+ section.c_str(),
"app_type",
"",
"The storage engine type, 'pegasus' represents the storage
engine based on "
"Rocksdb. Currently, only 'pegasus' is available");
default_app.partition_count =
- (int)dsn_config_get_value_uint64(s, "partition_count", 1,
"Partition count");
+ (int)dsn_config_get_value_uint64(section.c_str(),
+ "partition_count",
+ 1,
+ "Partition count, i.e., the
shards of the table");
// TODO(yingchun): always true, remove it.
default_app.is_stateful = dsn_config_get_value_bool(
- s,
+ section.c_str(),
"stateful",
true,
"Whether this is a stateful table, it must be true if
'app_type = pegasus'");
- default_app.max_replica_count = (int)dsn_config_get_value_uint64(
- s, "max_replica_count", 3, "The maximum replica count of each
partition");
+ default_app.max_replica_count =
+ (int)dsn_config_get_value_uint64(section.c_str(),
+ "max_replica_count",
+ 3,
+ "The maximum replica count of
each partition");
default_app.create_second = dsn_now_ms() / 1000;
- std::string envs_str = dsn_config_get_value_string(s, "envs", "",
"app envs");
+ std::string envs_str = dsn_config_get_value_string(
+ section.c_str(), "envs", "", "Table environment variables");
bool parse = dsn::utils::parse_kv_map(envs_str.c_str(),
default_app.envs, ',', '=');
- CHECK_GT_MSG(default_app.app_type.length(), 0, "'[{}] app_type'
not specified", s);
+ CHECK_GT_MSG(
+ default_app.app_type.length(), 0, "'[{}] app_type' not
specified", section);
CHECK_GT(default_app.partition_count, 0);
- CHECK(parse, "'[{}] envs' is invalid, envs = {}", s, envs_str);
+ CHECK(parse, "'[{}] envs' is invalid, envs = {}", section,
envs_str);
std::shared_ptr<app_state> app = app_state::create(default_app);
_all_apps.emplace(app->app_id, app);
diff --git a/src/redis_protocol/proxy/config.ini
b/src/redis_protocol/proxy/config.ini
index d5920703a..89c142010 100644
--- a/src/redis_protocol/proxy/config.ini
+++ b/src/redis_protocol/proxy/config.ini
@@ -22,7 +22,6 @@ count = 1
;network.server.0.RPC_CHANNEL_TCP = NET_HDR_DSN,
dsn::tools::sim_network_provider, 65536
[apps.proxy]
-name = proxy
type = proxy
arguments = onebox temp
ports = 6379
@@ -30,7 +29,6 @@ pools = THREAD_POOL_DEFAULT
run = true
[apps.mimic]
-name = mimic
type = dsn.app.mimic
arguments =
pools = THREAD_POOL_DEFAULT
diff --git a/src/redis_protocol/proxy_lib/redis_parser.cpp
b/src/redis_protocol/proxy_lib/redis_parser.cpp
index 143f49394..794d482e9 100644
--- a/src/redis_protocol/proxy_lib/redis_parser.cpp
+++ b/src/redis_protocol/proxy_lib/redis_parser.cpp
@@ -97,8 +97,8 @@ redis_parser::redis_parser(proxy_stub *op, dsn::message_ex
*first_msg)
::dsn::apps::rrdb_client *r;
if (op) {
std::vector<dsn::host_port> meta_list;
- dsn::replication::replica_helper::load_meta_servers(
- meta_list, dsn::PEGASUS_CLUSTER_SECTION_NAME.c_str(),
op->get_cluster());
+ dsn::replication::replica_helper::load_servers_from_config(
+ dsn::PEGASUS_CLUSTER_SECTION_NAME, op->get_cluster(), meta_list);
r = new ::dsn::apps::rrdb_client(op->get_cluster(), meta_list,
op->get_app());
if (!dsn::utils::is_empty(op->get_geo_app())) {
_geo_client = std::make_unique<geo::geo_client>(
diff --git a/src/redis_protocol/proxy_ut/config.ini
b/src/redis_protocol/proxy_ut/config.ini
index c8a9b2c34..bf525ea95 100644
--- a/src/redis_protocol/proxy_ut/config.ini
+++ b/src/redis_protocol/proxy_ut/config.ini
@@ -22,7 +22,6 @@ count = 1
;network.server.0.RPC_CHANNEL_TCP = NET_HDR_DSN,
dsn::tools::sim_network_provider, 65536
[apps.proxy]
-name = proxy
type = proxy
arguments = onebox temp
ports = 12345
@@ -30,7 +29,6 @@ pools = THREAD_POOL_DEFAULT
run = true
[apps.mimic]
-name = mimic
type = dsn.app.mimic
arguments =
pools = THREAD_POOL_DEFAULT
diff --git a/src/replica/disk_cleaner.cpp b/src/replica/disk_cleaner.cpp
index d7bbc290c..805da2391 100644
--- a/src/replica/disk_cleaner.cpp
+++ b/src/replica/disk_cleaner.cpp
@@ -40,7 +40,7 @@
DSN_DEFINE_uint64(replication,
gc_disk_error_replica_interval_seconds,
- 7 * 24 * 3600 /*7day*/,
+ 7 * 24 * 3600,
"The interval in seconds to GC error replicas, which are in
directories "
"suffixed with '.err'");
DSN_TAG_VARIABLE(gc_disk_error_replica_interval_seconds, FT_MUTABLE);
diff --git a/src/replica/mutation.cpp b/src/replica/mutation.cpp
index 2f097e420..f6b3c7e89 100644
--- a/src/replica/mutation.cpp
+++ b/src/replica/mutation.cpp
@@ -45,10 +45,11 @@
#include "utils/latency_tracer.h"
#include "utils/ports.h"
-DSN_DEFINE_uint64(replication,
- abnormal_write_trace_latency_threshold,
- 1000 * 1000 * 1000, // 1s
- "latency trace will be logged when exceed the write latency
threshold");
+DSN_DEFINE_uint64(
+ replication,
+ abnormal_write_trace_latency_threshold,
+ 1000 * 1000 * 1000, // 1s
+ "Latency trace will be logged when exceed the write latency threshold, in
nanoseconds");
DSN_TAG_VARIABLE(abnormal_write_trace_latency_threshold, FT_MUTABLE);
namespace dsn {
diff --git a/src/replica/replica_chkpt.cpp b/src/replica/replica_chkpt.cpp
index 2418fd8bb..fc2b3a4dc 100644
--- a/src/replica/replica_chkpt.cpp
+++ b/src/replica/replica_chkpt.cpp
@@ -74,13 +74,13 @@ DSN_DEFINE_int32(replication,
"The maximum size of useless private log to be reserved.
NOTE: only when "
"'log_private_reserve_max_size_mb' and
'log_private_reserve_max_time_seconds' are "
"both satisfied, the useless logs can be reserved");
-DSN_DEFINE_int32(replication,
- log_private_reserve_max_time_seconds,
- 36000,
- "The maximum time in seconds of useless private log to be
reserved. NOTE: only "
- "when 'log_private_reserve_max_size_mb' and "
- "'log_private_reserve_max_time_seconds' are both satisfied,
the useless logs can "
- "be reserved");
+DSN_DEFINE_int32(
+ replication,
+ log_private_reserve_max_time_seconds,
+ 36000,
+ "The maximum time in seconds of useless private log to be reserved. NOTE:
only "
+ "when 'log_private_reserve_max_size_mb' and
'log_private_reserve_max_time_seconds' "
+ "are both satisfied, the useless logs can be reserved");
namespace dsn {
namespace replication {
diff --git a/src/replica/replica_init.cpp b/src/replica/replica_init.cpp
index 8779802ff..1cee376e6 100644
--- a/src/replica/replica_init.cpp
+++ b/src/replica/replica_init.cpp
@@ -55,13 +55,15 @@
DSN_DEFINE_bool(replication,
checkpoint_disabled,
false,
- "Whether to disable to generate replica checkpoints
periodically");
+ "Whether to disable to generate replica checkpoints
periodically. The "
+ "checkpoints are meaningful for data integrity but consuming
some disk "
+ "space");
DSN_DEFINE_int32(replication,
checkpoint_interval_seconds,
100,
- "The interval in seconds to generate replica checkpoints.
Note that "
- "the checkpoint may not be generated when attempt");
+ "The interval in seconds to attempt to generate replica
checkpoints. "
+ "Note that the checkpoint may not be generated when attempt");
DSN_DEFINE_int32(replication,
log_private_file_size_mb,
diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp
index 25cd5d8b6..7c05198c5 100644
--- a/src/replica/replica_stub.cpp
+++ b/src/replica/replica_stub.cpp
@@ -241,7 +241,10 @@ DSN_DECLARE_string(server_key);
DSN_DEFINE_bool(replication,
deny_client_on_start,
false,
- "Whether to deny client read and write requests when starting
the server");
+ "Whether to deny client read and write "
+ "requests. The 'on_start' in the name is "
+ "meaningless, this config takes effect "
+ "all the time");
DSN_DEFINE_bool(replication,
verbose_client_log_on_start,
false,
@@ -257,11 +260,12 @@ DSN_DEFINE_bool(
false,
"Whether to disable replica statistics. The name contains 'gc' is for
legacy reason");
DSN_DEFINE_bool(replication, disk_stat_disabled, false, "whether to disable
disk stat");
-DSN_DEFINE_bool(replication,
- delay_for_fd_timeout_on_start,
- false,
- "whether to delay for beacon grace period to make failure
detector timeout when "
- "starting the server");
+DSN_DEFINE_bool(
+ replication,
+ delay_for_fd_timeout_on_start,
+ false,
+ "Whether to delay for a period of time to make failure detector timeout
when "
+ "starting the server. The delayed time is depends on
[replication]fd_grace_seconds");
DSN_DEFINE_bool(replication,
config_sync_disabled,
false,
@@ -278,11 +282,13 @@ DSN_DEFINE_uint32(replication,
"max concurrent manual emergency checkpoint running count");
DSN_TAG_VARIABLE(max_concurrent_manual_emergency_checkpointing_count,
FT_MUTABLE);
-DSN_DEFINE_uint32(
- replication,
- config_sync_interval_ms,
- 30000,
- "The interval milliseconds of replica server to syncs replica
configuration with meta server");
+DSN_DEFINE_uint32(replication,
+ config_sync_interval_ms,
+ 30000,
+ "The interval milliseconds of "
+ "replica server to send replica "
+ "config-sync requests to meta "
+ "server");
DSN_TAG_VARIABLE(config_sync_interval_ms, FT_MUTABLE);
DSN_DEFINE_validator(config_sync_interval_ms, [](uint32_t value) -> bool {
return value > 0; });
diff --git a/src/replica/storage/simple_kv/test/case-003.ini
b/src/replica/storage/simple_kv/test/case-003.ini
index b0654769d..86e91c534 100644
--- a/src/replica/storage/simple_kv/test/case-003.ini
+++ b/src/replica/storage/simple_kv/test/case-003.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
diff --git a/src/replica/storage/simple_kv/test/case-004.ini
b/src/replica/storage/simple_kv/test/case-004.ini
index 2a8a7f539..e523a8d64 100644
--- a/src/replica/storage/simple_kv/test/case-004.ini
+++ b/src/replica/storage/simple_kv/test/case-004.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
diff --git a/src/replica/storage/simple_kv/test/case-101.ini
b/src/replica/storage/simple_kv/test/case-101.ini
index fb366b244..2c840a892 100644
--- a/src/replica/storage/simple_kv/test/case-101.ini
+++ b/src/replica/storage/simple_kv/test/case-101.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,10 +54,7 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
-
-
tool = simulator
;tool = nativerun
toollets = test_injector
diff --git a/src/replica/storage/simple_kv/test/case-102.ini
b/src/replica/storage/simple_kv/test/case-102.ini
index b1a48eec2..99392e805 100644
--- a/src/replica/storage/simple_kv/test/case-102.ini
+++ b/src/replica/storage/simple_kv/test/case-102.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,10 +54,7 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
-
-
tool = simulator
;tool = nativerun
toollets = test_injector
diff --git a/src/replica/storage/simple_kv/test/case-105.ini
b/src/replica/storage/simple_kv/test/case-105.ini
index fb366b244..3019495bc 100644
--- a/src/replica/storage/simple_kv/test/case-105.ini
+++ b/src/replica/storage/simple_kv/test/case-105.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
diff --git a/src/replica/storage/simple_kv/test/case-106.ini
b/src/replica/storage/simple_kv/test/case-106.ini
index fb366b244..2c840a892 100644
--- a/src/replica/storage/simple_kv/test/case-106.ini
+++ b/src/replica/storage/simple_kv/test/case-106.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,10 +54,7 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
-
-
tool = simulator
;tool = nativerun
toollets = test_injector
diff --git a/src/replica/storage/simple_kv/test/case-201.ini
b/src/replica/storage/simple_kv/test/case-201.ini
index fb366b244..b6801a064 100644
--- a/src/replica/storage/simple_kv/test/case-201.ini
+++ b/src/replica/storage/simple_kv/test/case-201.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,7 +54,6 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
diff --git a/src/replica/storage/simple_kv/test/case-202-1.ini
b/src/replica/storage/simple_kv/test/case-202-1.ini
index a0fa07b3f..e523a8d64 100644
--- a/src/replica/storage/simple_kv/test/case-202-1.ini
+++ b/src/replica/storage/simple_kv/test/case-202-1.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,7 +54,6 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
diff --git a/src/replica/storage/simple_kv/test/case-205.ini
b/src/replica/storage/simple_kv/test/case-205.ini
index 7ddbb8db2..602794b67 100644
--- a/src/replica/storage/simple_kv/test/case-205.ini
+++ b/src/replica/storage/simple_kv/test/case-205.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,7 +54,6 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
diff --git a/src/replica/storage/simple_kv/test/case-206.ini
b/src/replica/storage/simple_kv/test/case-206.ini
index 7ddbb8db2..28d2c4aaf 100644
--- a/src/replica/storage/simple_kv/test/case-206.ini
+++ b/src/replica/storage/simple_kv/test/case-206.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
diff --git a/src/replica/storage/simple_kv/test/case-210.ini
b/src/replica/storage/simple_kv/test/case-210.ini
index d07b7fcb8..2652fed83 100644
--- a/src/replica/storage/simple_kv/test/case-210.ini
+++ b/src/replica/storage/simple_kv/test/case-210.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,7 +54,6 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
diff --git a/src/replica/storage/simple_kv/test/case-213.ini
b/src/replica/storage/simple_kv/test/case-213.ini
index 349ce6771..3098910b7 100644
--- a/src/replica/storage/simple_kv/test/case-213.ini
+++ b/src/replica/storage/simple_kv/test/case-213.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,7 +54,6 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
diff --git a/src/replica/storage/simple_kv/test/case-214.ini
b/src/replica/storage/simple_kv/test/case-214.ini
index 7ddbb8db2..602794b67 100644
--- a/src/replica/storage/simple_kv/test/case-214.ini
+++ b/src/replica/storage/simple_kv/test/case-214.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
@@ -55,7 +54,6 @@ run = true
count = 1
pools = THREAD_POOL_DEFAULT
-
[core]
diff --git a/src/replica/storage/simple_kv/test/case-215.ini
b/src/replica/storage/simple_kv/test/case-215.ini
index 7ddbb8db2..28d2c4aaf 100644
--- a/src/replica/storage/simple_kv/test/case-215.ini
+++ b/src/replica/storage/simple_kv/test/case-215.ini
@@ -41,7 +41,6 @@ pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_FD,THREAD_POOL_M
[apps.r]
type = replica
hosted_app_type_name = simple_kv
-
arguments =
ports = 34801
run = true
diff --git a/src/replica/storage/simple_kv/test/client.cpp
b/src/replica/storage/simple_kv/test/client.cpp
index b6117394d..a8b813b2d 100644
--- a/src/replica/storage/simple_kv/test/client.cpp
+++ b/src/replica/storage/simple_kv/test/client.cpp
@@ -46,9 +46,12 @@
#include "runtime/task/async_calls.h"
#include "runtime/task/task_code.h"
#include "simple_kv_types.h"
+#include "utils/flags.h"
#include "utils/fmt_logging.h"
#include "utils/threadpool_code.h"
+DSN_DECLARE_string(server_list);
+
namespace dsn {
namespace replication {
namespace test {
@@ -69,7 +72,7 @@ simple_kv_client_app::~simple_kv_client_app() { stop(); }
return ::dsn::ERR_INVALID_PARAMETERS;
std::vector<host_port> meta_servers;
- replica_helper::load_meta_servers(meta_servers);
+ replica_helper::parse_server_list(FLAGS_server_list, meta_servers);
_meta_server_group.assign_group("meta_servers");
for (const auto &hp : meta_servers) {
LOG_WARNING_IF(!_meta_server_group.group_host_port()->add(hp),
"duplicate adress {}", hp);
diff --git a/src/replica/test/replica_http_service_test.cpp
b/src/replica/test/replica_http_service_test.cpp
index 9e7598c03..97614ed84 100644
--- a/src/replica/test/replica_http_service_test.cpp
+++ b/src/replica/test/replica_http_service_test.cpp
@@ -94,7 +94,7 @@ public:
get_config(req, resp);
ASSERT_EQ(resp.status_code, http_status_code::kOk);
const string unfilled_resp =
-
R"({{"name":"config_sync_interval_ms","section":"replication","type":"FV_UINT32","tags":"flag_tag::FT_MUTABLE","description":"The
interval milliseconds of replica server to syncs replica configuration with
meta server","value":"{}"}})"
+
R"({{"name":"config_sync_interval_ms","section":"replication","type":"FV_UINT32","tags":"flag_tag::FT_MUTABLE","description":"The
interval milliseconds of replica server to send replica config-sync requests
to meta server","value":"{}"}})"
"\n";
ASSERT_EQ(fmt::format(unfilled_resp, expect_value), resp.body);
}
diff --git a/src/runtime/global_config.cpp b/src/runtime/global_config.cpp
index 7b7aafc40..8598e2f62 100644
--- a/src/runtime/global_config.cpp
+++ b/src/runtime/global_config.cpp
@@ -24,10 +24,11 @@
* THE SOFTWARE.
*/
+// IWYU pragma: no_include <ext/alloc_traits.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <algorithm>
+#include <memory>
#include <utility>
#include "runtime/global_config.h"
@@ -36,6 +37,7 @@
#include "utils/config_api.h"
#include "utils/filesystem.h"
#include "utils/fmt_logging.h"
+#include "utils/string_conv.h"
#include "utils/strings.h"
namespace dsn {
@@ -46,57 +48,60 @@ static bool build_client_network_confs(const char *section,
{
nss.clear();
- std::vector<const char *> keys;
+ std::vector<std::string> keys;
dsn_config_get_all_keys(section, keys);
- for (const char *item : keys) {
- std::string k(item);
- if (k.length() <= strlen("network.client."))
+ static const std::string kNetworkClientPrefix = "network.client.";
+ static const auto kNetworkClientPrefixLength =
kNetworkClientPrefix.length();
+ for (const auto &key : keys) {
+ if (key.length() <= kNetworkClientPrefixLength) {
continue;
+ }
- if (k.substr(0, strlen("network.client.")) !=
std::string("network.client."))
+ if (key.substr(0, kNetworkClientPrefixLength) != kNetworkClientPrefix)
{
continue;
+ }
- auto k2 = k.substr(strlen("network.client."));
- if (rpc_channel::is_exist(k2.c_str())) {
- /*
- ;channel = network_provider_name,buffer_block_size
- network.client.RPC_CHANNEL_TCP =
dsn::tools::asio_network_provider,65536
- network.client.RPC_CHANNEL_UDP =
dsn::tools::asio_network_provider,65536
- */
-
- rpc_channel ch = rpc_channel::from_string(k2.c_str(),
RPC_CHANNEL_TCP);
-
- // dsn::tools::asio_network_provider,65536
- std::list<std::string> vs;
- std::string v = dsn_config_get_value_string(
- section,
- k.c_str(),
- "",
- "network channel configuration, e.g.,
dsn::tools::asio_network_provider,65536");
- utils::split_args(v.c_str(), vs, ',');
-
- if (vs.size() != 2) {
- printf("invalid client network specification '%s', should be "
- "'$network-factory,$msg-buffer-size'\n",
- v.c_str());
- return false;
- }
-
- network_client_config ns;
- ns.factory_name = vs.begin()->c_str();
- ns.message_buffer_block_size = atoi(vs.rbegin()->c_str());
+ const auto channel_str = key.substr(kNetworkClientPrefixLength);
+ if (!rpc_channel::is_exist(channel_str.c_str())) {
+ printf("invalid rpc channel type: %s\n", channel_str.c_str());
+ return false;
+ }
- if (ns.message_buffer_block_size == 0) {
- printf("invalid message buffer size specified: '%s'\n",
vs.rbegin()->c_str());
- return false;
- }
+ /*
+ * ;network.client.<channel> =
<network_provider_name>,<buffer_block_size>
+ * e.g.,
+ * network.client.RPC_CHANNEL_TCP =
dsn::tools::asio_network_provider,65536
+ * network.client.RPC_CHANNEL_UDP =
dsn::tools::asio_network_provider,65536
+ */
+
+ // e.g., RPC_CHANNEL_TCP
+ const auto ch = rpc_channel::from_string(channel_str.c_str(),
RPC_CHANNEL_TCP);
+
+ // e.g., dsn::tools::asio_network_provider,65536
+ const auto *value = dsn_config_get_value_string(
+ section,
+ key.c_str(),
+ "",
+ "Network channel configuration, e.g.,
dsn::tools::asio_network_provider,65536");
+ std::vector<std::string> value_params;
+ utils::split_args(value, value_params, ',');
+ if (value_params.size() != 2) {
+ printf("invalid client network specification '%s', should be "
+ "'$network-factory,$msg-buffer-size'\n",
+ value);
+ return false;
+ }
- nss[ch] = ns;
- } else {
- printf("invalid rpc channel type: %s\n", k2.c_str());
+ network_client_config ns;
+ ns.factory_name = value_params[0];
+ if (!buf2int32(value_params[1], ns.message_buffer_block_size) ||
+ ns.message_buffer_block_size == 0) {
+ printf("invalid message buffer size specified: '%s'\n",
value_params[1].c_str());
return false;
}
+
+ nss[ch] = ns;
}
if (default_spec) {
@@ -118,33 +123,48 @@ static bool build_server_network_confs(const char
*section,
{
nss.clear();
- std::vector<const char *> keys;
+ std::vector<std::string> keys;
dsn_config_get_all_keys(section, keys);
- for (const char *item : keys) {
- std::string k(item);
- if (k.length() <= strlen("network.server."))
+ static const std::string kNetworkServerPrefix = "network.server.";
+ static const auto kNetworkServerPrefixLength =
kNetworkServerPrefix.length();
+ for (const auto &key : keys) {
+ if (key.length() <= kNetworkServerPrefixLength) {
continue;
+ }
- if (k.substr(0, strlen("network.server.")) !=
std::string("network.server."))
+ if (key.substr(0, kNetworkServerPrefixLength) != kNetworkServerPrefix)
{
continue;
+ }
- auto k2 = k.substr(strlen("network.server."));
- std::list<std::string> ks;
- utils::split_args(k2.c_str(), ks, '.');
- if (ks.size() != 2) {
+ /*
+ * ;network.server.<port>.<channel> =
<network_provider_name>,<buffer_block_size>
+ * e.g.,
+ * network.server.0.RPC_CHANNEL_TCP =
dsn::tools::asio_network_provider,65536
+ * network.server.9090.RPC_CHANNEL_UDP =
dsn::tools::asio_network_provider,65536
+ */
+
+ // e.g., 0.RPC_CHANNEL_TCP
+ const auto port_and_channel = key.substr(kNetworkServerPrefixLength);
+ std::vector<std::string> params;
+ utils::split_args(port_and_channel.c_str(), params, '.');
+ if (params.size() != 2) {
printf("invalid network server config '%s', should be like "
"'network.server.12345.RPC_CHANNEL_TCP' instead\n",
- k.c_str());
+ key.c_str());
return false;
}
- int port = atoi(ks.begin()->c_str());
- auto k3 = *ks.rbegin();
-
+ // 1. Port
+ int port;
+ if (!buf2int32(params[0], port)) {
+ printf("invalid port '%s' specified in '%s'\n", params[0].c_str(),
key.c_str());
+ return false;
+ }
+ // port = 0 for default setting in [apps..default]
if (is_template) {
if (port != 0) {
- printf("invalid network server configuration '%s'\n",
k.c_str());
+ printf("invalid network server configuration '%s'\n",
key.c_str());
printf("port must be zero in [apps..default]\n");
printf(" e.g., network.server.0.RPC_CHANNEL_TCP = NET_HDR_DSN,
"
"dsn::tools::asio_network_provider,65536\n");
@@ -152,50 +172,45 @@ static bool build_server_network_confs(const char
*section,
}
} else {
if (std::find(ports.begin(), ports.end(), port) == ports.end()) {
+ // TODO(yingchun): return false or continue?
continue;
}
}
- if (rpc_channel::is_exist(k3.c_str())) {
- /*
- port = 0 for default setting in [apps..default]
- port.channel = network_provider_name,buffer_block_size
- network.server.port().RPC_CHANNEL_TCP =
dsn::tools::asio_network_provider,65536
- network.server.port().RPC_CHANNEL_UDP =
dsn::tools::asio_network_provider,65536
- */
-
- rpc_channel ch = rpc_channel::from_string(k3.c_str(),
RPC_CHANNEL_TCP);
-
- // dsn::tools::asio_network_provider,65536
- std::list<std::string> vs;
- std::string v = dsn_config_get_value_string(
- section,
- k.c_str(),
- "",
- "network channel configuration, e.g.,
dsn::tools::asio_network_provider,65536");
- utils::split_args(v.c_str(), vs, ',');
-
- if (vs.size() != 2) {
- printf("invalid server network specification '%s', should be "
- "'$network-factory,$msg-buffer-size'\n",
- v.c_str());
- return false;
- }
-
- network_server_config ns(port, ch);
- ns.factory_name = vs.begin()->c_str();
- ns.message_buffer_block_size = atoi(vs.rbegin()->c_str());
-
- if (ns.message_buffer_block_size == 0) {
- printf("invalid message buffer size specified: '%s'\n",
vs.rbegin()->c_str());
- return false;
- }
+ // 2. Channel
+ const auto &channel_str = params[1];
+ if (!rpc_channel::is_exist(channel_str.c_str())) {
+ printf("invalid rpc channel type: %s\n", channel_str.c_str());
+ return false;
+ }
+ // e.g., RPC_CHANNEL_TCP
+ const auto ch = rpc_channel::from_string(channel_str.c_str(),
RPC_CHANNEL_TCP);
+
+ // dsn::tools::asio_network_provider,65536
+ const auto *value = dsn_config_get_value_string(
+ section,
+ key.c_str(),
+ "",
+ "Network channel configuration, e.g.,
dsn::tools::asio_network_provider,65536");
+
+ std::vector<std::string> value_params;
+ utils::split_args(value, value_params, ',');
+ if (value_params.size() != 2) {
+ printf("invalid server network specification '%s', should be "
+ "'$network-factory,$msg-buffer-size'\n",
+ value);
+ return false;
+ }
- nss[ns] = ns;
- } else {
- printf("invalid rpc channel type: %s\n", k3.c_str());
+ network_server_config ns(port, ch);
+ ns.factory_name = value_params[0];
+ if (!buf2int32(value_params[1], ns.message_buffer_block_size) ||
+ ns.message_buffer_block_size == 0) {
+ printf("invalid message buffer size specified: '%s'\n",
value_params[1].c_str());
return false;
}
+
+ nss[ns] = ns;
}
if (default_spec) {
diff --git a/src/runtime/global_config.h b/src/runtime/global_config.h
index 618c20003..65d62bddd 100644
--- a/src/runtime/global_config.h
+++ b/src/runtime/global_config.h
@@ -120,18 +120,21 @@ struct service_app_spec
};
CONFIG_BEGIN(service_app_spec)
-CONFIG_FLD_STRING(type, "", "app type name, as given when registering by
dsn_register_app")
+CONFIG_FLD_STRING(type,
+ "",
+ "The app type name, as given when registering by "
+ "dsn::service_app::register_factory<T>(\"<type>\")")
CONFIG_FLD_STRING(arguments, "", "arguments for the app instances")
CONFIG_FLD_INT_LIST(ports, "RPC server listening ports needed for this app")
-CONFIG_FLD_ID_LIST(threadpool_code, pools, "thread pools need to be started")
+CONFIG_FLD_ID_LIST(threadpool_code, pools, "Thread pools needed to be started
for this app")
CONFIG_FLD(int, uint64, delay_seconds, 0, "delay seconds for when the apps
should be started")
CONFIG_FLD(int,
uint64,
count,
1,
- "count of app instances for this type (ports are automatically "
- "calculated accordingly to avoid confliction)")
-CONFIG_FLD(bool, bool, run, true, "whether to run the app instances or not")
+ "The count of app instances for this type (ports are automatically "
+ "calculated accordingly to avoid conflict, i.e., ports, ports+1,
ports+2, ...)")
+CONFIG_FLD(bool, bool, run, true, "Whether to run the app instances or not")
CONFIG_END
struct service_spec
@@ -175,11 +178,14 @@ struct service_spec
};
CONFIG_BEGIN(service_spec)
-CONFIG_FLD_STRING(tool, "", "use what tool to run this process, e.g., native
or simulator")
-CONFIG_FLD_STRING_LIST(toollets, "use what toollets, e.g., tracer, profiler,
fault_injector")
+CONFIG_FLD_STRING(tool, "", "Which tool is used to run this process, e.g.,
'native' or 'simulator'")
+CONFIG_FLD_STRING_LIST(toollets,
+ "Which toollets are used to run this process, e.g.,
'tracer', "
+ "'profiler' and 'fault_injector'. Multiple toollets are
allowed "
+ "to set in one service.")
CONFIG_FLD_STRING(data_dir,
"./data",
- "The default directory to place the all the
data/log/coredump, etc..")
+ "The default directory to place the all the data, logs,
coredump files, and etc.")
CONFIG_FLD(
bool,
bool,
@@ -195,6 +201,6 @@ CONFIG_FLD_STRING(lock_factory_name, "", "recursive
exclusive lock provider")
CONFIG_FLD_STRING(lock_nr_factory_name, "", "non-recurisve exclusive lock
provider")
CONFIG_FLD_STRING(rwlock_nr_factory_name, "", "non-recurisve rwlock provider")
CONFIG_FLD_STRING(semaphore_factory_name, "", "semaphore provider")
-CONFIG_FLD_STRING(logging_factory_name, "", "logging provider")
+CONFIG_FLD_STRING(logging_factory_name, "", "The implementation class of
logging service")
CONFIG_END
} // namespace dsn
diff --git a/src/runtime/profiler.cpp b/src/runtime/profiler.cpp
index 0113a1178..7571714d8 100644
--- a/src/runtime/profiler.cpp
+++ b/src/runtime/profiler.cpp
@@ -73,12 +73,11 @@ START<== queue(server) == ENQUEUE <===== net(reply) =======
REPLY <=============
#include "utils/join_point.h"
#include "utils/metrics.h"
-DSN_DEFINE_bool(task..default, is_profile, false, "whether to profile this
kind of task");
+DSN_DEFINE_bool(task..default, is_profile, false, "Whether to profile task");
DSN_DEFINE_bool(task..default,
collect_call_count,
true,
- "whether to collect how many time this kind of tasks invoke
each of other kinds "
- "tasks");
+ "Whether to collect the times of the task invoke each of other
kinds tasks");
METRIC_DEFINE_entity(profiler);
@@ -380,19 +379,14 @@ task_spec_profiler::task_spec_profiler(int code)
CHECK_NOTNULL(spec, "spec should be non-null: task_code={}, task_name={}",
code, _task_name);
collect_call_count = dsn_config_get_value_bool(
- section_name.c_str(),
- "collect_call_count",
- FLAGS_collect_call_count,
- "whether to collect how many time this kind of tasks invoke each of
other kinds tasks");
+ section_name.c_str(), "collect_call_count", FLAGS_collect_call_count,
"");
for (int i = 0; i <= s_task_code_max; ++i) {
call_counts[i].store(0);
}
- is_profile = dsn_config_get_value_bool(section_name.c_str(),
- "is_profile",
- FLAGS_is_profile,
- "whether to profile this kind of
task");
+ is_profile =
+ dsn_config_get_value_bool(section_name.c_str(), "is_profile",
FLAGS_is_profile, "");
if (!is_profile) {
return;
@@ -409,33 +403,33 @@ task_spec_profiler::task_spec_profiler(int code)
section_name.c_str(),
"profiler::inqueue",
true,
- "whether to profile the number of this kind of tasks in all
queues")) {
+ "Whether to profile the count of this kind of tasks in all
queues")) {
METRIC_VAR_ASSIGN_profiler(profiler_queued_tasks);
}
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::queue",
true,
- "whether to profile the queuing time of a
task")) {
+ "Whether to profile the queuing duration of
a task")) {
METRIC_VAR_ASSIGN_profiler(profiler_queue_latency_ns);
}
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::exec",
true,
- "whether to profile the executing time of a
task")) {
+ "Whether to profile the executing duration
of a task")) {
METRIC_VAR_ASSIGN_profiler(profiler_execute_latency_ns);
}
if (dsn_config_get_value_bool(
- section_name.c_str(), "profiler::qps", true, "whether to profile
the qps of a task")) {
+ section_name.c_str(), "profiler::qps", true, "Whether to profile
the QPS of a task")) {
METRIC_VAR_ASSIGN_profiler(profiler_executed_tasks);
}
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::cancelled",
true,
- "whether to profile the cancelled times of a
task")) {
+ "Whether to profile the cancelled times of a
task")) {
METRIC_VAR_ASSIGN_profiler(profiler_cancelled_tasks);
}
@@ -443,45 +437,46 @@ task_spec_profiler::task_spec_profiler(int code)
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::latency.server",
true,
- "whether to profile the server latency
of a task")) {
+ "Whether to profile the server latency
of a task")) {
METRIC_VAR_ASSIGN_profiler(profiler_server_rpc_latency_ns);
}
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::size.request.server",
false,
- "whether to profile the size per
request")) {
+ "Whether to profile the size of per
request")) {
METRIC_VAR_ASSIGN_profiler(profiler_server_rpc_request_bytes);
}
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::size.response.server",
false,
- "whether to profile the size per
response")) {
+ "Whether to profile the size of per
response")) {
METRIC_VAR_ASSIGN_profiler(profiler_server_rpc_response_bytes);
}
- if (dsn_config_get_value_bool(section_name.c_str(),
-
"rpc_request_dropped_before_execution_when_timeout",
- false,
- "whether to profile the number of rpc
dropped for timeout")) {
+ if (dsn_config_get_value_bool(
+ section_name.c_str(),
+ "rpc_request_dropped_before_execution_when_timeout",
+ false,
+ "Whether to profile the count of RPC dropped for timeout
reason")) {
METRIC_VAR_ASSIGN_profiler(profiler_dropped_timeout_rpcs);
}
} else if (spec->type == dsn_task_type_t::TASK_TYPE_RPC_RESPONSE) {
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::latency.client",
true,
- "whether to profile the client latency
of a task")) {
+ "Whether to profile the client latency
of a task")) {
METRIC_VAR_ASSIGN_profiler(profiler_client_rpc_latency_ns);
}
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::timeout.qps",
true,
- "whether to profile the timeout qps of a
task")) {
+ "Whether to profile the timeout QPS of a
task")) {
METRIC_VAR_ASSIGN_profiler(profiler_client_timeout_rpcs);
}
} else if (spec->type == dsn_task_type_t::TASK_TYPE_AIO) {
if (dsn_config_get_value_bool(section_name.c_str(),
"profiler::latency",
true,
- "whether to profile the latency of an
AIO task")) {
+ "Whether to profile the latency of an
AIO task")) {
METRIC_VAR_ASSIGN_profiler(profiler_aio_latency_ns);
}
}
diff --git a/src/runtime/rpc/network.cpp b/src/runtime/rpc/network.cpp
index d28363fae..ba62ebdbe 100644
--- a/src/runtime/rpc/network.cpp
+++ b/src/runtime/rpc/network.cpp
@@ -62,7 +62,7 @@ METRIC_DEFINE_gauge_int64(server,
DSN_DEFINE_uint32(network,
conn_threshold_per_ip,
0,
- "The maximum connection count to each server per ip, 0 means
no limit");
+ "The maximum connection count to each server per IP address,
0 means no limit");
DSN_DEFINE_string(network, unknown_message_header_format, "", "format for
unknown message headers");
DSN_DEFINE_string(network,
explicit_host_address,
diff --git a/src/runtime/service_api_c.cpp b/src/runtime/service_api_c.cpp
index a26f417de..6d45be07a 100644
--- a/src/runtime/service_api_c.cpp
+++ b/src/runtime/service_api_c.cpp
@@ -83,7 +83,7 @@ DSN_DEFINE_bool(
core,
pause_on_start,
false,
- "Whether to pause during startup to wait for interactive input, often for
debugging perpose");
+ "Whether to pause during startup to wait for interactive input, often for
debugging purpose");
#ifdef DSN_ENABLE_GPERF
DSN_DEFINE_double(core,
tcmalloc_release_rate,
diff --git a/src/runtime/task/task_spec.h b/src/runtime/task/task_spec.h
index 77beb9e90..3b31537e0 100644
--- a/src/runtime/task/task_spec.h
+++ b/src/runtime/task/task_spec.h
@@ -249,9 +249,9 @@ CONFIG_FLD(bool,
bool,
allow_inline,
false,
- "allow task executed in other thread pools or tasks "
- "for TASK_TYPE_COMPUTE - allow-inline allows a task being executed
in its caller site "
- "for other tasks - allow-inline allows a task being execution in
io-thread ")
+ "Whether allowing a task to be executed in other thread pools or
tasks. "
+ "1. For TASK_TYPE_COMPUTE: allows a task being executed in its
caller site. "
+ "2. For other tasks: allows a task being executed in io-thread.")
CONFIG_FLD(bool,
bool,
randomize_timer_delay_if_zero,
@@ -265,7 +265,8 @@ CONFIG_FLD_ID(network_header_format,
rpc_call_header_format,
NET_HDR_DSN,
false,
- "what kind of header format for this kind of rpc calls")
+ "What kind of header format for this kind of RPC calls, e.g.
NET_HDR_THRIFT, "
+ "NET_HDR_HTTP, NET_HDR_RAW and NET_HDR_DSN")
CONFIG_FLD_ENUM(dsn_msg_serialize_format,
rpc_msg_payload_serialize_default_format,
DSF_THRIFT_BINARY,
@@ -276,7 +277,8 @@ CONFIG_FLD_ID(rpc_channel,
rpc_call_channel,
RPC_CHANNEL_TCP,
false,
- "what kind of network channel for this kind of rpc calls")
+ "What kind of network channel for this kind of RPC calls, e.g.
RPC_CHANNEL_TCP and "
+ "RPC_CHANNEL_UDP")
CONFIG_FLD(bool,
bool,
rpc_message_crc_required,
@@ -286,7 +288,7 @@ CONFIG_FLD(int32_t,
uint64,
rpc_timeout_milliseconds,
5000,
- "what is the default timeout (ms) for this kind of rpc calls")
+ "The timeout (in milliseconds) for this kind of RPC calls")
CONFIG_FLD(int32_t,
uint64,
rpc_request_resend_timeout_milliseconds,
diff --git a/src/runtime/test/service_api_c.cpp
b/src/runtime/test/service_api_c.cpp
index 263063f22..c9eb97f39 100644
--- a/src/runtime/test/service_api_c.cpp
+++ b/src/runtime/test/service_api_c.cpp
@@ -143,11 +143,11 @@ TEST(core, dsn_config)
ASSERT_EQ(1.0, dsn_config_get_value_double("apps.client", "count", 100.0,
"client count"));
ASSERT_EQ(1.0, dsn_config_get_value_double("apps.client", "count", 100.0,
"client count"));
- std::vector<const char *> buffers;
+ std::vector<std::string> buffers;
dsn_config_get_all_keys("core.test", buffers);
ASSERT_EQ(2, buffers.size());
- ASSERT_STREQ("count", buffers[0]);
- ASSERT_STREQ("run", buffers[1]);
+ ASSERT_EQ("count", buffers[0]);
+ ASSERT_EQ("run", buffers[1]);
}
TEST(core, dsn_exlock)
diff --git a/src/runtime/tracer.cpp b/src/runtime/tracer.cpp
index c3a7e9154..4fcdfacb6 100644
--- a/src/runtime/tracer.cpp
+++ b/src/runtime/tracer.cpp
@@ -49,7 +49,7 @@
#include "utils/fmt_logging.h"
#include "utils/join_point.h"
-DSN_DEFINE_bool(task..default, is_trace, false, "whether to trace tasks by
default");
+DSN_DEFINE_bool(task..default, is_trace, false, "Whether to trace task");
namespace dsn {
namespace tools {
diff --git a/src/server/available_detector.cpp
b/src/server/available_detector.cpp
index 168481a7b..67754149d 100644
--- a/src/server/available_detector.cpp
+++ b/src/server/available_detector.cpp
@@ -77,6 +77,8 @@ DSN_DEFINE_string(pegasus.collector,
"",
"available detect alert email address, empty means not send
email");
+DSN_DECLARE_string(server_list);
+
namespace pegasus {
namespace server {
@@ -97,7 +99,7 @@ available_detector::available_detector()
// initialize information for available_detector.
_cluster_name = dsn::get_current_cluster_name();
_meta_list.clear();
- dsn::replication::replica_helper::load_meta_servers(_meta_list);
+ dsn::replication::replica_helper::parse_server_list(FLAGS_server_list,
_meta_list);
CHECK(!_meta_list.empty(), "");
// initialize the _client.
if (!pegasus_client_factory::initialize(nullptr)) {
diff --git a/src/server/config.ini b/src/server/config.ini
index 657c264f9..90caaa5f8 100644
--- a/src/server/config.ini
+++ b/src/server/config.ini
@@ -20,7 +20,6 @@
[apps.meta]
type = meta
- name = meta
arguments =
ports = 34601
pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_META_STATE,THREAD_POOL_FD,THREAD_POOL_DLOCK,THREAD_POOL_BLOCK_SERVICE
@@ -29,7 +28,6 @@
[apps.replica]
type = replica
- name = replica
arguments =
ports = 34801
pools =
THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_COMPACT,THREAD_POOL_INGESTION,THREAD_POOL_PLOG,THREAD_POOL_SCAN
@@ -37,7 +35,6 @@
count = 1
[apps.collector]
- name = collector
type = collector
arguments =
ports = 34101
@@ -46,7 +43,6 @@
count = 1
[apps.mimic]
- name = mimic
type = dsn.app.mimic
arguments =
pools = THREAD_POOL_DEFAULT
diff --git a/src/server/config.min.ini b/src/server/config.min.ini
index 870cc171e..630d763f9 100644
--- a/src/server/config.min.ini
+++ b/src/server/config.min.ini
@@ -20,18 +20,15 @@
[apps.meta]
type = meta
- name = meta
ports = @META_PORT@
pools =
THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_META_STATE,THREAD_POOL_FD,THREAD_POOL_DLOCK,THREAD_POOL_BLOCK_SERVICE
[apps.replica]
type = replica
- name = replica
ports = @REPLICA_PORT@
pools =
THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_COMPACT,THREAD_POOL_INGESTION,THREAD_POOL_PLOG,THREAD_POOL_SCAN
[apps.collector]
- name = collector
type = collector
ports = 34101
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION
diff --git a/src/server/info_collector.cpp b/src/server/info_collector.cpp
index 5f504ce42..aa77a5d3c 100644
--- a/src/server/info_collector.cpp
+++ b/src/server/info_collector.cpp
@@ -58,6 +58,8 @@ DSN_DEFINE_string(pegasus.collector,
DSN_DEFINE_validator(usage_stat_app,
[](const char *value) -> bool { return
!dsn::utils::is_empty(value); });
+DSN_DECLARE_string(server_list);
+
namespace pegasus {
namespace server {
@@ -72,7 +74,7 @@ DEFINE_TASK_CODE(LPC_PEGASUS_STORAGE_SIZE_STAT_TIMER,
info_collector::info_collector()
{
std::vector<::dsn::host_port> meta_servers;
- replica_helper::load_meta_servers(meta_servers);
+ replica_helper::parse_server_list(FLAGS_server_list, meta_servers);
_meta_servers.assign_group("meta-servers");
for (auto &ms : meta_servers) {
diff --git a/src/server/pegasus_server_impl_init.cpp
b/src/server/pegasus_server_impl_init.cpp
index 73afd5f0a..73bab5192 100644
--- a/src/server/pegasus_server_impl_init.cpp
+++ b/src/server/pegasus_server_impl_init.cpp
@@ -553,8 +553,7 @@ DSN_DEFINE_string(pegasus.server,
rocksdb_compression_type,
"lz4",
"Corresponding to RocksDB's options.compression. Available
config: "
- "'[none|snappy|zstd|lz4]' for all "
- "level 1 and higher levels, and "
+ "'[none|snappy|zstd|lz4]' for all level 1 and higher levels,
and "
"'per_level:[none|snappy|zstd|lz4],[none|snappy|zstd|lz4],...' for each level "
"0,1,..., the last compression type will be used for levels
not specified in the "
"list.");
diff --git a/src/server/test/config.ini b/src/server/test/config.ini
index 96029705e..d5a0d9aa3 100644
--- a/src/server/test/config.ini
+++ b/src/server/test/config.ini
@@ -23,7 +23,6 @@ count = 1
[apps.replica]
type = replica
-name = replica
arguments =
ports = @REPLICA_PORT@
pools =
THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_COMPACT,THREAD_POOL_PLOG
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index 6e2909c3a..9f986e6d8 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -698,9 +698,8 @@ static void freeHintsCallback(void *ptr) {
sdsfree((sds)ptr); }
"",
"");
-
dsn::replication::replica_helper::load_meta_servers(s_global_context.meta_list,
-
dsn::PEGASUS_CLUSTER_SECTION_NAME.c_str(),
- cluster_name.c_str());
+ dsn::replication::replica_helper::load_servers_from_config(
+ dsn::PEGASUS_CLUSTER_SECTION_NAME, cluster_name,
s_global_context.meta_list);
s_global_context.ddl_client =
std::make_unique<dsn::replication::replication_ddl_client>(s_global_context.meta_list);
diff --git a/src/test/function_test/config.ini
b/src/test/function_test/config.ini
index 34fb4a938..ab405ae5b 100644
--- a/src/test/function_test/config.ini
+++ b/src/test/function_test/config.ini
@@ -22,7 +22,6 @@ count = 1
;network.server.0.RPC_CHANNEL_TCP = NET_HDR_DSN,
dsn::tools::sim_network_provider, 65536
[apps.mimic]
-name = mimic
type = dsn.app.mimic
arguments =
pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER
diff --git a/src/test/function_test/security/config.ini
b/src/test/function_test/security/config.ini
index de2b64edf..4fb8b8492 100644
--- a/src/test/function_test/security/config.ini
+++ b/src/test/function_test/security/config.ini
@@ -16,7 +16,6 @@
; under the License.
[apps.mimic]
-name = mimic
type = dsn.app.mimic
pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER
diff --git a/src/test/function_test/utils/test_util.cpp
b/src/test/function_test/utils/test_util.cpp
index cf0b0fd49..165626a5a 100644
--- a/src/test/function_test/utils/test_util.cpp
+++ b/src/test/function_test/utils/test_util.cpp
@@ -82,8 +82,8 @@ void test_util::SetUpTestCase() {
ASSERT_TRUE(pegasus_client_factory::initialize
void test_util::SetUp()
{
- ASSERT_TRUE(replica_helper::load_meta_servers(
- meta_list_, dsn::PEGASUS_CLUSTER_SECTION_NAME.c_str(),
kClusterName.c_str()));
+ ASSERT_TRUE(replica_helper::load_servers_from_config(
+ dsn::PEGASUS_CLUSTER_SECTION_NAME, kClusterName, meta_list_));
ASSERT_FALSE(meta_list_.empty());
ddl_client_ = std::make_shared<replication_ddl_client>(meta_list_);
diff --git a/src/test/kill_test/config.ini b/src/test/kill_test/config.ini
index 426bd2a61..0d7df1af1 100644
--- a/src/test/kill_test/config.ini
+++ b/src/test/kill_test/config.ini
@@ -22,7 +22,6 @@ count = 1
;network.server.0.RPC_CHANNEL_TCP = NET_HDR_DSN,
dsn::tools::sim_network_provider, 65536
[apps.mimic]
-name = mimic
type = dsn.app.mimic
arguments =
pools = THREAD_POOL_DEFAULT, THREAD_POOL_META_SERVER
diff --git a/src/test/kill_test/kill_testor.cpp
b/src/test/kill_test/kill_testor.cpp
index cadd2c3b1..7c75fd094 100644
--- a/src/test/kill_test/kill_testor.cpp
+++ b/src/test/kill_test/kill_testor.cpp
@@ -23,7 +23,6 @@
#include <time.h>
#include <unistd.h>
#include <algorithm>
-#include <string>
#include <unordered_set>
#include <utility>
@@ -53,8 +52,8 @@ kill_testor::kill_testor(const char *config_file)
}
// load meta_list
- dsn::replication::replica_helper::load_meta_servers(
- meta_list, dsn::PEGASUS_CLUSTER_SECTION_NAME.c_str(),
FLAGS_pegasus_cluster_name);
+ dsn::replication::replica_helper::load_servers_from_config(
+ dsn::PEGASUS_CLUSTER_SECTION_NAME, FLAGS_pegasus_cluster_name,
meta_list);
if (meta_list.empty()) {
LOG_ERROR("Should config the meta address for killer");
exit(-1);
diff --git a/src/test/pressure_test/config-pressure.ini
b/src/test/pressure_test/config-pressure.ini
index f1468ec52..a28381e14 100644
--- a/src/test/pressure_test/config-pressure.ini
+++ b/src/test/pressure_test/config-pressure.ini
@@ -22,7 +22,6 @@ count = 1
;network.server.0.RPC_CHANNEL_TCP = NET_HDR_DSN,
dsn::tools::sim_network_provider, 65536
[apps.mimic]
-name = mimic
type = dsn.app.mimic
arguments =
pools = THREAD_POOL_DEFAULT
diff --git a/src/utils/config_api.cpp b/src/utils/config_api.cpp
index 537ffed65..6b5444760 100644
--- a/src/utils/config_api.cpp
+++ b/src/utils/config_api.cpp
@@ -84,11 +84,6 @@ void dsn_config_get_all_sections(/*out*/
std::vector<std::string> §ions)
g_config.get_all_sections(sections);
}
-void dsn_config_get_all_sections(/*out*/ std::vector<const char *> §ions)
-{
- g_config.get_all_section_ptrs(sections);
-}
-
void dsn_config_get_all_keys(const char *section, std::vector<std::string>
&keys)
{
std::vector<const char *> key_ptrs;
@@ -97,11 +92,6 @@ void dsn_config_get_all_keys(const char *section,
std::vector<std::string> &keys
keys.emplace_back(std::string(p));
}
-void dsn_config_get_all_keys(const char *section, /*out*/ std::vector<const
char *> &keys)
-{
- g_config.get_all_keys(section, keys);
-}
-
void dsn_config_set(const char *section, const char *key, const char *value,
const char *dsptr)
{
g_config.set(section, key, value, dsptr);
diff --git a/src/utils/config_api.h b/src/utils/config_api.h
index 62b0ec651..0d8afd5d0 100644
--- a/src/utils/config_api.h
+++ b/src/utils/config_api.h
@@ -112,18 +112,10 @@ double dsn_config_get_value_double(const char *section,
/// this function is not thread safe if dsn_config_set is concurrently called
void dsn_config_get_all_sections(/*out*/ std::vector<std::string> §ions);
-/// get the names of all sections
-/// this function is not thread safe if dsn_config_set is concurrently called
-void dsn_config_get_all_sections(/*out*/ std::vector<const char *> §ions);
-
/// get all keys in some specific section
/// this function is not thread safe if dsn_config_set is concurrently called
void dsn_config_get_all_keys(const char *section, /*out*/
std::vector<std::string> &keys);
-/// get all keys in some specific section
-/// this function is not thread safe if dsn_config_set is concurrently called
-void dsn_config_get_all_keys(const char *section, /*out*/ std::vector<const
char *> &keys);
-
/// set value for a key of some section.
/// if the section doesn't exsit, a new one will be created.
/// if the key doesn't exist, a new one will be created
diff --git a/src/utils/simple_logger.cpp b/src/utils/simple_logger.cpp
index 79dfea3de..fa1ef779f 100644
--- a/src/utils/simple_logger.cpp
+++ b/src/utils/simple_logger.cpp
@@ -47,7 +47,7 @@
#include "utils/strings.h"
#include "utils/time_utils.h"
-DSN_DEFINE_bool(tools.simple_logger, fast_flush, false, "whether to flush
immediately");
+DSN_DEFINE_bool(tools.simple_logger, fast_flush, false, "Whether to flush logs
immediately");
DSN_DEFINE_bool(tools.simple_logger,
short_header,
false,
@@ -55,15 +55,17 @@ DSN_DEFINE_bool(tools.simple_logger,
"file, file number and function name "
"fields in each line)");
-DSN_DEFINE_uint64(tools.simple_logger,
- max_number_of_log_files_on_disk,
- 20,
- "max number of log files reserved on disk, older logs are
auto deleted");
-
-DSN_DEFINE_string(tools.simple_logger,
- stderr_start_level,
- "LOG_LEVEL_WARNING",
- "copy log messages at or above this level to stderr in
addition to logfiles");
+DSN_DEFINE_uint64(
+ tools.simple_logger,
+ max_number_of_log_files_on_disk,
+ 20,
+ "The maximum number of log files to be reserved on disk, older logs are
deleted automatically");
+
+DSN_DEFINE_string(
+ tools.simple_logger,
+ stderr_start_level,
+ "LOG_LEVEL_WARNING",
+ "The lowest level of log messages to be copied to stderr in addition to
log files");
DSN_DEFINE_validator(stderr_start_level, [](const char *level) -> bool {
return !dsn::utils::equals(level, "LOG_LEVEL_INVALID");
});
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]