int snapname_num;
map<string,string > redirect_objs;
bool enable_dedup;
+ string chunk_algo;
+ string chunk_size;
RadosTestContext(const string &pool_name,
int max_in_flight,
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),
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)
{
}
}
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();
}
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();
{ TEST_OP_READ /* grr */, NULL },
};
+ struct {
+ const char *name;
+ } chunk_algo_types[] = {
+ { "fastcdc" },
+ { "fixcdc" },
+ };
+
map<TestOpType, unsigned int> op_weights;
string pool_name = "rbd";
string low_tier_pool_name = "";
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)
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);
}
}
+ 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);
write_fadvise_dontneed,
low_tier_pool_name,
enable_dedup,
+ chunk_algo,
+ chunk_size,
id);
TestOpStat stats;