]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Avoid migrating active files during spillover cleaning 70217/head
authorJaya Prakash <jayaprakash@ibm.com>
Wed, 15 Jul 2026 14:00:44 +0000 (14:00 +0000)
committerJaya Prakash <jayaprakash@ibm.com>
Wed, 15 Jul 2026 14:28:58 +0000 (14:28 +0000)
Fixes: https://tracker.ceph.com/issues/78234
Signed-off-by: Jaya Prakash <jayaprakash@ibm.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 748253416ffc1782592eeb2493b12c30b380704c..63abf519de9726208c9fe4259450c95913a684db 100644 (file)
@@ -5580,7 +5580,9 @@ void *BlueFS::SpilloverCleanerThread::entry() {
 BlueFS::SpillOverCleanerAction BlueFS::RebalanceToDB::advance(BlueFS *fs)
 {
   if (idx >= pending.size()) {
+    last_scan_time = ceph_clock_now();
     pending.clear();
+    skipped.clear();
     idx = 0;
     std::unique_lock nl(fs->nodes.lock);
     for (auto& [dir, dir_ref] : fs->nodes.dir_map) {
@@ -5597,7 +5599,7 @@ BlueFS::SpillOverCleanerAction BlueFS::RebalanceToDB::advance(BlueFS *fs)
           });
 
         if (has_slow)
-          pending.push_back({dir + "/" + fname,file_ref});
+          pending.push_back({dir + "/" + fname, file_ref});
       }
     }
     if (pending.empty()) {
@@ -5605,6 +5607,13 @@ BlueFS::SpillOverCleanerAction BlueFS::RebalanceToDB::advance(BlueFS *fs)
     }
   }
   auto& [path, file] = pending[idx++];
+  int writers = file->num_writers.load(std::memory_order_relaxed);
+  // MANIFEST is excluded from this check because
+  // RocksDB keeps a writer open to it permanently.
+  if (writers > 0 && !path.ends_with("/MANIFEST")) {
+    skipped.push_back({path, writers});
+    return SpillOverCleanerAction::CONTINUE;
+  }
   int r = fs->migrate_file(
     fs->cct,
     file,
@@ -5669,6 +5678,15 @@ void BlueFS::RebalanceToDB::dump_plan(Formatter* f)
     f->dump_string("file", path);
   }
   f->close_section();
+  f->open_array_section("active_files");
+  for (const auto& [path, writers] : skipped) {
+    f->dump_string(
+      "file",
+      path + " num_writers=" + std::to_string(writers));
+  }
+  f->close_section();
+  f->dump_stream("last_scan_time")
+    << last_scan_time;
 }
 
 // ===============================================
index eebd70a0ba0acf36191da2f92afdc90f536e7552..7c6b15737bb62a846d838b595424fc2bdf6e7a26 100644 (file)
@@ -1086,6 +1086,8 @@ private:
 
   struct RebalanceToDB : public SpilloverCleanerLogic {
     std::vector<std::pair<std::string, FileRef>> pending;
+    std::vector<std::pair<std::string, int>> skipped;
+    utime_t last_scan_time;
     std::deque<std::string> history;
     static constexpr size_t max_history = 100;
     size_t idx = 0;