]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: set purged_snapdirs OSDMap flag once snapsets have all converted 17333/head
authorSage Weil <sage@redhat.com>
Tue, 29 Aug 2017 04:01:19 +0000 (00:01 -0400)
committerSage Weil <sage@redhat.com>
Wed, 30 Aug 2017 19:16:15 +0000 (15:16 -0400)
This makes it easier to test whether the upgrade + conversion has
completed.  In particular, mimic+ will be able to simply test for this
flag without waiting for complete PG stats to know whether it is safe to
upgrade beyond luminous.

Signed-off-by: Sage Weil <sage@redhat.com>
src/include/rados.h
src/mon/MgrStatMonitor.h
src/mon/OSDMonitor.cc
src/mon/PGMap.h
src/osd/OSDMap.cc

index d8bce989172a472fc8b39f10aab38b8301d9a329..a5dcbfaa76d2c4233132cbbdc2abdb4975e25ce3 100644 (file)
@@ -156,13 +156,15 @@ extern const char *ceph_osd_state_name(int s);
 #define CEPH_OSDMAP_REQUIRE_KRAKEN   (1<<17) /* require kraken for booting osds */
 #define CEPH_OSDMAP_REQUIRE_LUMINOUS (1<<18) /* require l for booting osds */
 #define CEPH_OSDMAP_RECOVERY_DELETES (1<<19) /* deletes performed during recovery instead of peering */
+#define CEPH_OSDMAP_PURGED_SNAPDIRS  (1<<20) /* osds have converted snapsets */
 
 /* these are hidden in 'ceph status' view */
 #define CEPH_OSDMAP_SEMIHIDDEN_FLAGS (CEPH_OSDMAP_REQUIRE_JEWEL|       \
                                      CEPH_OSDMAP_REQUIRE_KRAKEN |      \
                                      CEPH_OSDMAP_REQUIRE_LUMINOUS |    \
                                      CEPH_OSDMAP_RECOVERY_DELETES |    \
-                                     CEPH_OSDMAP_SORTBITWISE)
+                                     CEPH_OSDMAP_SORTBITWISE |         \
+                                     CEPH_OSDMAP_PURGED_SNAPDIRS)
 #define CEPH_OSDMAP_LEGACY_REQUIRE_FLAGS (CEPH_OSDMAP_REQUIRE_JEWEL |  \
                                          CEPH_OSDMAP_REQUIRE_KRAKEN |  \
                                          CEPH_OSDMAP_REQUIRE_LUMINOUS)
index c1846a5447798e8fc2a3258581dd4b6da8f86270..1dc264f86b6d06671f5634d023146b4d93eda0e3 100644 (file)
@@ -37,6 +37,10 @@ public:
   void encode_pending(MonitorDBStore::TransactionRef t) override;
   version_t get_trim_to() override;
 
+  bool definitely_converted_snapsets() const {
+    return digest.definitely_converted_snapsets();
+  }
+
   bool preprocess_query(MonOpRequestRef op) override;
   bool prepare_update(MonOpRequestRef op) override;
 
index 8442a606b70cb1efec457662104be2b70c9ec79d..fdf004bfb65c75ce0c1c0489ecfcb935fc8ac892 100644 (file)
@@ -240,7 +240,9 @@ void OSDMonitor::create_initial()
     derr << __func__ << " mon_debug_no_require_luminous=true" << dendl;
   } else {
     newmap.require_osd_release = CEPH_RELEASE_LUMINOUS;
-    newmap.flags |= CEPH_OSDMAP_RECOVERY_DELETES;
+    newmap.flags |=
+      CEPH_OSDMAP_RECOVERY_DELETES |
+      CEPH_OSDMAP_PURGED_SNAPDIRS;
     newmap.full_ratio = g_conf->mon_osd_full_ratio;
     if (newmap.full_ratio > 1.0) newmap.full_ratio /= 100;
     newmap.backfillfull_ratio = g_conf->mon_osd_backfillfull_ratio;
@@ -3325,6 +3327,15 @@ void OSDMonitor::tick()
       do_propose = true;
     }
   }
+  if (!osdmap.test_flag(CEPH_OSDMAP_PURGED_SNAPDIRS) &&
+      osdmap.require_osd_release >= CEPH_RELEASE_LUMINOUS &&
+      mon->mgrstatmon()->is_readable() &&
+      mon->mgrstatmon()->definitely_converted_snapsets()) {
+    dout(1) << __func__ << " all snapsets converted, setting purged_snapdirs"
+           << dendl;
+    add_flag(CEPH_OSDMAP_PURGED_SNAPDIRS);
+    do_propose = true;
+  }
 
   // mark osds down?
   if (check_failures(now))
index 3432f796633cf07c25e91a434c8a5a4d6b1ee705..257a9c75aaf839c1d3488553b52d682c0f4834e9 100644 (file)
@@ -188,6 +188,15 @@ public:
       return 0;
   }
 
+  // kill me post-mimic or -nautilus
+  bool definitely_converted_snapsets() const {
+    // false negative is okay; false positive is not!
+    return
+      num_pg &&
+      num_pg_unknown == 0 &&
+      pg_sum.stats.sum.num_legacy_snapsets == 0;
+  }
+
   // kill me post-luminous:
   virtual float get_fallback_full_ratio() const {
     return .95;
index 99a768897c142ec97f1182ee143752c12e35b172..dc78ab9a83f299465d407e3fa84b93bf63f01a34 100644 (file)
@@ -2947,6 +2947,8 @@ string OSDMap::get_flag_string(unsigned f)
     s += ",require_luminous_osds";
   if (f & CEPH_OSDMAP_RECOVERY_DELETES)
     s += ",recovery_deletes";
+  if (f & CEPH_OSDMAP_PURGED_SNAPDIRS)
+    s += ",purged_snapdirs";
   if (s.length())
     s.erase(0, 1);
   return s;