Skip to content

Commit e178f9b

Browse files
authored
Merge pull request ceph#62609 from aainscow/io_exerciser_restrict
test/common: EC Optimizations: rados io sequencer exerciser extensions Reviewed-by: Bill Scales <[email protected]> Reviewed-by: Jonathan Bailey <[email protected]>
2 parents 107a837 + 96dce17 commit e178f9b

File tree

5 files changed

+97
-23
lines changed

5 files changed

+97
-23
lines changed

src/common/io_exerciser/DataGenerator.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ bool HeaderedSeededRandomGenerator::validate(bufferlist& bufferlist,
226226
}
227227

228228
if (!invalid_block_offsets.empty()) {
229+
dout(0) << "Miscompare for read of " << m_model.get_oid() <<
230+
" offset=" << offset << " length=" << length << dendl;
229231
printDebugInformationForOffsets(offset, invalid_block_offsets, bufferlist);
230232
}
231233

src/common/io_exerciser/EcIoSequence.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ std::unique_ptr<IoOp> ReadInjectSequence::next() {
207207
switch (child_op->getOpType()) {
208208
case OpType::Remove:
209209
next_op.swap(child_op);
210+
ceph_assert(shard_to_inject.has_value());
210211
switch (inject_op_type) {
211-
ceph_assert(shard_to_inject.has_value());
212212
case InjectOpType::ReadEIO:
213213
return ClearReadErrorInjectOp::generate(*shard_to_inject, 0);
214214
case InjectOpType::ReadMissingShard:
@@ -303,6 +303,7 @@ std::string ceph::io_exerciser::Seq10::get_name() const {
303303
std::unique_ptr<ceph::io_exerciser::IoOp> ceph::io_exerciser::Seq10::_next() {
304304
if (!inject_error_done) {
305305
inject_error_done = true;
306+
barrier = true;
306307
return InjectWriteErrorOp::generate(*shard_to_inject, 0, 0,
307308
std::numeric_limits<uint64_t>::max());
308309
} else if (!failed_write_done) {
@@ -316,6 +317,7 @@ std::unique_ptr<ceph::io_exerciser::IoOp> ceph::io_exerciser::Seq10::_next() {
316317
return SingleReadOp::generate(offset, length);
317318
} else if (!clear_inject_done) {
318319
clear_inject_done = true;
320+
barrier = true;
319321
return ClearWriteErrorInjectOp::generate(*shard_to_inject, 0);
320322
} else if (!successful_write_done) {
321323
successful_write_done = true;

src/test/osd/ceph_test_rados_io_sequence/ProgramOptionReader.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,53 @@ class ProgramOptionSelector : public ProgramOptionReader<option_type> {
115115
std::optional<option_type> first_value;
116116
};
117117

118+
template <typename option_type,
119+
int num_selections,
120+
const std::array< option_type,
121+
num_selections>& selections_array,
122+
int num_selections_stable,
123+
const std::array< option_type,
124+
num_selections_stable>& elections_array_stable>
125+
class StableOptionSelector : public ProgramOptionReader<option_type> {
126+
public:
127+
StableOptionSelector(ceph::util::random_number_generator<int>& rng,
128+
po::variables_map& vm,
129+
const std::string& option_name,
130+
bool select_first)
131+
: ProgramOptionReader<option_type>(vm, option_name), rng(rng),
132+
stable(!vm.contains("allow_unstable_pool_configs") ||
133+
vm.contains("disable_pool_ec_optimizations")) {
134+
if (select_first) {
135+
if (stable) {
136+
ceph_assert(selections_array.size() > 0);
137+
first_value = elections_array_stable[0];
138+
} else {
139+
ceph_assert(selections_array.size() > 0);
140+
first_value = selections_array[0];
141+
}
142+
}
143+
}
144+
145+
virtual ~StableOptionSelector() = default;
146+
147+
virtual const option_type select() override {
148+
if (this->force_value.has_value()) {
149+
return *this->force_value;
150+
} else if (first_value.has_value()) {
151+
return *std::exchange(first_value, std::nullopt);
152+
} else if (stable) {
153+
return elections_array_stable[rng(num_selections_stable - 1)];
154+
} else {
155+
return selections_array[rng(num_selections - 1)];
156+
}
157+
}
158+
159+
protected:
160+
ceph::util::random_number_generator<int>& rng;
161+
std::optional<option_type> first_value;
162+
bool stable;
163+
};
164+
118165
template <typename option_type>
119166
class ProgramOptionGeneratedSelector
120167
: public OptionalProgramOptionReader<option_type> {

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.cc

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ po::options_description get_options_description() {
184184
"allow_pool_balancer", "Enables pool balancing. Disabled by default.")(
185185
"allow_pool_deep_scrubbing",
186186
"Enables pool deep scrub. Disabled by default.")(
187-
"allow_pool_scrubbing", "Enables pool scrubbing. Disabled by default.");
187+
"allow_pool_scrubbing", "Enables pool scrubbing. Disabled by default.")(
188+
"disable_pool_ec_optimizations",
189+
"Disables EC optimizations. Enabled by default.")(
190+
"allow_unstable_pool_configs",
191+
"Permits pool configs that are known to be unstable. This option "
192+
" may be removed. at a later date. Disabled by default if ec optimized");
188193

189194
return desc;
190195
}
@@ -272,22 +277,28 @@ ceph::io_sequence::tester::SelectErasureTechnique::SelectErasureTechnique(
272277
: ProgramOptionGeneratedSelector<std::string>(rng, vm, "technique",
273278
first_use),
274279
rng(rng),
275-
plugin(plugin) {}
280+
plugin(plugin),
281+
stable(!vm.contains("allow_unstable_pool_configs") ||
282+
vm.contains("disable_pool_ec_optimizations")) {}
276283

277284
const std::vector<std::string>
278285
ceph::io_sequence::tester::SelectErasureTechnique::generate_selections() {
279286
std::vector<std::string> techniques = {};
280287
if (plugin == "jerasure") {
281288
techniques.push_back("reed_sol_van");
282-
techniques.push_back("reed_sol_r6_op");
283-
techniques.push_back("cauchy_orig");
284-
techniques.push_back("cauchy_good");
285-
techniques.push_back("liberation");
286-
techniques.push_back("blaum_roth");
287-
techniques.push_back("liber8tion");
289+
if (!stable) {
290+
techniques.push_back("reed_sol_r6_op");
291+
techniques.push_back("cauchy_orig");
292+
techniques.push_back("cauchy_good");
293+
techniques.push_back("liberation");
294+
techniques.push_back("blaum_roth");
295+
techniques.push_back("liber8tion");
296+
}
288297
} else if (plugin == "isa") {
289298
techniques.push_back("reed_sol_van");
290-
techniques.push_back("cauchy");
299+
if (!stable) {
300+
techniques.push_back("cauchy");
301+
}
291302
} else if (plugin == "shec") {
292303
techniques.push_back("single");
293304
techniques.push_back("multiple");
@@ -337,28 +348,24 @@ ceph::io_sequence::tester::SelectErasureKM::generate_selections() {
337348
(technique == "reed_sol_van" || technique == "cauchy_orig" ||
338349
technique == "cauchy_good" || technique == std::nullopt))) {
339350
for (int m = 1; m <= 3; m++)
340-
for (int k = 2; k <= 6; k++) selection.push_back({k, m});
351+
for (int k = 2; k <= 4; k++) selection.push_back({k, m});
341352
} else if (plugin == "shec" ||
342353
(plugin == "jerasure" &&
343354
(technique == "liberation" || technique == "blaum_roth"))) {
344355
for (int m = 1; m <= 2; m++)
345-
for (int k = 2; k <= 6; k++) selection.push_back({k, m});
356+
for (int k = 2; k <= 4; k++) selection.push_back({k, m});
346357
} else if (plugin == "jerasure" &&
347358
(technique == "reed_sol_r6_op" || technique == "liber8tion")) {
348-
for (int k = 2; k <= 6; k++) selection.push_back({k, 2});
359+
for (int k = 2; k <= 4; k++) selection.push_back({k, 2});
349360
}
350361

351362
// We want increased chances of these as we will test with c=1 and c=2
352363
if (plugin == "shec")
353364
for (int i = 0; i < 2; i++)
354-
for (int k = 3; k <= 6; k++) selection.push_back({k, 3});
365+
for (int k = 3; k <= 4; k++) selection.push_back({k, 3});
355366

356367
// Add extra miscelaneous interesting options for testing w values
357368
if (plugin == "jerasure") {
358-
if (technique == "reed_sol_van")
359-
// Double chance of chosing to test more w values
360-
for (int i = 0; i < 2; i++) selection.push_back({6, 3});
361-
362369
if (technique == "liberation" || technique == "blaum_roth")
363370
// Double chance of chosing to test more different w values
364371
for (int i = 0; i < 2; i++) selection.push_back({6, 2});

src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,19 @@ inline static constexpr std::array<uint64_t, block_size_array_size> block_size_c
108108
{2048, // Default - test boundaries for EC 4K chunk size
109109
512, 3767, 4096, 32768}};
110110

111+
// Choices for block size
112+
inline static constexpr int block_size_array_size_stable = 2;
113+
inline static constexpr std::array<uint64_t, block_size_array_size_stable> block_size_choices_stable = {
114+
{2048, // Default - test boundaries for EC 4K chunk size
115+
32768}};
116+
117+
111118
using SelectBlockSize =
112-
ProgramOptionSelector<uint64_t,
113-
io_sequence::tester::block_size_array_size,
114-
io_sequence::tester::block_size_choices>;
119+
StableOptionSelector<uint64_t,
120+
io_sequence::tester::block_size_array_size,
121+
io_sequence::tester::block_size_choices,
122+
io_sequence::tester::block_size_array_size_stable,
123+
io_sequence::tester::block_size_choices_stable>;
115124

116125
// Choices for number of threads
117126
inline static constexpr int thread_array_size = 4;
@@ -138,10 +147,16 @@ inline static constexpr int plugin_array_size = 5;
138147
inline static constexpr std::array<std::string_view, plugin_array_size>
139148
plugin_choices = {{"jerasure", "isa", "clay", "shec", "lrc"}};
140149

150+
inline static constexpr int plugin_array_size_stable = 2;
151+
inline static constexpr std::array<std::string_view, plugin_array_size_stable>
152+
plugin_choices_stable = {{"jerasure", "isa"}};
153+
141154
using SelectErasurePlugin =
142-
ProgramOptionSelector<std::string_view,
155+
StableOptionSelector<std::string_view,
143156
io_sequence::tester::plugin_array_size,
144-
io_sequence::tester::plugin_choices>;
157+
io_sequence::tester::plugin_choices,
158+
io_sequence::tester::plugin_array_size_stable,
159+
io_sequence::tester::plugin_choices_stable>;
145160

146161
class SelectErasureKM
147162
: public ProgramOptionGeneratedSelector<std::pair<int, int>> {
@@ -306,6 +321,7 @@ class SelectErasureTechnique
306321
ceph::util::random_number_generator<int>& rng;
307322

308323
std::string_view plugin;
324+
bool stable;
309325
};
310326

311327
class SelectErasureChunkSize : public ProgramOptionGeneratedSelector<uint64_t> {

0 commit comments

Comments
 (0)