Skip to content

Commit

Permalink
Fix lm leader change (vesoft-inc#2791)
Browse files Browse the repository at this point in the history
* Fix lm

* Fix lm
  • Loading branch information
Aiee authored May 23, 2023
1 parent e975ec0 commit 22ff7f5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/common/encryption/LicenseManagerConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Status LicenseManagerConnector::init(const std::string& LmUrl,
bgThread_->addTask(&LicenseManagerConnector::threadFunc, this);

LOG(INFO) << "[License Manager] Initialization succeeded, LMId: " << LMId_;
readFromCache_ = false;
return Status::OK();
}

Expand Down Expand Up @@ -282,7 +283,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::string> LicenseManagerConnector::buildRawR
for (auto& host : nebula::value(res)) {
queryCPU += host.cpuNum_;
}
VLOG(2) << "[License Manager] Total query node number: " << queryNode
VLOG(2) << "[License Manager] Total registered query node number: " << queryNode
<< ", query CPU cores: " << queryCPU;

// Get active storage hosts
Expand All @@ -297,7 +298,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::string> LicenseManagerConnector::buildRawR
for (auto& host : nebula::value(res)) {
storageCPU += host.cpuNum_;
}
VLOG(2) << "[License Manager] Total storage node number: " << storageNode
VLOG(2) << "[License Manager] Total registered storage node number: " << storageNode
<< ", storage CPU cores: " << storageCPU;

folly::dynamic request = folly::dynamic::object();
Expand Down
4 changes: 3 additions & 1 deletion src/common/encryption/LicenseManagerConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ class LicenseManagerConnector final {
// If the LMC is not ready, all heartbeat will be rejected
bool dropAllHosts_ = false;
bool isOverLimit_ = false;
bool readFromCache_ = false;

// Follower will read cache by default, this flag will be updated if connect to LM successfully
bool readFromCache_ = true;
};

} // namespace nebula
6 changes: 3 additions & 3 deletions src/meta/processors/admin/HBProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ nebula::cpp2::ErrorCode HBProcessor::checkResourceUsage(const cpp2::HostRole rol
: LMCIns->resourceQuota_.storageQuota_;

auto resourceType = LMCIns->resourceQuota_.type_;
DLOG(INFO) << "[License Manager] Resource type: " << resourceType
<< ", query resource cap: " << LMCIns->resourceQuota_.graphQuota_
<< ", storage resource cap: " << LMCIns->resourceQuota_.storageQuota_;
LOG(INFO) << "[License Manager] Resource type: " << resourceType
<< ", query quota cap: " << LMCIns->resourceQuota_.graphQuota_
<< ", storage quota cap: " << LMCIns->resourceQuota_.storageQuota_;

if (resourceType == "CPU") {
return checkNodeCpu(role, host, cpuNum, resourceCap, isHostRegistered, needUpdate);
Expand Down

0 comments on commit 22ff7f5

Please sign in to comment.