]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/transaction_manager: set to test mode under debug build
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 30 May 2022 10:35:33 +0000 (18:35 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 31 May 2022 04:23:01 +0000 (12:23 +0800)
* force to test mode under debug build.
* make reclaim to happen and validated as early as possible.
* do not block user transaction when reclaim-ratio (unalive/unavailable)
  is high, especially in the beginning.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/segment_cleaner.h
src/crimson/os/seastore/transaction_manager.h
src/crimson/tools/store_nbd/tm_driver.cc

index 4440d14568ed25debaa65c132b0a496647f19141..2d0428e8f0bf1a41f102dbad8f9da8840f64a144 100644 (file)
@@ -1692,7 +1692,12 @@ seastar::future<std::unique_ptr<SeaStore>> make_seastore(
   return Device::make_device(
     device
   ).then([&device](DeviceRef device_obj) {
+#ifndef NDEBUG
+    auto tm = make_transaction_manager(
+        tm_make_config_t::get_test_segmented_journal());
+#else
     auto tm = make_transaction_manager(tm_make_config_t::get_default());
+#endif
     auto cm = std::make_unique<collection_manager::FlatCollectionManager>(*tm);
     return std::make_unique<SeaStore>(
       device,
index bbe629696d343aac75058922e8c03e659c79d594..9467bc75060940b24a319bd06ed1b852e7006de8 100644 (file)
@@ -488,8 +488,6 @@ public:
     /// Ratio of minimum available space to force reclaiming.
     double available_ratio_hard_limit = 0;
 
-    /// Ratio of maximum reclaimable space to block user transactions.
-    double reclaim_ratio_hard_limit = 0;
     /// Ratio of minimum reclaimable space to stop reclaiming.
     double reclaim_ratio_gc_threshold = 0;
 
@@ -505,7 +503,6 @@ public:
     void validate() const {
       ceph_assert(max_journal_segments > target_journal_segments);
       ceph_assert(available_ratio_gc_max > available_ratio_hard_limit);
-      ceph_assert(reclaim_ratio_hard_limit > reclaim_ratio_gc_threshold);
       ceph_assert(reclaim_bytes_per_cycle > 0);
       ceph_assert(rewrite_dirty_bytes_per_cycle > 0);
       ceph_assert(rewrite_backref_bytes_per_cycle > 0);
@@ -518,7 +515,6 @@ public:
          2,    // target_backref_inflight_segments
          .1,   // available_ratio_gc_max
          .05,  // available_ratio_hard_limit
-         .9,   // reclaim_ratio_hard_limit
          .1,   // reclaim_ratio_gc_threshold
          1<<20,// reclaim_bytes_per_cycle
          1<<17,// rewrite_dirty_bytes_per_cycle
@@ -531,9 +527,8 @@ public:
          2,    // target_journal_segments
          4,    // max_journal_segments
          2,    // target_backref_inflight_segments
-         .9  // available_ratio_gc_max
+         .99,  // available_ratio_gc_max
          .2,   // available_ratio_hard_limit
-         .8,   // reclaim_ratio_hard_limit
          .6,   // reclaim_ratio_gc_threshold
          1<<20,// reclaim_bytes_per_cycle
          1<<17,// rewrite_dirty_bytes_per_cycle
@@ -1205,12 +1200,7 @@ private:
       return false;
     }
     auto aratio = get_projected_available_ratio();
-    auto rratio = get_reclaim_ratio();
-    return (
-      (aratio < config.available_ratio_hard_limit) ||
-      ((aratio < config.available_ratio_gc_max) &&
-       (rratio > config.reclaim_ratio_hard_limit))
-    );
+    return aratio < config.available_ratio_hard_limit;
   }
 
   bool should_block_on_gc() const {
index 558fd37a63de6127e7299c77d79fc1108fed7478..a02b8bb21ddab0694e142a2d6e24f054243da0fd 100644 (file)
@@ -47,6 +47,8 @@ struct tm_make_config_t {
     };
   }
   static tm_make_config_t get_test_segmented_journal() {
+    LOG_PREFIX(get_test_segmented_journal);
+    SUBWARN(seastore_tm, "test mode enabled!");
     return tm_make_config_t {
       true,
       journal_type_t::SEGMENT_JOURNAL,
@@ -54,6 +56,8 @@ struct tm_make_config_t {
     };
   }
   static tm_make_config_t get_test_cb_journal() {
+    LOG_PREFIX(get_test_cb_journal);
+    SUBWARN(seastore_tm, "test mode enabled!");
     return tm_make_config_t {
       true,
       journal_type_t::CIRCULARBOUNDED_JOURNAL,
index a32471e148aedda894b68badebc7fa62790ebff3..3b7a37889301280dced6a601672f8ec54afc9f8d 100644 (file)
@@ -131,7 +131,12 @@ seastar::future<bufferlist> TMDriver::read(
 
 void TMDriver::init()
 {
+#ifndef NDEBUG
+  tm = make_transaction_manager(
+      tm_make_config_t::get_test_segmented_journal());
+#else
   tm = make_transaction_manager(tm_make_config_t::get_default());
+#endif
   tm->add_device(device.get(), true);
 }