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: v19.2.3~411^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9981296bf0433eab346094426cb96da5489ccfbd;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 5d26a6cbc63c1d5f9fdd6941e3fce46302f7864c) --- diff --git a/src/test/librados/testcase_cxx.cc b/src/test/librados/testcase_cxx.cc index faa30342753..69230cb9e9d 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" @@ -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)); + } }