diff --git a/src/meta/processors/admin/AdminClient.cpp b/src/meta/processors/admin/AdminClient.cpp index 0da7be80e..181e29502 100644 --- a/src/meta/processors/admin/AdminClient.cpp +++ b/src/meta/processors/admin/AdminClient.cpp @@ -36,6 +36,10 @@ folly::Future AdminClient::transLeader(GraphSpaceID spaceId, if (it == peers.end()) { return Status::PartNotFound(); } + if (peers.size() == 1 && peers.front() == leader) { + // if there is only one replica, skip transfer leader phase + return Status::OK(); + } auto target = dst; if (dst == kRandomPeer) { for (auto& p : peers) { diff --git a/src/meta/processors/admin/Balancer.cpp b/src/meta/processors/admin/Balancer.cpp index 94b7c8e78..bee329817 100644 --- a/src/meta/processors/admin/Balancer.cpp +++ b/src/meta/processors/admin/Balancer.cpp @@ -174,7 +174,8 @@ nebula::cpp2::ErrorCode Balancer::recovery() { return recRet; } } - return nebula::cpp2::ErrorCode::SUCCEEDED; + // save the balance plan again because FAILED tasks would be marked as IN_PROGRESS again + return plan_->saveInStore(); } nebula::cpp2::ErrorCode @@ -303,10 +304,6 @@ Balancer::genTasks(GraphSpaceID spaceId, } } - if (confirmedHostParts.size() < 2) { - LOG(INFO) << "Too few hosts, no need for balance!"; - return nebula::cpp2::ErrorCode::E_NO_VALID_HOST; - } // 2. Make all hosts in confirmedHostParts balanced if (balanceParts(plan_->id_, spaceId, confirmedHostParts, totalParts, tasks)) { return tasks; diff --git a/src/meta/processors/partsMan/ListHostsProcessor.cpp b/src/meta/processors/partsMan/ListHostsProcessor.cpp index 82bcc792c..dc0d3ccd6 100644 --- a/src/meta/processors/partsMan/ListHostsProcessor.cpp +++ b/src/meta/processors/partsMan/ListHostsProcessor.cpp @@ -200,7 +200,7 @@ nebula::cpp2::ErrorCode ListHostsProcessor::fillLeaders() { } auto it = std::find(activeHosts.begin(), activeHosts.end(), host); if (it == activeHosts.end()) { - LOG(INFO) << "skip inactive host: " << host; + VLOG(1) << "skip inactive host: " << host; continue; // skip inactive host } @@ -209,7 +209,7 @@ nebula::cpp2::ErrorCode ListHostsProcessor::fillLeaders() { }); if (hostIt == hostItems_.end()) { - LOG(INFO) << "skip inactive host"; + VLOG(1) << "skip inactive host"; continue; } diff --git a/src/storage/StorageFlags.cpp b/src/storage/StorageFlags.cpp index d37191251..b1aacb080 100644 --- a/src/storage/StorageFlags.cpp +++ b/src/storage/StorageFlags.cpp @@ -15,7 +15,7 @@ DEFINE_int32(waiting_catch_up_retry_times, 30, "retry times when waiting for cat DEFINE_int32(waiting_catch_up_interval_in_secs, 30, "interval between two requests for catching up state"); -DEFINE_int32(waiting_new_leader_retry_times, 30, "retry times when waiting for catching up data"); +DEFINE_int32(waiting_new_leader_retry_times, 5, "retry times when waiting for new leader"); DEFINE_int32(waiting_new_leader_interval_in_secs, 5, "interval between two requests for catching up state");