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) {
});
if (has_slow)
- pending.push_back({dir + "/" + fname,file_ref});
+ pending.push_back({dir + "/" + fname, file_ref});
}
}
if (pending.empty()) {
}
}
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,
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;
}
// ===============================================
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;