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

fix(meta): meta server failed and could not be started normally while setting environment variables after dropping table #2148

Merged
merged 15 commits into from
Nov 25, 2024
Prev Previous commit
Next Next commit
fix clang-tidy
empiredan committed Nov 19, 2024
commit 99d24ed6f0ba0c201a4654448ecdd99dee5f863e
7 changes: 4 additions & 3 deletions src/meta/server_state.h
Original file line number Diff line number Diff line change
@@ -140,13 +140,14 @@ class server_state

void lock_read(zauto_read_lock &other);
void lock_write(zauto_write_lock &other);
const meta_view get_meta_view() { return {&_all_apps, &_nodes}; }

meta_view get_meta_view() { return {&_all_apps, &_nodes}; }

std::shared_ptr<app_state> get_app(const std::string &name) const
{
const auto &iter = _exist_apps.find(name);
acelyc111 marked this conversation as resolved.
Show resolved Hide resolved
if (iter == _exist_apps.end()) {
return std::shared_ptr<app_state>();
return {};
}

return iter->second;
@@ -156,7 +157,7 @@ class server_state
{
const auto &iter = _all_apps.find(app_id);
if (iter == _all_apps.end()) {
return std::shared_ptr<app_state>();
return {};
}

return iter->second;
2 changes: 1 addition & 1 deletion src/meta/test/state_sync_test.cpp
Original file line number Diff line number Diff line change
@@ -393,7 +393,7 @@ void meta_service_test_app::construct_apps_test()
generate_node_list(nodes, 1, 1);
svc->_state->construct_apps({resp}, nodes, hint_message);

meta_view mv = svc->_state->get_meta_view();
const meta_view mv = svc->_state->get_meta_view();
const app_mapper &mapper = *(mv.apps);
ASSERT_EQ(6, mv.apps->size());