]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: do not send metrics until the MDS rank is ready 52500/head
authorXiubo Li <xiubli@redhat.com>
Thu, 1 Jun 2023 12:00:01 +0000 (20:00 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 18 Jul 2023 02:33:35 +0000 (10:33 +0800)
In some cases when there are a lot of clients and these clients
have a lots of known requests need to replay too, the metrics
requests will be dropped by the MDS because the MDS is still in
the clientreplay state, and also the useless metric requests will
slow down MDS.

Fixes: https://tracker.ceph.com/issues/61523
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit a423e17d5bbd095af4472c087dbbc6ac0c5e9e61)

src/client/Client.cc

index 52980d5ecb07ca185b4a154bbb11b69a7afcb643..2e1b5aa7893d87c161a47cbab9ea1fb32bdbb7fd 100644 (file)
@@ -6850,6 +6850,13 @@ void Client::collect_and_send_global_metrics() {
   ldout(cct, 20) << __func__ << dendl;
   ceph_assert(ceph_mutex_is_locked_by_me(client_lock));
 
+  /* Do not send the metrics until the MDS rank is ready */
+  if (!mdsmap->is_active((mds_rank_t)0)) {
+    ldout(cct, 5) << __func__ << " MDS rank 0 is not ready yet -- not sending metric"
+                  << dendl;
+    return;
+  }
+
   if (!have_open_session((mds_rank_t)0)) {
     ldout(cct, 5) << __func__ << ": no session with rank=0 -- not sending metric"
                   << dendl;