]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados/testcase_cxx: set_allow_ec_overwrites wait for overwrite to work 57586/head
authorSamuel Just <sjust@redhat.com>
Fri, 31 May 2024 18:42:58 +0000 (11:42 -0700)
committerNitzan Mordechai <nmordech@redhat.com>
Wed, 15 Jan 2025 10:16:31 +0000 (10:16 +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 5d26a6cbc63c1d5f9fdd6941e3fce46302f7864c)

src/test/librados/testcase_cxx.cc

index faa303427534059650c9303b9c7df2c2add3daed..69230cb9e9d5387afc8c676bdf6a3c5aafbf92a5 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"
@@ -411,6 +414,22 @@ void RadosTestECPP::TearDown()
 
 void RadosTestECPP::set_allow_ec_overwrites()
 {
-  ASSERT_EQ("", set_allow_ec_overwrites_pp(pool_name, cluster, true));
   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));
+  }
 }