]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: IO sequence exerciser enable ec optimisations 62223/head
authorAlex Ainscow <aainscow@uk.ibm.com>
Tue, 11 Mar 2025 11:03:06 +0000 (11:03 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 2 Apr 2025 22:34:08 +0000 (23:34 +0100)
The io sequencer has been written to primarily test the new EC code.  This commit
turns that flag on by default.  It also provides a flag to disable the new
optimizations, which we expect to drop in the future.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/common/io_exerciser/RadosIo.cc
src/common/io_exerciser/RadosIo.h
src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.cc
src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h

index cf0cc1163d448213b68a8b6780b0502a33b669c5..e411ddede4907dafc982861d349a0de22179b13f 100644 (file)
@@ -41,7 +41,7 @@ RadosIo::RadosIo(librados::Rados& rados, boost::asio::io_context& asio,
                  const std::string& pool, const std::string& oid,
                  const std::optional<std::vector<int>>& cached_shard_order,
                  uint64_t block_size, int seed, int threads, ceph::mutex& lock,
-                 ceph::condition_variable& cond)
+                 ceph::condition_variable& cond, bool ec_optimizations)
     : Model(oid, block_size),
       rados(rados),
       asio(asio),
@@ -58,6 +58,9 @@ RadosIo::RadosIo(librados::Rados& rados, boost::asio::io_context& asio,
   rc = rados.ioctx_create(pool.c_str(), io);
   ceph_assert(rc == 0);
   allow_ec_overwrites(true);
+  if (ec_optimizations) {
+    allow_ec_optimizations();
+  }
 }
 
 RadosIo::~RadosIo() {}
@@ -92,6 +95,17 @@ void RadosIo::allow_ec_overwrites(bool allow) {
   ceph_assert(rc == 0);
 }
 
+void RadosIo::allow_ec_optimizations()
+{
+  int rc;
+  bufferlist inbl, outbl;
+  std::string cmdstr =
+    "{\"prefix\": \"osd pool set\", \"pool\": \"" + pool + "\", \
+      \"var\": \"allow_ec_optimizations\", \"val\": \"true\"}";
+  rc = rados.mon_command(cmdstr, inbl, &outbl, nullptr);
+  ceph_assert(rc == 0);
+}
+
 template <int N>
 RadosIo::AsyncOpInfo<N>::AsyncOpInfo(const std::array<uint64_t, N>& offset,
                                      const std::array<uint64_t, N>& length)
index d72c941cdf4153afe1db32165ce3253e89b8e9bd..1837b75725ae0d56b69c1d3e0c19ddeb4b722f46 100644 (file)
@@ -42,11 +42,12 @@ class RadosIo : public Model {
           const std::string& pool, const std::string& oid,
           const std::optional<std::vector<int>>& cached_shard_order,
           uint64_t block_size, int seed, int threads, ceph::mutex& lock,
-          ceph::condition_variable& cond);
+          ceph::condition_variable& cond, bool ec_optimizations);
 
   ~RadosIo();
 
   void allow_ec_overwrites(bool allow);
+  void allow_ec_optimizations();
 
   template <int N>
   class AsyncOpInfo {
index 77049721af84dd5a096f197ba2422a8a87d28677..03949ff3c48e48b1c022dba834bf6ba519b6f3dc 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <boost/asio/io_context.hpp>
 #include <iostream>
-#include <map>
 #include <vector>
 
 #include "common/Formatter.h"
 #include "common/ceph_json.h"
 #include "common/debug.h"
 #include "common/dout.h"
+#include "common/split.h"
+#include "common/strtol.h" // for strict_iecstrtoll()
+#include "common/ceph_json.h"
+#include "common/Formatter.h"
+
 #include "common/io_exerciser/DataGenerator.h"
 #include "common/io_exerciser/EcIoSequence.h"
 #include "common/io_exerciser/IoOp.h"
@@ -21,9 +25,6 @@
 #include "common/json/BalancerStructures.h"
 #include "common/json/ConfigStructures.h"
 #include "common/json/OSDStructures.h"
-#include "common/split.h"
-#include "common/strtol.h"  // for strict_iecstrtoll()
-#include "erasure-code/ErasureCodePlugin.h"
 #include "fmt/format.h"
 #include "global/global_context.h"
 #include "global/global_init.h"
@@ -763,7 +764,8 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
     bool allow_pool_balancer,
     bool allow_pool_deep_scrubbing,
     bool allow_pool_scrubbing,
-    bool test_recovery)
+    bool test_recovery,
+    bool disable_pool_ec_optimizations)
     : ProgramOptionReader<std::string>(vm, "pool"),
       rados(rados),
       dry_run(dry_run),
@@ -772,6 +774,7 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
       allow_pool_deep_scrubbing(allow_pool_deep_scrubbing),
       allow_pool_scrubbing(allow_pool_scrubbing),
       test_recovery(test_recovery),
+      disable_pool_ec_optimizations(disable_pool_ec_optimizations),
       first_use(true),
       sep{cct, rng, vm, rados, dry_run, first_use} {
   if (isForced()) {
@@ -834,7 +837,8 @@ std::string ceph::io_sequence::tester::SelectErasurePool::create() {
 
   std::string pool_name;
   profile = sep.select();
-  pool_name = fmt::format("testpool-pr{}", profile->name);
+  pool_name = fmt::format("testpool-pr{}{}", profile->name,
+    disable_pool_ec_optimizations?"_no_ec_opt":"");
 
   ceph::messaging::osd::OSDECPoolCreateRequest pool_create_request{
       pool_name, "erasure", 8, 8, profile->name};
@@ -962,7 +966,7 @@ ceph::io_sequence::tester::TestObject::TestObject(
 
     exerciser_model = std::make_unique<ceph::io_exerciser::RadosIo>(
         rados, asio, pool, oid, cached_shard_order, sbs.select(), rng(),
-        threads, lock, cond);
+        threads, lock, cond, spo.get_allow_pool_ec_optimizations());
     dout(0) << "= " << oid << " pool=" << pool << " threads=" << threads
             << " blocksize=" << exerciser_model->get_block_size() << " ="
             << dendl;
@@ -1054,7 +1058,8 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
           vm.contains("allow_pool_balancer"),
           vm.contains("allow_pool_deep_scrubbing"),
           vm.contains("allow_pool_scrubbing"),
-          vm.contains("test_recovery")},
+          vm.contains("test_recovery"),
+          vm.contains("disable_pool_ec_optimizations")},
       snt{rng, vm, "threads", true},
       ssr{vm} {
   dout(0) << "Test using seed " << seed << dendl;
@@ -1075,6 +1080,7 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
   allow_pool_balancer = vm.contains("allow_pool_balancer");
   allow_pool_deep_scrubbing = vm.contains("allow_pool_deep_scrubbing");
   allow_pool_scrubbing = vm.contains("allow_pool_scrubbing");
+  disable_pool_ec_optimizations = vm.contains("disable_pool_ec_optimizations");
 
   if (!dryrun) {
     guard.emplace(boost::asio::make_work_guard(asio));
@@ -1229,7 +1235,8 @@ bool ceph::io_sequence::tester::TestRunner::run_interactive_test() {
     model = std::make_unique<ceph::io_exerciser::RadosIo>(
         rados, asio, pool, object_name, osd_map_reply.acting, sbs.select(), rng(),
         1,  // 1 thread
-        lock, cond);
+        lock, cond,
+        spo.get_allow_pool_ec_optimizations());
   }
 
   while (!done) {
index eeb3abb6cedd13fb8113c116fdc81d5dcde06e1a..16fe6d7b778d1bbae798ee5b3b4b9728ffc8bf18 100644 (file)
@@ -388,7 +388,8 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
                     bool allow_pool_balancer,
                     bool allow_pool_deep_scrubbing,
                     bool allow_pool_scrubbing,
-                    bool test_recovery);
+                    bool test_recovery,
+                    bool disable_pool_ec_optimizations);
   const std::string select() override;
   std::string create();
   void configureServices(bool allow_pool_autoscaling,
@@ -403,7 +404,9 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
     return allow_pool_deep_scrubbing;
   }
   inline bool get_allow_pool_scrubbing() { return allow_pool_scrubbing; }
-
+  inline bool get_allow_pool_ec_optimizations() {
+    return !disable_pool_ec_optimizations;
+  }
   inline std::optional<Profile> getProfile() { return profile; }
 
  private:
@@ -415,6 +418,7 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
   bool allow_pool_deep_scrubbing;
   bool allow_pool_scrubbing;
   bool test_recovery;
+  bool disable_pool_ec_optimizations;
 
   bool first_use;
 
@@ -505,6 +509,7 @@ class TestRunner {
   bool allow_pool_balancer;
   bool allow_pool_deep_scrubbing;
   bool allow_pool_scrubbing;
+  bool disable_pool_ec_optimizations;
 
   bool show_sequence;
   bool show_help;