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

remove_deprecated__host_node #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion idl/meta_admin.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct configuration_update_request
2:dsn.layer2.partition_configuration config;
3:config_type type = config_type.CT_INVALID;
4:dsn.rpc_address node;
5:dsn.rpc_address host_node; // deprecated, only used by stateless apps
5:dsn.rpc_address deprecated__host_node; // deprecated, only used by stateless apps

// Used for partition split
// if replica is splitting (whose split_status is not NOT_SPLIT)
Expand Down
51 changes: 26 additions & 25 deletions src/meta/server_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)

response.partitions[i].info = *app;
response.partitions[i].config = app->partitions[pid.get_partition_index()];
response.partitions[i].host_node = request.node;
// response.partitions[i].host_node = request.node;
// set meta_split_status
const split_state &app_split_states = app->helpers->split_states;
if (app->splitting()) {
Expand Down Expand Up @@ -1567,27 +1567,27 @@ void server_state::update_configuration_locally(
} else {
CHECK_EQ(old_cfg.ballot, new_cfg.ballot);

new_cfg = old_cfg;
partition_configuration_stateless pcs(new_cfg);
if (config_request->type == config_type::type::CT_ADD_SECONDARY) {
pcs.hosts().emplace_back(config_request->host_node);
pcs.workers().emplace_back(config_request->node);
} else {
auto it =
std::remove(pcs.hosts().begin(), pcs.hosts().end(), config_request->host_node);
pcs.hosts().erase(it);

it = std::remove(pcs.workers().begin(), pcs.workers().end(), config_request->node);
pcs.workers().erase(it);
}

auto it = _nodes.find(config_request->host_node);
CHECK(it != _nodes.end(), "invalid node address, address = {}", config_request->host_node);
if (config_type::CT_REMOVE == config_request->type) {
it->second.remove_partition(gpid, false);
} else {
it->second.put_partition(gpid, false);
}
// new_cfg = old_cfg;
// partition_configuration_stateless pcs(new_cfg);
// if (config_request->type == config_type::type::CT_ADD_SECONDARY) {
// pcs.hosts().emplace_back(config_request->host_node);
// pcs.workers().emplace_back(config_request->node);
// } else {
// auto it =
// std::remove(pcs.hosts().begin(), pcs.hosts().end(), config_request->host_node);
// pcs.hosts().erase(it);
//
// it = std::remove(pcs.workers().begin(), pcs.workers().end(), config_request->node);
// pcs.workers().erase(it);
// }
//
// auto it = _nodes.find(config_request->host_node);
// CHECK(it != _nodes.end(), "invalid node address, address = {}", config_request->host_node);
// if (config_type::CT_REMOVE == config_request->type) {
// it->second.remove_partition(gpid, false);
// } else {
// it->second.put_partition(gpid, false);
// }
}

// we assume config in config_request stores the proper new config
Expand Down Expand Up @@ -1860,6 +1860,7 @@ void server_state::downgrade_secondary_to_inactive(std::shared_ptr<app_state> &a
}
}

// TODO: remove the function totally?
void server_state::downgrade_stateless_nodes(std::shared_ptr<app_state> &app,
int pidx,
const rpc_address &address)
Expand All @@ -1868,7 +1869,7 @@ void server_state::downgrade_stateless_nodes(std::shared_ptr<app_state> &app,
std::make_shared<configuration_update_request>();
req->info = *app;
req->type = config_type::CT_REMOVE;
req->host_node = address;
// req->host_node = address;
req->node.set_invalid();
req->config = app->partitions[pidx];

Expand All @@ -1893,10 +1894,10 @@ void server_state::downgrade_stateless_nodes(std::shared_ptr<app_state> &app,

if (config_status::pending_remote_sync == cc.stage) {
LOG_WARNING("gpid(%d.%d) is syncing another request with remote, cancel it due to meta is "
"removing host(%s) worker(%s)",
"removing host() worker(%s)",
pc.pid.get_app_id(),
pc.pid.get_partition_index(),
req->host_node.to_string(),
// req->host_node.to_string(),
req->node.to_string());
cc.cancel_sync();
}
Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/meta_partition_guardian_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ void meta_partition_guardian_test::cure()
fake_request.config = the_app->partitions[i];
fake_request.type = action.type;
fake_request.node = action.node;
fake_request.host_node = action.node;
// fake_request.host_node = action.node;

guardian.reconfig({&app, &nodes}, fake_request);
check_nodes_loads(nodes);
Expand Down