empiredan commented on code in PR #1346:
URL:
https://github.com/apache/incubator-pegasus/pull/1346#discussion_r1104072841
##########
src/runtime/simulator.cpp:
##########
@@ -121,8 +124,7 @@ void simulator::install(service_spec &spec)
void simulator::on_system_exit(sys_exit_type st)
{
- LOG_ERROR("system exits, you can replay this process using random seed {}",
- sim_env_provider::seed());
+ LOG_ERROR("system exits, you can replay this process using random seed
{}", FLAGS_random_seed);
Review Comment:
LOG_INFO ?
##########
src/test/kill_test/process_kill_testor.cpp:
##########
@@ -60,23 +76,10 @@ process_kill_testor::process_kill_testor(const char
*config_file) : kill_testor(
_sleep_time_before_recover_seconds = (uint32_t)dsn_config_get_value_uint64(
section, "sleep_time_before_recover_seconds", 30, "sleep time before
recover seconds");
- _total_meta_count =
- (int32_t)dsn_config_get_value_uint64(section, "total_meta_count", 0,
"total meta count");
- _total_replica_count = (int32_t)dsn_config_get_value_uint64(
- section, "total_replica_count", 0, "total replica count");
- _total_zookeeper_count = (int32_t)dsn_config_get_value_uint64(
- section, "total_zookeeper_count", 0, "total zookeeper count");
-
- if (_total_meta_count == 0 && _total_replica_count == 0 &&
_total_zookeeper_count == 0) {
+ if (FLAGS_total_meta_count == 0 && FLAGS_total_replica_count == 0 &&
Review Comment:
Use group validator instead ?
##########
src/meta/server_state.cpp:
##########
@@ -433,13 +440,17 @@ error_code server_state::initialize_default_apps()
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
Review Comment:
I think now the 2 kinds of sections are used according the following rules:
- If only one table should be created for bootstrap, `replication.app` would
be used; while analyzing the configuration file, it should be fully matched
since there is only one table.
- Once there were more than one table, `meta_server.apps` would be used,
where *apps* also means more than one; while analyzing the configuration file,
it should be partially matched, for example, `meta_server.apps.test1` and
`meta_server.apps.test2` for 2 tables *test1* and *test2*.
To support multiple tables for bootstrap by flags it's somewhat difficult,
since the tables are user-defined and we couldn't know beforehand.
##########
src/test/pressure_test/main.cpp:
##########
@@ -238,27 +236,18 @@ int main(int argc, const char **argv)
sortkey_limit =
(int64_t)dsn_config_get_value_uint64("pressureclient",
"sortkey_limit", 0, "sortkey limit");
- hashkey_len =
- (int32_t)dsn_config_get_value_uint64("pressureclient", "hashkey_len",
64, "hashkey length");
-
- sortkey_len =
- (int32_t)dsn_config_get_value_uint64("pressureclient", "sortkey_len",
64, "sortkey length");
-
- value_len =
- (int32_t)dsn_config_get_value_uint64("pressureclient", "value_len",
64, "value length");
-
- CHECK_GT(qps, 0);
+ CHECK_GT(FLAGS_qps, 0);
Review Comment:
Use validator instead ?
##########
src/runtime/env.sim.cpp:
##########
@@ -37,33 +37,32 @@
#include "scheduler.h"
#include "utils/rand.h"
+#include "utils/flags.h"
namespace dsn {
namespace tools {
-/*static*/ int sim_env_provider::_seed;
+DSN_DEFINE_int32(tools.simulator,
+ random_seed,
+ 0,
+ "random seed for the simulator, 0 for random seed");
void sim_env_provider::on_worker_start(task_worker *worker)
{
rand::reseed_thread_local_rng(
- (_seed + worker->index() + worker->index() *
worker->pool_spec().pool_code) ^
+ (FLAGS_random_seed + worker->index() + worker->index() *
worker->pool_spec().pool_code) ^
worker->index());
}
sim_env_provider::sim_env_provider(env_provider *inner_provider) :
env_provider(inner_provider)
{
task_worker::on_start.put_front(on_worker_start,
"sim_env_provider::on_worker_start");
- _seed =
- (int)dsn_config_get_value_uint64("tools.simulator",
- "random_seed",
- 0,
- "random seed for the simulator, 0 for
random random seed");
- if (_seed == 0) {
- _seed = std::random_device{}();
+ if (FLAGS_random_seed == 0) {
+ FLAGS_random_seed = std::random_device{}();
}
- LOG_ERROR("simulation.random seed for this round is {}", _seed);
+ LOG_ERROR("simulation.random seed for this round is {}",
FLAGS_random_seed);
Review Comment:
LOG_INFO ?
--
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]