Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
fix balance thread hang up (#502)
Browse files Browse the repository at this point in the history
* fix balance thread hang up

* alignment

* fix build error

Co-authored-by: yaphet <[email protected]>
  • Loading branch information
critical27 and darionyaphet authored Jun 23, 2021
1 parent e09b981 commit 1a72b5f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/kvstore/wal/FileBasedWal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void FileBasedWal::closeCurrFile() {
timebuf.modtime = currInfo_->mtime();
timebuf.actime = currInfo_->mtime();
VLOG(1) << "Close cur file " << currInfo_->path() << ", mtime: " << currInfo_->mtime();
CHECK_EQ(utime(currInfo_->path(), &timebuf), 0);
utime(currInfo_->path(), &timebuf);
currInfo_.reset();
}

Expand Down
22 changes: 10 additions & 12 deletions src/meta/processors/admin/AdminClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,21 @@ folly::Future<Status> AdminClient::updateMeta(GraphSpaceID spaceId,
peers.emplace_back(dst);
}

auto partRet = kv_->part(kDefaultSpaceId, kDefaultPartId);
CHECK(ok(partRet));
auto part = nebula::value(partRet);

folly::Promise<Status> pro;
auto f = pro.getFuture();
std::vector<kvstore::KV> data;
data.emplace_back(MetaServiceUtils::partKey(spaceId, partId),
MetaServiceUtils::partVal(peers));
part->asyncMultiPut(
std::move(data), [p = std::move(pro)](nebula::cpp2::ErrorCode code) mutable {
if (code == nebula::cpp2::ErrorCode::SUCCEEDED) {
p.setValue(Status::OK());
} else {
p.setValue(Status::Error("Access kv failed, code: %s",
apache::thrift::util::enumNameSafe(code).c_str()));
}
kv_->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data),
[this, p = std::move(pro)] (nebula::cpp2::ErrorCode code) mutable {
folly::via(ioThreadPool_.get(), [code, p = std::move(p)]() mutable {
if (code == nebula::cpp2::ErrorCode::SUCCEEDED) {
p.setValue(Status::OK());
} else {
p.setValue(Status::Error("Access kv failed, code: %s",
apache::thrift::util::enumNameSafe(code).c_str()));
}
});
});
return f;
}
Expand Down
2 changes: 1 addition & 1 deletion src/meta/processors/admin/BalanceTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void BalanceTask::invoke() {
LOG(ERROR) << taskIdStr_ << " Update meta failed, status " << resp;
ret_ = BalanceTaskResult::FAILED;
} else {
LOG(INFO) << "Update meta succeeded!";
LOG(INFO) << taskIdStr_ << " Update meta succeeded!";
status_ = BalanceTaskStatus::REMOVE_PART_ON_SRC;
}
invoke();
Expand Down
4 changes: 2 additions & 2 deletions src/meta/processors/admin/HBProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void HBProcessor::process(const cpp2::HBReq& req) {
}
}

VLOG(3) << "Receive heartbeat from " << host
<< ", role = " << apache::thrift::util::enumNameSafe(req.get_role());
LOG(INFO) << "Receive heartbeat from " << host
<< ", role = " << apache::thrift::util::enumNameSafe(req.get_role());
if (req.get_role() == cpp2::HostRole::STORAGE) {
ClusterID peerCluserId = req.get_cluster_id();
if (peerCluserId == 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/meta/processors/partsMan/ListHostsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ nebula::cpp2::ErrorCode ListHostsProcessor::fillLeaders() {
std::vector<std::string> removeLeadersKey;
for (; iter->valid(); iter->next()) {
auto spaceIdAndPartId = MetaServiceUtils::parseLeaderKeyV3(iter->key());
LOG(INFO) << "show hosts: space = " << spaceIdAndPartId.first
<< ", part = " << spaceIdAndPartId.second;
VLOG(1) << "show hosts: space = " << spaceIdAndPartId.first
<< ", part = " << spaceIdAndPartId.second;
// If the space in the leader key don't exist, remove leader key
auto spaceId = spaceIdAndPartId.first;
auto spaceIter = spaceIdNameMap_.find(spaceId);
Expand Down

0 comments on commit 1a72b5f

Please sign in to comment.