From: Jaya Prakash Date: Wed, 15 Jul 2026 14:00:44 +0000 (+0000) Subject: os/bluestore: Avoid migrating active files during spillover cleaning X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de7c5598f8ebda09fcaa5a78f53533ac67f29fd6;p=ceph.git os/bluestore: Avoid migrating active files during spillover cleaning Fixes: https://tracker.ceph.com/issues/78234 Signed-off-by: Jaya Prakash --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 748253416ff..63abf519de9 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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; } // =============================================== diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index eebd70a0ba0..7c6b15737bb 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -1086,6 +1086,8 @@ private: struct RebalanceToDB : public SpilloverCleanerLogic { std::vector> pending; + std::vector> skipped; + utime_t last_scan_time; std::deque history; static constexpr size_t max_history = 100; size_t idx = 0;