From 5fee194f13ed2e6e03b120835e105d2ce573c0bf Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 28 Apr 2016 16:50:12 -0700 Subject: [PATCH] osd,mon: add pool FLAG_EC_OVERWRITES flag For now, this is a white box testing flag to allow us to start testing the supporting features before ec overwrites can actually be implemented. Signed-off-by: Samuel Just Signed-off-by: Tomy Cheru --- src/mon/MonCommands.h | 2 +- src/mon/OSDMonitor.cc | 20 ++++++++++++++++++++ src/mon/OSDMonitor.h | 1 + src/osd/osd_types.h | 5 ++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index ab60dd02317b..5fa2079eed8c 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -739,7 +739,7 @@ COMMAND("osd pool get " \ "get pool parameter ", "osd", "r", "cli,rest") COMMAND("osd pool set " \ "name=pool,type=CephPoolname " \ - "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|debug_fake_ec_pool|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|auid|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block " \ + "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|debug_fake_ec_pool|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|auid|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|debug_white_box_testing_ec_overwrites " \ "name=val,type=CephString " \ "name=force,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \ "set pool parameter to ", "osd", "rw", "cli,rest") diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 7d8d259f1a61..6fa5fa67c181 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -77,6 +77,7 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon, const OSDMap& osdmap) OSDMonitor::OSDMonitor(CephContext *cct, Monitor *mn, Paxos *p, const string& service_name) : PaxosService(mn, p, service_name), + cct(cct), inc_osd_cache(g_conf->mon_osd_cache_size), full_osd_cache(g_conf->mon_osd_cache_size), thrash_map(0), thrash_last_up_osd(-1), @@ -5393,6 +5394,25 @@ int OSDMonitor::prepare_command_pool_set(map &cmdmap, ss << "expecting value 'true' or '1'"; return -EINVAL; } + } else if (var == "debug_white_box_testing_ec_overwrites") { + if (val == "true" || (interr.empty() && n == 1)) { + if (cct->check_experimental_feature_enabled( + "debug_white_box_testing_ec_overwrites")) { + p.flags |= pg_pool_t::FLAG_EC_OVERWRITES; + } else { + ss << "debug_white_box_testing_ec_overwrites is an experimental feature " + << "and must be enabled. Note, this feature does not yet actually " + << "work. This flag merely enables some of the preliminary support " + << "for testing purposes."; + return -ENOTSUP; + } + } else if (val == "false" || (interr.empty() && n == 0)) { + ss << "ec overwrites cannot be disabled once enabled"; + return -EINVAL; + } else { + ss << "expecting value 'true', 'false', '0', or '1'"; + return -EINVAL; + } } else if (var == "target_max_objects") { if (interr.length()) { ss << "error parsing int '" << val << "': " << interr; diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 8e55bf778d6f..103806175242 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -110,6 +110,7 @@ struct failure_info_t { }; class OSDMonitor : public PaxosService { + CephContext *cct; public: OSDMap osdmap; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 6454e69d6af2..f6e05b8f86ba 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1076,7 +1076,7 @@ struct pg_pool_t { enum { FLAG_HASHPSPOOL = 1<<0, // hash pg seed and pool together (instead of adding) FLAG_FULL = 1<<1, // pool is full - //UNUSED = 1<<2, + FLAG_EC_OVERWRITES = 1<<2, // enables overwrites, once enabled, cannot be disabled FLAG_INCOMPLETE_CLONES = 1<<3, // may have incomplete clones (bc we are/were an overlay) FLAG_NODELETE = 1<<4, // pool can't be deleted FLAG_NOPGCHANGE = 1<<5, // pool's pg and pgp num can't be changed @@ -1090,6 +1090,7 @@ struct pg_pool_t { switch (f) { case FLAG_HASHPSPOOL: return "hashpspool"; case FLAG_FULL: return "full"; + case FLAG_EC_OVERWRITES: return "ec_overwrites"; case FLAG_INCOMPLETE_CLONES: return "incomplete_clones"; case FLAG_NODELETE: return "nodelete"; case FLAG_NOPGCHANGE: return "nopgchange"; @@ -1119,6 +1120,8 @@ struct pg_pool_t { return FLAG_HASHPSPOOL; if (name == "full") return FLAG_FULL; + if (name == "ec_overwrites") + return FLAG_EC_OVERWRITES; if (name == "incomplete_clones") return FLAG_INCOMPLETE_CLONES; if (name == "nodelete") -- 2.47.3