From: myoungwon oh Date: Thu, 4 Feb 2021 03:04:53 +0000 (+0900) Subject: src/test: add dedup options (chunking algorithm, chunking size) to run dedup test X-Git-Tag: v17.1.0~2307^2~45 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dd7b5029518c1b4c1ad6b866be54b519319f976b;p=ceph.git src/test: add dedup options (chunking algorithm, chunking size) to run dedup test Signed-off-by: Myoungwon Oh --- diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index fc5d27daf870..4bde44f4c173 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -197,6 +197,8 @@ public: int snapname_num; map redirect_objs; bool enable_dedup; + string chunk_algo; + string chunk_size; RadosTestContext(const string &pool_name, int max_in_flight, @@ -209,6 +211,8 @@ public: bool write_fadvise_dontneed, const string &low_tier_pool_name, bool enable_dedup, + string chunk_algo, + string chunk_size, const char *id = 0) : pool_obj_cont(), current_snap(0), @@ -227,7 +231,9 @@ public: write_fadvise_dontneed(write_fadvise_dontneed), low_tier_pool_name(low_tier_pool_name), snapname_num(0), - enable_dedup(enable_dedup) + enable_dedup(enable_dedup), + chunk_algo(chunk_algo), + chunk_size(chunk_size) { } @@ -285,7 +291,7 @@ public: } r = rados.mon_command( "{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name + - "\", \"var\": \"dedup_chunk_algorithm\", \"val\": \"" + "fastcdc" + "\"}", + "\", \"var\": \"dedup_chunk_algorithm\", \"val\": \"" + chunk_algo + "\"}", inbl, NULL, NULL); if (r < 0) { rados.shutdown(); @@ -293,7 +299,7 @@ public: } r = rados.mon_command( "{\"prefix\": \"osd pool set\", \"pool\": \"" + pool_name + - "\", \"var\": \"dedup_cdc_chunk_size\", \"val\": \"" + "1024" + "\"}", + "\", \"var\": \"dedup_cdc_chunk_size\", \"val\": \"" + chunk_size + "\"}", inbl, NULL, NULL); if (r < 0) { rados.shutdown(); diff --git a/src/test/osd/TestRados.cc b/src/test/osd/TestRados.cc index d06bceafd822..9fb8c626d325 100644 --- a/src/test/osd/TestRados.cc +++ b/src/test/osd/TestRados.cc @@ -534,6 +534,13 @@ int main(int argc, char **argv) { TEST_OP_READ /* grr */, NULL }, }; + struct { + const char *name; + } chunk_algo_types[] = { + { "fastcdc" }, + { "fixcdc" }, + }; + map op_weights; string pool_name = "rbd"; string low_tier_pool_name = ""; @@ -545,6 +552,9 @@ int main(int argc, char **argv) bool set_redirect = false; bool set_chunk = false; bool enable_dedup = false; + string chunk_algo = ""; + string chunk_size = ""; + for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "--max-ops") == 0) @@ -629,6 +639,25 @@ int main(int argc, char **argv) low_tier_pool_name = argv[++i]; } else if (strcmp(argv[i], "--enable_dedup") == 0) { enable_dedup = true; + } else if (strcmp(argv[i], "--dedup_chunk_algo") == 0) { + i++; + if (i == argc) { + cerr << "Missing chunking algorithm after --dedup_chunk_algo" << std::endl; + return 1; + } + int j; + for (j = 0; chunk_algo_types[j].name; ++j) { + if (strcmp(chunk_algo_types[j].name, argv[i]) == 0) { + break; + } + } + if (!chunk_algo_types[j].name) { + cerr << "unknown op " << argv[i] << std::endl; + exit(1); + } + chunk_algo = chunk_algo_types[j].name; + } else if (strcmp(argv[i], "--dedup_chunk_size") == 0) { + chunk_size = argv[++i]; } else { cerr << "unknown arg " << argv[i] << std::endl; exit(1); @@ -642,6 +671,14 @@ int main(int argc, char **argv) } } + if (enable_dedup) { + if (chunk_algo == "" || chunk_size == "") { + cerr << "Missing chunking algorithm: " << chunk_algo + << " or chunking size: " << chunk_size << std::endl; + exit(1); + } + } + if (op_weights.empty()) { cerr << "No operations specified" << std::endl; exit(1); @@ -692,6 +729,8 @@ int main(int argc, char **argv) write_fadvise_dontneed, low_tier_pool_name, enable_dedup, + chunk_algo, + chunk_size, id); TestOpStat stats;