Skip to content

Commit 446df87

Browse files
committed
test: IO sequence exerciser enable ec optimisations
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 <[email protected]>
1 parent 5cdb7a3 commit 446df87

File tree

4 files changed

+40
-13
lines changed

4 files changed

+40
-13
lines changed

src/common/io_exerciser/RadosIo.cc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ RadosIo::RadosIo(librados::Rados& rados, boost::asio::io_context& asio,
4141
const std::string& pool, const std::string& oid,
4242
const std::optional<std::vector<int>>& cached_shard_order,
4343
uint64_t block_size, int seed, int threads, ceph::mutex& lock,
44-
ceph::condition_variable& cond)
44+
ceph::condition_variable& cond, bool ec_optimizations)
4545
: Model(oid, block_size),
4646
rados(rados),
4747
asio(asio),
@@ -58,6 +58,9 @@ RadosIo::RadosIo(librados::Rados& rados, boost::asio::io_context& asio,
5858
rc = rados.ioctx_create(pool.c_str(), io);
5959
ceph_assert(rc == 0);
6060
allow_ec_overwrites(true);
61+
if (ec_optimizations) {
62+
allow_ec_optimizations();
63+
}
6164
}
6265

6366
RadosIo::~RadosIo() {}
@@ -92,6 +95,17 @@ void RadosIo::allow_ec_overwrites(bool allow) {
9295
ceph_assert(rc == 0);
9396
}
9497

98+
void RadosIo::allow_ec_optimizations()
99+
{
100+
int rc;
101+
bufferlist inbl, outbl;
102+
std::string cmdstr =
103+
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool + "\", \
104+
\"var\": \"allow_ec_optimizations\", \"val\": \"true\"}";
105+
rc = rados.mon_command(cmdstr, inbl, &outbl, nullptr);
106+
ceph_assert(rc == 0);
107+
}
108+
95109
template <int N>
96110
RadosIo::AsyncOpInfo<N>::AsyncOpInfo(const std::array<uint64_t, N>& offset,
97111
const std::array<uint64_t, N>& length)

src/common/io_exerciser/RadosIo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ class RadosIo : public Model {
4242
const std::string& pool, const std::string& oid,
4343
const std::optional<std::vector<int>>& cached_shard_order,
4444
uint64_t block_size, int seed, int threads, ceph::mutex& lock,
45-
ceph::condition_variable& cond);
45+
ceph::condition_variable& cond, bool ec_optimizations);
4646

4747
~RadosIo();
4848

4949
void allow_ec_overwrites(bool allow);
50+
void allow_ec_optimizations();
5051

5152
template <int N>
5253
class AsyncOpInfo {

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.cc

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <boost/asio/io_context.hpp>
44
#include <iostream>
5-
#include <map>
65
#include <vector>
76

87
#include "common/Formatter.h"
@@ -11,6 +10,11 @@
1110
#include "common/ceph_json.h"
1211
#include "common/debug.h"
1312
#include "common/dout.h"
13+
#include "common/split.h"
14+
#include "common/strtol.h" // for strict_iecstrtoll()
15+
#include "common/ceph_json.h"
16+
#include "common/Formatter.h"
17+
1418
#include "common/io_exerciser/DataGenerator.h"
1519
#include "common/io_exerciser/EcIoSequence.h"
1620
#include "common/io_exerciser/IoOp.h"
@@ -21,9 +25,6 @@
2125
#include "common/json/BalancerStructures.h"
2226
#include "common/json/ConfigStructures.h"
2327
#include "common/json/OSDStructures.h"
24-
#include "common/split.h"
25-
#include "common/strtol.h" // for strict_iecstrtoll()
26-
#include "erasure-code/ErasureCodePlugin.h"
2728
#include "fmt/format.h"
2829
#include "global/global_context.h"
2930
#include "global/global_init.h"
@@ -763,7 +764,8 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
763764
bool allow_pool_balancer,
764765
bool allow_pool_deep_scrubbing,
765766
bool allow_pool_scrubbing,
766-
bool test_recovery)
767+
bool test_recovery,
768+
bool disable_pool_ec_optimizations)
767769
: ProgramOptionReader<std::string>(vm, "pool"),
768770
rados(rados),
769771
dry_run(dry_run),
@@ -772,6 +774,7 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
772774
allow_pool_deep_scrubbing(allow_pool_deep_scrubbing),
773775
allow_pool_scrubbing(allow_pool_scrubbing),
774776
test_recovery(test_recovery),
777+
disable_pool_ec_optimizations(disable_pool_ec_optimizations),
775778
first_use(true),
776779
sep{cct, rng, vm, rados, dry_run, first_use} {
777780
if (isForced()) {
@@ -834,7 +837,8 @@ std::string ceph::io_sequence::tester::SelectErasurePool::create() {
834837

835838
std::string pool_name;
836839
profile = sep.select();
837-
pool_name = fmt::format("testpool-pr{}", profile->name);
840+
pool_name = fmt::format("testpool-pr{}{}", profile->name,
841+
disable_pool_ec_optimizations?"_no_ec_opt":"");
838842

839843
ceph::messaging::osd::OSDECPoolCreateRequest pool_create_request{
840844
pool_name, "erasure", 8, 8, profile->name};
@@ -962,7 +966,7 @@ ceph::io_sequence::tester::TestObject::TestObject(
962966

963967
exerciser_model = std::make_unique<ceph::io_exerciser::RadosIo>(
964968
rados, asio, pool, oid, cached_shard_order, sbs.select(), rng(),
965-
threads, lock, cond);
969+
threads, lock, cond, spo.get_allow_pool_ec_optimizations());
966970
dout(0) << "= " << oid << " pool=" << pool << " threads=" << threads
967971
<< " blocksize=" << exerciser_model->get_block_size() << " ="
968972
<< dendl;
@@ -1054,7 +1058,8 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
10541058
vm.contains("allow_pool_balancer"),
10551059
vm.contains("allow_pool_deep_scrubbing"),
10561060
vm.contains("allow_pool_scrubbing"),
1057-
vm.contains("test_recovery")},
1061+
vm.contains("test_recovery"),
1062+
vm.contains("disable_pool_ec_optimizations")},
10581063
snt{rng, vm, "threads", true},
10591064
ssr{vm} {
10601065
dout(0) << "Test using seed " << seed << dendl;
@@ -1075,6 +1080,7 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
10751080
allow_pool_balancer = vm.contains("allow_pool_balancer");
10761081
allow_pool_deep_scrubbing = vm.contains("allow_pool_deep_scrubbing");
10771082
allow_pool_scrubbing = vm.contains("allow_pool_scrubbing");
1083+
disable_pool_ec_optimizations = vm.contains("disable_pool_ec_optimizations");
10781084

10791085
if (!dryrun) {
10801086
guard.emplace(boost::asio::make_work_guard(asio));
@@ -1229,7 +1235,8 @@ bool ceph::io_sequence::tester::TestRunner::run_interactive_test() {
12291235
model = std::make_unique<ceph::io_exerciser::RadosIo>(
12301236
rados, asio, pool, object_name, osd_map_reply.acting, sbs.select(), rng(),
12311237
1, // 1 thread
1232-
lock, cond);
1238+
lock, cond,
1239+
spo.get_allow_pool_ec_optimizations());
12331240
}
12341241

12351242
while (!done) {

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
388388
bool allow_pool_balancer,
389389
bool allow_pool_deep_scrubbing,
390390
bool allow_pool_scrubbing,
391-
bool test_recovery);
391+
bool test_recovery,
392+
bool disable_pool_ec_optimizations);
392393
const std::string select() override;
393394
std::string create();
394395
void configureServices(bool allow_pool_autoscaling,
@@ -403,7 +404,9 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
403404
return allow_pool_deep_scrubbing;
404405
}
405406
inline bool get_allow_pool_scrubbing() { return allow_pool_scrubbing; }
406-
407+
inline bool get_allow_pool_ec_optimizations() {
408+
return !disable_pool_ec_optimizations;
409+
}
407410
inline std::optional<Profile> getProfile() { return profile; }
408411

409412
private:
@@ -415,6 +418,7 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
415418
bool allow_pool_deep_scrubbing;
416419
bool allow_pool_scrubbing;
417420
bool test_recovery;
421+
bool disable_pool_ec_optimizations;
418422

419423
bool first_use;
420424

@@ -505,6 +509,7 @@ class TestRunner {
505509
bool allow_pool_balancer;
506510
bool allow_pool_deep_scrubbing;
507511
bool allow_pool_scrubbing;
512+
bool disable_pool_ec_optimizations;
508513

509514
bool show_sequence;
510515
bool show_help;

0 commit comments

Comments
 (0)