]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: verbose douts in get_trim_to
authorDan van der Ster <daniel.vanderster@cern.ch>
Fri, 13 Nov 2020 21:41:01 +0000 (22:41 +0100)
committerDan van der Ster <daniel.vanderster@cern.ch>
Tue, 17 Nov 2020 08:30:53 +0000 (09:30 +0100)
OSDMaps are occasionally not trimmed for mysterious reasons,
e.g. if a cluster erroniously has creating PGs. To help debugging
such problems we should print out the reason and value of trim_to
explicitly in all cases.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
src/mon/OSDMonitor.cc

index 150d9393bf6fe7af0195169c0035308cef2c0c86..fdc6f481e063e339285bc9ecfa0c43c216122ecd 100644 (file)
@@ -2248,13 +2248,14 @@ void OSDMonitor::share_map_with_random_osd()
 version_t OSDMonitor::get_trim_to() const
 {
   if (mon->get_quorum().empty()) {
-    dout(10) << __func__ << ": quorum not formed" << dendl;
+    dout(10) << __func__ << " quorum not formed, trim_to = 0" << dendl;
     return 0;
   }
 
   {
     std::lock_guard<std::mutex> l(creating_pgs_lock);
     if (!creating_pgs.pgs.empty()) {
+      dout(10) << __func__ << " pgs creating, trim_to = 0" << dendl;
       return 0;
     }
   }
@@ -2262,8 +2263,8 @@ version_t OSDMonitor::get_trim_to() const
   if (g_conf().get_val<bool>("mon_debug_block_osdmap_trim")) {
     dout(0) << __func__
             << " blocking osdmap trim"
-               " ('mon_debug_block_osdmap_trim' set to 'true')"
-            << dendl;
+            << " ('mon_debug_block_osdmap_trim' set to 'true')"
+            << " trim_to = 0" << dendl;
     return 0;
   }
 
@@ -2273,7 +2274,8 @@ version_t OSDMonitor::get_trim_to() const
     if (g_conf()->mon_osd_force_trim_to > 0 &&
        g_conf()->mon_osd_force_trim_to < (int)get_last_committed()) {
       floor = g_conf()->mon_osd_force_trim_to;
-      dout(10) << " explicit mon_osd_force_trim_to = " << floor << dendl;
+      dout(10) << __func__
+               << " explicit mon_osd_force_trim_to = " << floor << dendl;
     }
     unsigned min = g_conf()->mon_min_osdmap_epochs;
     if (floor + min > get_last_committed()) {
@@ -2282,9 +2284,12 @@ version_t OSDMonitor::get_trim_to() const
       else
        floor = 0;
     }
-    if (floor > get_first_committed())
+    if (floor > get_first_committed()) {
+      dout(10) << __func__ << " trim_to = " << floor << dendl;
       return floor;
+    }
   }
+  dout(10) << __func__ << " trim_to = 0" << dendl;
   return 0;
 }