From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/test/lazy-omap-stats/lazy_omap_stats_test.h | 80 +++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/test/lazy-omap-stats/lazy_omap_stats_test.h (limited to 'src/test/lazy-omap-stats/lazy_omap_stats_test.h') diff --git a/src/test/lazy-omap-stats/lazy_omap_stats_test.h b/src/test/lazy-omap-stats/lazy_omap_stats_test.h new file mode 100644 index 000000000..020c72c73 --- /dev/null +++ b/src/test/lazy-omap-stats/lazy_omap_stats_test.h @@ -0,0 +1,80 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2019 Red Hat + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef CEPH_LAZY_OMAP_STATS_TEST_H +#define CEPH_LAZY_OMAP_STATS_TEST_H + +#include +#include +#include + +#include "include/compat.h" +#include "include/rados/librados.hpp" + +struct index_t { + unsigned byte_index = 0; + unsigned key_index = 0; +}; + +class LazyOmapStatsTest +{ + librados::IoCtx io_ctx; + librados::Rados rados; + std::map payload; + + struct lazy_omap_test_t { + unsigned payload_size = 0; + unsigned replica_count = 3; + unsigned keys = 2000; + unsigned how_many = 50; + std::string pool_name = "lazy_omap_test_pool"; + unsigned total_bytes = 0; + unsigned total_keys = 0; + } conf; + + LazyOmapStatsTest(LazyOmapStatsTest&) = delete; + void operator=(LazyOmapStatsTest) = delete; + void init(const int argc, const char** argv); + void shutdown(); + void write_omap(const std::string& object_name); + const std::string get_name() const; + void create_payload(); + void write_many(const unsigned how_many); + void scrub() const; + const int find_matches(std::string& output, std::regex& reg) const; + void check_one(); + const int find_index(std::string& haystack, std::regex& needle, + std::string label) const; + const unsigned tally_column(const unsigned omap_bytes_index, + const std::string& table, bool header) const; + void check_column(const int index, const std::string& table, + const std::string& type, bool header = true) const; + index_t get_indexes(std::regex& reg, std::string& output) const; + const std::string get_pool_id(std::string& pool); + void check_pg_dump(); + void check_pg_dump_summary(); + void check_pg_dump_pgs(); + void check_pg_dump_pools(); + void check_pg_ls(); + const std::string get_output( + const std::string command = R"({"prefix": "pg dump"})", + const bool silent = false); + void wait_for_active_clean(); + + public: + LazyOmapStatsTest() = default; + const int run(const int argc, const char** argv); +}; + +#endif // CEPH_LAZY_OMAP_STATS_TEST_H -- cgit v1.2.3