Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize ReadHolder in MetaClient::getStorageLeaderFromCache #4264

Closed
HarrisChu opened this issue May 18, 2022 · 0 comments
Closed

optimize ReadHolder in MetaClient::getStorageLeaderFromCache #4264

HarrisChu opened this issue May 18, 2022 · 0 comments
Assignees
Labels
type/enhancement Type: make the code neat or more efficient
Milestone

Comments

@HarrisChu
Copy link
Contributor

StatusOr<HostAddr> MetaClient::getStorageLeaderFromCache(GraphSpaceID spaceId, PartitionID partId) {
  if (!ready_) {
    return Status::Error("Not ready!");
  }

  {
    folly::RWSpinLock::ReadHolder holder(leadersLock_);
    auto iter = leadersInfo_.leaderMap_.find({spaceId, partId});
    if (iter != leadersInfo_.leaderMap_.end()) {
      return iter->second;
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants