Skip to content

Commit 30670d3

Browse files
committed
test/osd: Move initialisation of overwrites and optimisation earlier in ceph_test_rados_io_sequence
All other pool initialisation happens straight after pool creation, however these two items happen later on. This is just due to them being the first two rest calls added. We now have better and more logical places for this code and this commit is moving it into this structure. Signed-off-by: Jon Bailey <[email protected]>
1 parent 33ab081 commit 30670d3

File tree

5 files changed

+72
-40
lines changed

5 files changed

+72
-40
lines changed

src/common/io_exerciser/RadosIo.cc

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ RadosIo::RadosIo(librados::Rados& rados, boost::asio::io_context& asio,
6363
int rc;
6464
rc = rados.ioctx_create(pool.c_str(), io);
6565
ceph_assert(rc == 0);
66-
allow_ec_overwrites(true);
67-
if (ec_optimizations) {
68-
allow_ec_optimizations();
69-
}
7066
}
7167

7268
RadosIo::~RadosIo() {}
@@ -90,28 +86,6 @@ void RadosIo::wait_for_io(int count) {
9086
}
9187
}
9288

93-
void RadosIo::allow_ec_overwrites(bool allow) {
94-
int rc;
95-
bufferlist inbl, outbl;
96-
std::string cmdstr = "{\"prefix\": \"osd pool set\", \"pool\": \"" + pool +
97-
"\", \
98-
\"var\": \"allow_ec_overwrites\", \"val\": \"" +
99-
(allow ? "true" : "false") + "\"}";
100-
rc = rados.mon_command(cmdstr, inbl, &outbl, nullptr);
101-
ceph_assert(rc == 0);
102-
}
103-
104-
void RadosIo::allow_ec_optimizations()
105-
{
106-
int rc;
107-
bufferlist inbl, outbl;
108-
std::string cmdstr =
109-
"{\"prefix\": \"osd pool set\", \"pool\": \"" + pool + "\", \
110-
\"var\": \"allow_ec_optimizations\", \"val\": \"true\"}";
111-
rc = rados.mon_command(cmdstr, inbl, &outbl, nullptr);
112-
ceph_assert(rc == 0);
113-
}
114-
11589
template <int N>
11690
RadosIo::AsyncOpInfo<N>::AsyncOpInfo(const std::array<uint64_t, N>& offset,
11791
const std::array<uint64_t, N>& length)
@@ -197,8 +171,14 @@ void RadosIo::applyIoOp(IoOp& op) {
197171

198172
case OpType::Consistency: {
199173
start_io();
174+
ceph_assert(cc);
200175
bool is_consistent =
201-
cc->single_read_and_check_consistency(oid, block_size, 0, 0);
176+
cc->single_read_and_check_consistency(oid, block_size, 0, 0);
177+
if (!is_consistent) {
178+
std::stringstream strstream;
179+
cc->print_results(strstream);
180+
std::cerr << strstream.str() << std::endl;
181+
}
202182
ceph_assert(is_consistent);
203183
finish_io();
204184
break;

src/common/json/OSDStructures.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ void OSDPoolGetReply::decode_json(JSONObj* obj) {
6969
JSONDecoder::decode_json("allow_ec_optimizations", allow_ec_optimizations, obj);
7070
}
7171

72+
void OSDPoolSetRequest::dump(Formatter* f) const {
73+
encode_json("prefix", "osd pool set", f);
74+
encode_json("pool", pool, f);
75+
encode_json("var", var, f);
76+
encode_json("val", val, f);
77+
encode_json("yes_i_really_mean_it", yes_i_really_mean_it, f);
78+
}
79+
80+
void OSDPoolSetRequest::decode_json(JSONObj* obj) {
81+
JSONDecoder::decode_json("pool", pool, obj);
82+
JSONDecoder::decode_json("var", var, obj);
83+
JSONDecoder::decode_json("val", val, obj);
84+
JSONDecoder::decode_json("yes_i_really_mean_it", yes_i_really_mean_it, obj);
85+
}
86+
7287
void OSDECProfileGetRequest::dump(Formatter* f) const {
7388
encode_json("prefix", "osd erasure-code-profile get", f);
7489
encode_json("name", name, f);

src/common/json/OSDStructures.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ struct OSDPoolGetReply {
5555
void decode_json(JSONObj* obj);
5656
};
5757

58+
struct OSDPoolSetRequest {
59+
std::string pool;
60+
std::string var;
61+
std::optional<std::string> val;
62+
std::optional<bool> yes_i_really_mean_it = std::nullopt;
63+
64+
void dump(Formatter* f) const;
65+
void decode_json(JSONObj* obj);
66+
};
67+
5868
struct OSDECProfileGetRequest {
5969
std::string name;
6070
std::string format = "json";

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.cc

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
794794
bool allow_pool_deep_scrubbing,
795795
bool allow_pool_scrubbing,
796796
bool test_recovery,
797-
bool disable_pool_ec_optimizations)
797+
bool allow_pool_ec_optimizations)
798798
: ProgramOptionReader<std::string>(vm, "pool"),
799799
rados(rados),
800800
dry_run(dry_run),
@@ -803,7 +803,7 @@ ceph::io_sequence::tester::SelectErasurePool::SelectErasurePool(
803803
allow_pool_deep_scrubbing(allow_pool_deep_scrubbing),
804804
allow_pool_scrubbing(allow_pool_scrubbing),
805805
test_recovery(test_recovery),
806-
disable_pool_ec_optimizations(disable_pool_ec_optimizations),
806+
allow_pool_ec_optimizations(allow_pool_ec_optimizations),
807807
first_use(true),
808808
sep{cct, rng, vm, rados, dry_run, first_use} {
809809
if (isForced()) {
@@ -849,9 +849,10 @@ const std::string ceph::io_sequence::tester::SelectErasurePool::select() {
849849
}
850850

851851
if (!dry_run) {
852-
configureServices(allow_pool_autoscaling, allow_pool_balancer,
852+
configureServices(force_value.value_or(created_pool_name),
853+
allow_pool_autoscaling, allow_pool_balancer,
853854
allow_pool_deep_scrubbing, allow_pool_scrubbing,
854-
test_recovery);
855+
allow_pool_ec_optimizations, true, test_recovery);
855856

856857
setApplication(created_pool_name);
857858
}
@@ -868,7 +869,7 @@ std::string ceph::io_sequence::tester::SelectErasurePool::create() {
868869
std::string pool_name;
869870
profile = sep.select();
870871
pool_name = fmt::format("testpool-pr{}{}", profile->name,
871-
disable_pool_ec_optimizations?"_no_ec_opt":"");
872+
allow_pool_ec_optimizations?"":"_no_ec_opt");
872873

873874
ceph::messaging::osd::OSDECPoolCreateRequest pool_create_request{
874875
pool_name, "erasure", 8, 8, profile->name};
@@ -895,10 +896,13 @@ void ceph::io_sequence::tester::SelectErasurePool::setApplication(
895896
}
896897

897898
void ceph::io_sequence::tester::SelectErasurePool::configureServices(
899+
const std::string& pool_name,
898900
bool allow_pool_autoscaling,
899901
bool allow_pool_balancer,
900902
bool allow_pool_deep_scrubbing,
901903
bool allow_pool_scrubbing,
904+
bool allow_pool_ec_optimizations,
905+
bool allow_pool_ec_overwrites,
902906
bool test_recovery) {
903907
int rc;
904908
bufferlist inbl, outbl;
@@ -942,12 +946,34 @@ void ceph::io_sequence::tester::SelectErasurePool::configureServices(
942946

943947
if (!allow_pool_scrubbing) {
944948
ceph::messaging::osd::OSDSetRequest no_scrub_request{"noscrub",
945-
std::nullopt};
949+
std::nullopt};
946950
rc = send_mon_command(no_scrub_request, rados, "OSDSetRequest", inbl,
947951
&outbl, formatter.get());
948952
ceph_assert(rc == 0);
949953
}
950954

955+
if (allow_pool_ec_optimizations) {
956+
ceph::messaging::osd::OSDPoolSetRequest
957+
allow_ec_optimisations_request{pool_name,
958+
"allow_ec_optimizations",
959+
"true",
960+
std::nullopt};
961+
rc = send_mon_command(allow_ec_optimisations_request, rados,
962+
"OSDPoolSetRequest", inbl, &outbl, formatter.get());
963+
ceph_assert(rc == 0);
964+
}
965+
966+
if (allow_pool_ec_overwrites) {
967+
ceph::messaging::osd::OSDPoolSetRequest
968+
allow_ec_optimisations_request{pool_name,
969+
"allow_ec_overwrites",
970+
"true",
971+
std::nullopt};
972+
rc = send_mon_command(allow_ec_optimisations_request, rados,
973+
"OSDPoolSetRequest", inbl, &outbl, formatter.get());
974+
ceph_assert(rc == 0);
975+
}
976+
951977
if (test_recovery) {
952978
ceph::messaging::config::ConfigSetRequest bluestore_debug_request{
953979
"global", "bluestore_debug_inject_read_err", "true", std::nullopt};
@@ -1105,7 +1131,7 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
11051131
vm.contains("allow_pool_deep_scrubbing"),
11061132
vm.contains("allow_pool_scrubbing"),
11071133
vm.contains("testrecovery"),
1108-
vm.contains("disable_pool_ec_optimizations")},
1134+
!vm.contains("disable_pool_ec_optimizations")},
11091135
snt{rng, vm, "threads", true},
11101136
ssr{vm} {
11111137
dout(0) << "Test using seed " << seed << dendl;
@@ -1127,7 +1153,6 @@ ceph::io_sequence::tester::TestRunner::TestRunner(
11271153
allow_pool_balancer = vm.contains("allow_pool_balancer");
11281154
allow_pool_deep_scrubbing = vm.contains("allow_pool_deep_scrubbing");
11291155
allow_pool_scrubbing = vm.contains("allow_pool_scrubbing");
1130-
disable_pool_ec_optimizations = vm.contains("disable_pool_ec_optimizations");
11311156

11321157
if (testrecovery && (num_objects > 1)) {
11331158
throw std::invalid_argument("testrecovery option not allowed if parallel is"

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
389389
bool allow_pool_deep_scrubbing,
390390
bool allow_pool_scrubbing,
391391
bool test_recovery,
392-
bool disable_pool_ec_optimizations);
392+
bool allow_pool_ec_optimizations);
393393
const std::string select() override;
394394
std::string create();
395395

@@ -400,7 +400,7 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
400400
}
401401
inline bool get_allow_pool_scrubbing() { return allow_pool_scrubbing; }
402402
inline bool get_allow_pool_ec_optimizations() {
403-
return !disable_pool_ec_optimizations;
403+
return allow_pool_ec_optimizations;
404404
}
405405
inline std::optional<Profile> getProfile() { return profile; }
406406

@@ -413,18 +413,21 @@ class SelectErasurePool : public ProgramOptionReader<std::string> {
413413
bool allow_pool_deep_scrubbing;
414414
bool allow_pool_scrubbing;
415415
bool test_recovery;
416-
bool disable_pool_ec_optimizations;
416+
bool allow_pool_ec_optimizations;
417417

418418
bool first_use;
419419

420420
SelectErasureProfile sep;
421421

422422
std::optional<Profile> profile;
423423

424-
void configureServices(bool allow_pool_autoscaling,
424+
void configureServices(const std::string& pool_name,
425+
bool allow_pool_autoscaling,
425426
bool allow_pool_balancer,
426427
bool allow_pool_deep_scrubbing,
427428
bool allow_pool_scrubbing,
429+
bool disable_pool_ec_optimizations,
430+
bool allow_pool_ec_overwrites,
428431
bool test_recovery);
429432

430433
void setApplication(const std::string& pool_name);
@@ -515,7 +518,6 @@ class TestRunner {
515518
bool allow_pool_balancer;
516519
bool allow_pool_deep_scrubbing;
517520
bool allow_pool_scrubbing;
518-
bool disable_pool_ec_optimizations;
519521

520522
bool show_sequence;
521523
bool show_help;

0 commit comments

Comments
 (0)