Skip to content

Commit

Permalink
fix suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Nov 22, 2024
1 parent 0336777 commit 5c2b16e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/meta/server_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3033,10 +3033,7 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc)
}

if (s == "dropping") {
const auto &iter = _exist_apps.find(app_name);
CHECK_TRUE(iter != _exist_apps.end());

iter->second->status = app_status::AS_DROPPING;
gutil::FindOrDie(_exist_apps, app_name)->status = app_status::AS_DROPPING;
return;
}
});
Expand Down
17 changes: 4 additions & 13 deletions src/meta/server_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "common/gpid.h"
#include "common/manual_compact.h"
#include "dsn.layer2_types.h"
#include "gutil/map_util.h"
#include "meta/meta_rpc_types.h"
#include "meta_data.h"
#include "table_metrics.h"
Expand Down Expand Up @@ -143,24 +144,14 @@ class server_state

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

std::shared_ptr<app_state> get_app(const std::string &name) const
std::shared_ptr<app_state> get_app(const std::string &app_name) const
{
const auto &iter = _exist_apps.find(name);
if (iter == _exist_apps.end()) {
return {};
}

return iter->second;
return gutil::FindWithDefault(_exist_apps, app_name);
}

std::shared_ptr<app_state> get_app(int32_t app_id) const
{
const auto &iter = _all_apps.find(app_id);
if (iter == _all_apps.end()) {
return {};
}

return iter->second;
return gutil::FindWithDefault(_all_apps, app_id);
}

void query_configuration_by_index(const query_cfg_request &request,
Expand Down

0 comments on commit 5c2b16e

Please sign in to comment.