This is an automated email from the ASF dual-hosted git repository.

philo-he pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 5bc4512674 [GLUTEN-13769][VL] Skip SSD cache file cleanup in tearDown 
when the cache is memory-only (#13770)
5bc4512674 is described below

commit 5bc4512674922d154ec72bf1251dd5f5f85b5da9
Author: YangJie <[email protected]>
AuthorDate: Wed Nov 25 02:29:11 2026 -0500

    [GLUTEN-13769][VL] Skip SSD cache file cleanup in tearDown when the cache 
is memory-only (#13770)
---
 cpp/bolt/compute/BoltBackend.cc     | 11 +++++++----
 cpp/velox/compute/VeloxBackend.cc   | 11 +++++++----
 cpp/velox/tests/VeloxBackendTest.cc |  8 ++++++++
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/cpp/bolt/compute/BoltBackend.cc b/cpp/bolt/compute/BoltBackend.cc
index 712ea1ca61..ec39b1b102 100644
--- a/cpp/bolt/compute/BoltBackend.cc
+++ b/cpp/bolt/compute/BoltBackend.cc
@@ -500,10 +500,13 @@ void BoltBackend::tearDown() {
   // dump cache stats on exit if enabled
   if 
(dynamic_cast<bytedance::bolt::cache::AsyncDataCache*>(asyncDataCache_.get())) {
     LOG(INFO) << asyncDataCache_->toString();
-    for (const auto& entry : 
std::filesystem::directory_iterator(cachePathPrefix_)) {
-      if (entry.path().filename().string().find(cacheFilePrefix_) != 
std::string::npos) {
-        LOG(INFO) << "Removing cache file " << 
entry.path().filename().string();
-        std::filesystem::remove(cachePathPrefix_ + "/" + 
entry.path().filename().string());
+    // cachePathPrefix_ is only set when the SSD cache is enabled.
+    if (!cachePathPrefix_.empty()) {
+      for (const auto& entry : 
std::filesystem::directory_iterator(cachePathPrefix_)) {
+        if (entry.path().filename().string().find(cacheFilePrefix_) != 
std::string::npos) {
+          LOG(INFO) << "Removing cache file " << 
entry.path().filename().string();
+          std::filesystem::remove(cachePathPrefix_ + "/" + 
entry.path().filename().string());
+        }
       }
     }
     asyncDataCache_->shutdown();
diff --git a/cpp/velox/compute/VeloxBackend.cc 
b/cpp/velox/compute/VeloxBackend.cc
index 6ad6459892..53573918bd 100644
--- a/cpp/velox/compute/VeloxBackend.cc
+++ b/cpp/velox/compute/VeloxBackend.cc
@@ -512,10 +512,13 @@ void VeloxBackend::tearDown() {
   // dump cache stats on exit if enabled
   if 
(dynamic_cast<facebook::velox::cache::AsyncDataCache*>(asyncDataCache_.get())) {
     LOG(INFO) << asyncDataCache_->toString();
-    for (const auto& entry : 
std::filesystem::directory_iterator(cachePathPrefix_)) {
-      if (entry.path().filename().string().find(cacheFilePrefix_) != 
std::string::npos) {
-        LOG(INFO) << "Removing cache file " << 
entry.path().filename().string();
-        std::filesystem::remove(cachePathPrefix_ + "/" + 
entry.path().filename().string());
+    // cachePathPrefix_ is only set when the SSD cache is enabled.
+    if (!cachePathPrefix_.empty()) {
+      for (const auto& entry : 
std::filesystem::directory_iterator(cachePathPrefix_)) {
+        if (entry.path().filename().string().find(cacheFilePrefix_) != 
std::string::npos) {
+          LOG(INFO) << "Removing cache file " << 
entry.path().filename().string();
+          std::filesystem::remove(cachePathPrefix_ + "/" + 
entry.path().filename().string());
+        }
       }
     }
     asyncDataCache_->shutdown();
diff --git a/cpp/velox/tests/VeloxBackendTest.cc 
b/cpp/velox/tests/VeloxBackendTest.cc
index 5a6686ca61..b11905f985 100644
--- a/cpp/velox/tests/VeloxBackendTest.cc
+++ b/cpp/velox/tests/VeloxBackendTest.cc
@@ -74,4 +74,12 @@ INSTANTIATE_TEST_SUITE_P(
         BroadcastBuildThreadsTestParam{0, 4, 4},
         BroadcastBuildThreadsTestParam{8, 4, 4}));
 
+TEST(VeloxBackendCacheTest, tearDownWithMemoryOnlyCache) {
+  // ssdCacheSize 0 enables the memory-only AsyncDataCache, which leaves no 
SSD cache directory to clean up.
+  std::unordered_map<std::string, std::string> conf{
+      {kVeloxCacheEnabled, "true"}, {kVeloxMemCacheSize, std::to_string(64 << 
20)}, {kVeloxSsdCacheSize, "0"}};
+  VeloxBackend::create(AllocationListener::noop(), conf);
+  EXPECT_NO_THROW(VeloxBackend::get()->tearDown());
+}
+
 } // namespace gluten


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to