From db287c99773d9c3ed50cc1465be4beccbbb1b616 Mon Sep 17 00:00:00 2001 From: Zac Wen Date: Mon, 17 Jun 2024 23:31:31 -0700 Subject: [PATCH] Fix cache shutdown order (#10239) Summary: Currently, ssd cache shutdown happens after shard shutdown where entries are cleared. If there is any pending write, the ssd write will fail as the entry no longer exists. Therefore, the shutdown order needs to be reversed. Pull Request resolved: https://github.com/facebookincubator/velox/pull/10239 Reviewed By: xiaoxmeng Differential Revision: D58709223 Pulled By: zacw7 fbshipit-source-id: 56e61db69b08743004a99c93fd84006e5772cd63 --- velox/common/caching/AsyncDataCache.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/velox/common/caching/AsyncDataCache.cpp b/velox/common/caching/AsyncDataCache.cpp index 91ad77a90df4..5d739aec5843 100644 --- a/velox/common/caching/AsyncDataCache.cpp +++ b/velox/common/caching/AsyncDataCache.cpp @@ -676,12 +676,12 @@ AsyncDataCache** AsyncDataCache::getInstancePtr() { } void AsyncDataCache::shutdown() { - for (auto& shard : shards_) { - shard->shutdown(); - } if (ssdCache_) { ssdCache_->shutdown(); } + for (auto& shard : shards_) { + shard->shutdown(); + } } void CacheShard::shutdown() {