]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados/testcase_cxx: set_allow_ec_overwrites wait for overwrite to work
authorSamuel Just <sjust@redhat.com>
Fri, 31 May 2024 18:42:58 +0000 (11:42 -0700)
committerNitzan Mordechai <nmordech@redhat.com>
Thu, 27 Jun 2024 11:07:41 +0000 (11:07 +0000)
The mon command to enable ec overwrites succeeds once the mon commits
the update.  However, actual IOs won't suceed until the map is actually
propagated to OSDs.  Update set_allow_ec_overwrites to try performing
overwrites until it actually succeeds (with a 120s timelimit) before
returning.

Fixes: https://tracker.ceph.com/issues/66226
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 426f225d4e6ec7e037260a234896ef9c8d6aec82)

src/test/librados/testcase_cxx.cc

index 75c05cc20410f72d031c1189e8ba604eeac60a3b..9295142c6470aaea4e000fd6531549408af43b22 100644 (file)
@@ -3,6 +3,9 @@
 
 #include "testcase_cxx.h"
 
+#include <chrono>
+#include <thread>
+
 #include <errno.h>
 #include <fmt/format.h>
 #include "test_cxx.h"
@@ -406,13 +409,26 @@ void RadosTestECPP::TearDown()
 
 void RadosTestECPP::recreate_pool()
 {
-  SKIP_IF_CRIMSON();
-  ASSERT_EQ(0, destroy_one_ec_pool_pp(pool_name, s_cluster));
-  ASSERT_EQ("", create_one_ec_pool_pp(pool_name, s_cluster));
-  SetUp();
+  ec_overwrites_set = true;
+  ASSERT_EQ("", set_allow_ec_overwrites_pp(pool_name, cluster, true));
+
+  char buf[128];
+  memset(buf, 0xcc, sizeof(buf));
+  bufferlist bl;
+  bl.append(buf, sizeof(buf));
+
+  const std::string objname = "RadosTestECPP::set_allow_ec_overwrites:test_obj";
+  ASSERT_EQ(0, ioctx.write(objname, bl, sizeof(buf), 0));
+  const auto end = std::chrono::steady_clock::now() + std::chrono::seconds(120);
+  while (true) {
+    if (0 == ioctx.write(objname, bl, sizeof(buf), 0)) {
+      break;
+    }
+    ASSERT_LT(std::chrono::steady_clock::now(), end);
+    std::this_thread::sleep_for(std::chrono::seconds(2));
+  }
 }
 
 void RadosTestECPP::set_allow_ec_overwrites(std::string pool, bool allow)
 {
   ASSERT_EQ("", set_allow_ec_overwrites_pp(pool, cluster, allow));
-}
\ No newline at end of file