X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Frocksdb%2Ffile%2Fdelete_scheduler.h;h=b2d17a73e12dbe524dbec69fb1bfe6db1d1591f7;hb=20effc670b57271cb089376d6d0800990e5218d5;hp=60948480af9ab7b38031f2e43f295a1af7a47d04;hpb=a71831dadd1e1f3e0fa70405511f65cc33db0498;p=ceph.git diff --git a/ceph/src/rocksdb/file/delete_scheduler.h b/ceph/src/rocksdb/file/delete_scheduler.h index 60948480a..b2d17a73e 100644 --- a/ceph/src/rocksdb/file/delete_scheduler.h +++ b/ceph/src/rocksdb/file/delete_scheduler.h @@ -45,6 +45,7 @@ class DeleteScheduler { // Set delete rate limit in bytes per second void SetRateBytesPerSecond(int64_t bytes_per_sec) { rate_bytes_per_sec_.store(bytes_per_sec); + MaybeCreateBackgroundThread(); } // Mark file as trash directory and schedule it's deletion. If force_bg is @@ -82,6 +83,11 @@ class DeleteScheduler { static Status CleanupDirectory(Env* env, SstFileManagerImpl* sfm, const std::string& path); + void SetStatisticsPtr(const std::shared_ptr& stats) { + InstrumentedMutexLock l(&mu_); + stats_ = stats; + } + private: Status MarkAsTrash(const std::string& file_path, std::string* path_in_trash); @@ -91,6 +97,8 @@ class DeleteScheduler { void BackgroundEmptyTrash(); + void MaybeCreateBackgroundThread(); + Env* env_; FileSystem* fs_; @@ -98,7 +106,7 @@ class DeleteScheduler { std::atomic total_trash_size_; // Maximum number of bytes that should be deleted per second std::atomic rate_bytes_per_sec_; - // Mutex to protect queue_, pending_files_, bg_errors_, closing_ + // Mutex to protect queue_, pending_files_, bg_errors_, closing_, stats_ InstrumentedMutex mu_; struct FileAndDir { @@ -134,6 +142,7 @@ class DeleteScheduler { // immediately std::atomic max_trash_db_ratio_; static const uint64_t kMicrosInSecond = 1000 * 1000LL; + std::shared_ptr stats_; }; } // namespace ROCKSDB_NAMESPACE