ConsistencyChecker::ConsistencyChecker(librados::Rados &rados,
boost::asio::io_context& asio,
- const std::string& pool_name,
- int stripe_unit) :
+ const std::string& pool_name) :
rados(rados),
asio(asio),
reader(ceph::consistency::ECReader(rados, asio, pool_name)),
commands.get_ec_profile_for_pool(pool_name),
commands.get_pool_allow_ec_optimizations(pool_name)),
encoder(ceph::consistency::ECEncoderSwitch(pool.get_ec_profile(),
- stripe_unit,
+ commands.get_ec_chunk_size_for_pool(pool_name),
commands.get_pool_allow_ec_optimizations(pool_name)
)) {}
public:
ConsistencyChecker(librados::Rados& rados,
boost::asio::io_context& asio,
- const std::string& pool_name,
- int stripe_unit);
+ const std::string& pool_name);
void queue_ec_read(Read read);
bool check_object_consistency(const std::string& oid,
const bufferlist& inbl);
}
/**
- * RadosCommands the parity read inject on the acting primary
+ * Get chunk size for pool with the supplied name
+ *
+ * @param pool_name string Name of the pool to get chunk size of
+ * @return int the chunk size of the pool
+ */
+int RadosCommands::get_ec_chunk_size_for_pool(const std::string& pool_name)
+{
+ ceph::ErasureCodeProfile profile = get_ec_profile_for_pool(pool_name);
+ return (profile.contains("stripe_unit") ? std::stol(profile["stripe_unit"]) : 4096);
+}
+
+/**
+ * Inject the parity read inject on the acting primary
* for the specified object and pool. Assert on failure.
*
* @param pool_name string Name of the pool to perform inject on
std::string get_pool_ec_profile_name(const std::string& pool_name);
bool get_pool_allow_ec_optimizations(const std::string& pool_name);
ceph::ErasureCodeProfile get_ec_profile_for_pool(const std::string& pool_name);
+ int get_ec_chunk_size_for_pool(const std::string& pool_name);
void inject_parity_read_on_primary_osd(const std::string& pool_name,
const std::string& oid);
void inject_clear_parity_read_on_primary_osd(const std::string& pool_name,
("oid,i", po::value<std::string>(), "object io")
("blocksize,b", po::value<int>(), "block size")
("offset,o", po::value<int>(), "offset")
- ("length,l", po::value<int>(), "length")
- ("stripeunit,s", po::value<int>(), "stripe unit");
+ ("length,l", po::value<int>(), "length");
po::variables_map vm;
std::vector<std::string> unrecognized_options;
auto blocksize = vm["blocksize"].as<int>();
auto offset = vm["offset"].as<int>();
auto length = vm["length"].as<int>();
- auto stripe_unit = vm["stripeunit"].as<int>();
int rc;
rc = rados.init_with_context(g_ceph_context);
guard.emplace(boost::asio::make_work_guard(asio));
thread = make_named_thread("io_thread",[&asio] { asio.run(); });
- auto checker = ceph::consistency::ConsistencyChecker(rados, asio, pool, stripe_unit);
+ auto checker = ceph::consistency::ConsistencyChecker(rados, asio, pool);
checker.single_read_and_check_consistency(oid, blocksize, offset, length);
checker.print_results(std::cout);