From: Sage Weil Date: Thu, 24 Jul 2014 01:21:38 +0000 (-0700) Subject: osd/osd_types: add pg_pool_t FLAG_COMPLETE_CLONES X-Git-Tag: v0.84~61^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=54bf055c5dadc55acf5731e08712d529b180ffc5;p=ceph.git osd/osd_types: add pg_pool_t FLAG_COMPLETE_CLONES Set a flag on the pg_pool_t when we change cache_mode NONE. This is because object promotion may promote heads without all of the clones, and when we switch the cache_mode back those objects may remain. Do this on any cache_mode change (to or from NONE) to capture legacy pools that were set up before this flag existed. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index d7734c5ffa9f0..e546647bd7219 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -5442,7 +5442,11 @@ done: } } // go - pending_inc.get_new_pool(pool_id, p)->cache_mode = mode; + pg_pool_t *np = pending_inc.get_new_pool(pool_id, p); + np->cache_mode = mode; + // set this both when moving to and from cache_mode NONE. this is to + // capture legacy pools that were set up before this flag existed. + np->flags |= pg_pool_t::FLAG_INCOMPLETE_CLONES; ss << "set cache-mode for pool '" << poolstr << "' to " << pg_pool_t::get_cache_mode_name(mode); wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, ss.str(), diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 6169e98092f9c..04a75db1cb420 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -813,9 +813,10 @@ struct pg_pool_t { } enum { - FLAG_HASHPSPOOL = 1, // hash pg seed and pool together (instead of adding) - FLAG_FULL = 2, // pool is full + FLAG_HASHPSPOOL = 1<<0, // hash pg seed and pool together (instead of adding) + FLAG_FULL = 1<<1, // pool is full FLAG_DEBUG_FAKE_EC_POOL = 1<<2, // require ReplicatedPG to act like an EC pg + FLAG_INCOMPLETE_CLONES = 1<<3, // may have incomplete clones (bc we are/were an overlay) }; static const char *get_flag_name(int f) { @@ -823,6 +824,7 @@ struct pg_pool_t { case FLAG_HASHPSPOOL: return "hashpspool"; case FLAG_FULL: return "full"; case FLAG_DEBUG_FAKE_EC_POOL: return "require_local_rollback"; + case FLAG_INCOMPLETE_CLONES: return "incomplete_clones"; default: return "???"; } } @@ -933,6 +935,8 @@ public: bool has_write_tier() const { return write_tier >= 0; } void clear_write_tier() { write_tier = -1; } void clear_tier_tunables() { + if (cache_mode != CACHEMODE_NONE) + flags |= FLAG_INCOMPLETE_CLONES; cache_mode = CACHEMODE_NONE; target_max_bytes = 0; @@ -986,6 +990,7 @@ public: void dump(Formatter *f) const; uint64_t get_flags() const { return flags; } + bool has_flag(uint64_t f) const { return flags & f; } /// This method will later return true for ec pools as well bool ec_pool() const { @@ -995,6 +1000,11 @@ public: return ec_pool() || flags & FLAG_DEBUG_FAKE_EC_POOL; } + /// true if incomplete clones may be present + bool allow_incomplete_clones() const { + return cache_mode != CACHEMODE_NONE || has_flag(FLAG_INCOMPLETE_CLONES); + } + unsigned get_type() const { return type; } unsigned get_size() const { return size; } unsigned get_min_size() const { return min_size; }