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 29, 2021
1 parent 9b7a58a commit cbc618f
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 @@ -305,11 +305,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 @@ -340,6 +335,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 @@ -193,14 +193,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 cbc618f

Please sign in to comment.