-
Notifications
You must be signed in to change notification settings - Fork 58
Conversation
} | ||
|
||
if (err == ERR_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
if (err == ERR_OK) { | |
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L752-L759 will always be executed, you can see comments in L751
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no comment:
rdsn/src/dist/replication/lib/replica_split.cpp
Lines 749 to 755 in 14210e2
// ThreadPool: THREAD_POOL_REPLICATION | |
void replica::child_partition_active(const partition_configuration &config) // on child | |
{ | |
ddebug_replica("child partition become active"); | |
_primary_states.last_prepare_decree_on_new_primary = _prepare_list->max_decree(); | |
update_configuration(config); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line number changed after I wrote this comment.
rdsn/src/dist/replication/lib/replica_split.cpp
Lines 737 to 738 in 14210e2
// parent register child succeed or child partition has already resgitered | |
// in both situation, we should reset resgiter child task and child_gpid |
const std::string &partition_path = _state->get_partition_path(request.child_config.pid); | ||
blob value = dsn::json::json_forwarder<partition_configuration>::encode(request.child_config); | ||
if (create_new) { | ||
return _meta_svc->get_remote_storage()->create_node( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use get_meta_storage()
instead, which can auto-repeat on timeout, and assert on unexpected error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use get_meta_storage()
, but I should handle ERR_TIMEOUT
and ERR_NODE_ALREADY_EXIST
specifically in callback function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I will later write a utility of meta_storage for this case.
register_child_rpc rpc(std::move(request), RPC_CM_REGISTER_CHILD_REPLICA); | ||
split_svc().register_child_on_meta(rpc); | ||
wait_all(); | ||
if (wait_zk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's wait_zk
used for? wait_all
supposed to wait any tasks to complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait_all
function will wait meta_service tasks, zk tasks are not included. The simple way is to sleep for several seconds to wait updating zk succeed.
@@ -369,6 +370,8 @@ void replica::update_configuration_on_meta_server(config_type::type type, | |||
""); | |||
dassert( | |||
newConfig.primary == node, "%s VS %s", newConfig.primary.to_string(), node.to_string()); | |||
} else if (type == config_type::CT_REGISTER_CHILD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me describe this code in pseudocode:
If the type is not
CT_PRIMARY_FORCE_UPDATE_BALLOT
, then it cannot beCT_REGISTER_CHILD
.
What does it suppose to mean? Can you add a comment here? Is that CT_REGISTER_CHILD
is impossible, or not-CT_PRIMARY_FORCE_UPDATE_BALLOT && CT_REGISTER_CHILD
is impossible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no relationship between CT_PRIMARY_FORCE_UPDATE_BALLOT
and CT_REGISTER_CHILD
. I have updated the code.
} | ||
|
||
if (err == ERR_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no comment:
rdsn/src/dist/replication/lib/replica_split.cpp
Lines 749 to 755 in 14210e2
// ThreadPool: THREAD_POOL_REPLICATION | |
void replica::child_partition_active(const partition_configuration &config) // on child | |
{ | |
ddebug_replica("child partition become active"); | |
_primary_states.last_prepare_decree_on_new_primary = _prepare_list->max_decree(); | |
update_configuration(config); | |
} |
const std::string &partition_path = _state->get_partition_path(request.child_config.pid); | ||
blob value = dsn::json::json_forwarder<partition_configuration>::encode(request.child_config); | ||
if (create_new) { | ||
return _meta_svc->get_remote_storage()->create_node( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I will later write a utility of meta_storage for this case.
Simple partition split process
More partition split discussion in issue #69 and partition split design doc
This pr solves the part of fifth step of partition split, which is bold in process description.
What this pr solved
replica::register_child_on_meta
: primary parent register child partition on meta_server and parent will reject read write client.meta_split_service::register_child_on_meta
: meta server update child partition_configuration structure on remote storage and local.child_partition_active
: when child registered, child of primary parent will be the primary of the child replica group, its status will turn fromPS_PARTITION_SPLIT
toPS_PRIMARY
, child of secondary will update its status by group_check.