diff --git a/src/meta/server_state.cpp b/src/meta/server_state.cpp index ae0ecc1b93..b53132fbfd 100644 --- a/src/meta/server_state.cpp +++ b/src/meta/server_state.cpp @@ -3098,6 +3098,8 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc) } const auto &old_envs = dsn::utils::kv_map_to_string(app->envs, ',', '='); + + // Update envs of local memory. for (size_t idx = 0; idx < keys.size(); ++idx) { app->envs[keys[idx]] = values[idx]; } diff --git a/src/meta/test/server_state_test.cpp b/src/meta/test/server_state_test.cpp index dde43b1ee1..8ceebbbcff 100644 --- a/src/meta/test/server_state_test.cpp +++ b/src/meta/test/server_state_test.cpp @@ -118,7 +118,7 @@ class server_state_test ASSERT_EQ(dsn::ERR_OK, _ss->sync_apps_to_remote_storage()); } - std::shared_ptr get_app(const std::string &app_name) + std::shared_ptr get_app(const std::string &app_name) const { return _ss->get_app(app_name); } @@ -240,14 +240,19 @@ void meta_service_test_app::app_envs_basic_test() fail::teardown(); \ } while (0) + // Failed to setting envs while table was not found. TEST_SET_APP_ENVS_FAILED(not_found, ERR_APP_NOT_EXIST); + // Failed to setting envs while table was being dropped as the intermediate state. TEST_SET_APP_ENVS_FAILED(dropping, ERR_BUSY_DROPPING); + // The table was found dropped after the new envs have been persistent on the remote + // meta storage. TEST_SET_APP_ENVS_FAILED(dropped_after, ERR_APP_DROPPED); #undef TEST_SET_APP_ENVS_FAILED + // Normal case for setting envs. std::cout << "test server_state::set_app_envs()..." << std::endl; { configuration_update_app_env_request request;