From: Samuel Just Date: Fri, 31 May 2024 18:42:58 +0000 (-0700) Subject: test/librados/testcase_cxx: set_allow_ec_overwrites wait for overwrite to work X-Git-Tag: v18.2.5~311^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=28fb158a6294c183c3e04cb5f2ddf10f36fc40c6;p=ceph.git test/librados/testcase_cxx: set_allow_ec_overwrites wait for overwrite to work 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 (cherry picked from commit 426f225d4e6ec7e037260a234896ef9c8d6aec82) --- diff --git a/src/test/librados/testcase_cxx.cc b/src/test/librados/testcase_cxx.cc index 75c05cc2041..9295142c647 100644 --- a/src/test/librados/testcase_cxx.cc +++ b/src/test/librados/testcase_cxx.cc @@ -3,6 +3,9 @@ #include "testcase_cxx.h" +#include +#include + #include #include #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