Skip to content

Commit

Permalink
fix storage exit crash
Browse files Browse the repository at this point in the history
  • Loading branch information
cangfengzhs committed Dec 23, 2021
1 parent 1c55df4 commit 46dcfa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,6 @@ bool MetaClient::loadData() {
}

localDataLastUpdateTime_.store(metadLastUpdateTime_.load());

diff(oldCache, localCache_);
listenerDiff(oldCache, localCache_);
loadRemoteListeners();

auto newMetaData = new MetaData();

folly::RWSpinLock::ReadHolder holder(localCacheLock_);
Expand Down Expand Up @@ -335,6 +330,9 @@ bool MetaClient::loadData() {
auto oldMetaData = metadata_.load();
metadata_.store(newMetaData);
folly::rcu_retire(oldMetaData);
diff(oldCache, localCache_);
listenerDiff(oldCache, localCache_);
loadRemoteListeners();
ready_ = true;
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/storage/test/ChainTestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ class MetaClientTestUpdater {
static void addLocalCache(meta::MetaClient& mClient,
GraphSpaceID spaceId,
std::shared_ptr<meta::SpaceInfoCache> spInfoCache) {
mClient.localCache_[spaceId] = spInfoCache;
mClient.metadata_.load()->localCache_[spaceId] = spInfoCache;
}

static meta::SpaceInfoCache* getLocalCache(meta::MetaClient* mClient, GraphSpaceID spaceId) {
if (mClient->localCache_.count(spaceId) == 0) {
if (mClient->metadata_.load()->localCache_.count(spaceId) == 0) {
return nullptr;
}
return mClient->localCache_[spaceId].get();
return mClient->metadata_.load()->localCache_[spaceId].get();
}

static void addPartTerm(meta::MetaClient* mClient,
Expand Down

0 comments on commit 46dcfa5

Please sign in to comment.