Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default add hosts for standalone version #4129

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/storage/StorageServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ DEFINE_bool(local_config, false, "meta client will not retrieve latest configura
DEFINE_int32(storage_port, 44501, "Storage daemon listening port");
DEFINE_int32(storage_num_worker_threads, 32, "Number of workers");
DECLARE_bool(local_config);
DEFINE_bool(add_local_host, true, "Whether add localhost automatically");
pengweisong marked this conversation as resolved.
Show resolved Hide resolved
DECLARE_string(local_ip);
#endif
DEFINE_bool(storage_kv_mode, false, "True for kv mode");
DEFINE_int32(num_io_threads, 16, "Number of IO threads");
Expand Down Expand Up @@ -168,6 +170,28 @@ bool StorageServer::start() {
options.dataPaths_ = dataPaths_;

metaClient_ = std::make_unique<meta::MetaClient>(ioThreadPool_, metaAddrs_, options);

#ifdef BUILD_STANDALONE
if (FLAGS_add_local_host) {
critical27 marked this conversation as resolved.
Show resolved Hide resolved
std::vector<HostAddr> hosts = {{FLAGS_local_ip, FLAGS_storage_port}};
folly::Baton<> baton;
bool isAdded = false;
metaClient_->addHosts(hosts).thenValue([&isAdded, &baton](StatusOr<bool> resp) {
if (!resp.ok() || !resp.value()) {
LOG(ERROR) << "Add hosts for standalone failed.";
} else {
LOG(INFO) << "Add hosts for standalone succeed.";
isAdded = true;
}
baton.post();
});
baton.wait();
if (!isAdded) {
return false;
}
}
#endif

if (!metaClient_->waitForMetadReady()) {
LOG(ERROR) << "waitForMetadReady error!";
return false;
Expand Down
1 change: 1 addition & 0 deletions tests/common/nebula_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def _make_sa_params(self, **kwargs):
self.graphd_param['password_lock_time_in_secs'] = '10'
self.graphd_param['raft_heartbeat_interval_secs'] = '30'
self.graphd_param['skip_wait_in_rate_limiter'] = 'true'
self.graphd_param['add_local_host'] = 'false'
critical27 marked this conversation as resolved.
Show resolved Hide resolved
for p in [self.metad_param, self.storaged_param, self.graphd_param]:
p.update(kwargs)

Expand Down