Skip to content

Commit

Permalink
feat(split): add child partition check during config_sync (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong authored Mar 18, 2021
1 parent 53c8c63 commit 1405483
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/replica/replica_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,11 @@ void replica_stub::get_local_replicas(std::vector<replica_info> &replicas)

for (auto &pairs : _replicas) {
replica_ptr &rep = pairs.second;
// child partition should not sync config from meta server
// because it is not ready in meta view
if (rep->status() == partition_status::PS_PARTITION_SPLIT) {
continue;
}
replica_info info;
get_replica_info(info, rep);
replicas.push_back(std::move(info));
Expand Down Expand Up @@ -1479,7 +1484,8 @@ void replica_stub::on_node_query_reply_scatter(replica_stub_ptr this_,
void replica_stub::on_node_query_reply_scatter2(replica_stub_ptr this_, gpid id)
{
replica_ptr replica = get_replica(id);
if (replica != nullptr && replica->status() != partition_status::PS_POTENTIAL_SECONDARY) {
if (replica != nullptr && replica->status() != partition_status::PS_POTENTIAL_SECONDARY &&
replica->status() != partition_status::PS_PARTITION_SPLIT) {
if (replica->status() == partition_status::PS_INACTIVE &&
dsn_now_ms() - replica->create_time_milliseconds() <
_options.gc_memory_replica_interval_ms) {
Expand Down Expand Up @@ -2637,7 +2643,7 @@ void replica_stub::create_child_replica(rpc_address primary_address,
{
replica_ptr child_replica = create_child_replica_if_not_found(child_gpid, &app, parent_dir);
if (child_replica != nullptr) {
ddebug_f("create child replica ({}) succeed", child_gpid);
ddebug_f("app({}), create child replica ({}) succeed", app.app_name, child_gpid);
tasking::enqueue(LPC_PARTITION_SPLIT,
child_replica->tracker(),
std::bind(&replica_split_manager::child_init_replica,
Expand Down

0 comments on commit 1405483

Please sign in to comment.