]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/DaemonServer: keep daemon in service map when it has no tasks 36047/head
authorKefu Chai <kchai@redhat.com>
Tue, 14 Jul 2020 09:48:59 +0000 (17:48 +0800)
committerNathan Cutler <ncutler@suse.com>
Sat, 18 Jul 2020 17:41:39 +0000 (19:41 +0200)
we should not remove a daemon from service map even if it has no task
running, as it is not an evidence that the service is removed from the
cluster.

this change partially reverts 5a7d0632d989536e09b2d916b5ea9713dc8dbea5

Fixes: https://tracker.ceph.com/issues/46495
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit bebc2ae1cbf45d8c58146b41d8f7cf2cd496955c)

src/mgr/DaemonServer.cc

index 2500e7d6577087f4df558af41c31ecb9fded01ca..2719441f6658667e27b6efd3952cdaaf32b282bf 100644 (file)
@@ -533,21 +533,10 @@ void DaemonServer::update_task_status(
 {
   dout(10) << "got task status from " << key << dendl;
 
-  bool service_map_dirty = false;
-  if (task_status.empty()) {
-    auto removed = pending_service_map.rm_daemon(key.type, key.name);
-    if (removed) {
-      service_map_dirty = true;
-    }
-  } else {
-    auto p = pending_service_map.get_daemon(key.type, key.name);
-    if (!map_compare(p.first->task_status, task_status)) {
-      service_map_dirty = true;
-      p.first->task_status = task_status;
-    }
-  }
-
-  if (service_map_dirty) {
+  [[maybe_unused]] auto [daemon, added] =
+    pending_service_map.get_daemon(key.type, key.name);
+  if (daemon->task_status != task_status) {
+    daemon->task_status = task_status;
     pending_service_map_dirty = pending_service_map.epoch;
   }
 }