]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/DaemonServer: keep daemon in service map when it has no tasks 36183/head
authorKefu Chai <kchai@redhat.com>
Tue, 14 Jul 2020 09:48:59 +0000 (17:48 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 8 Apr 2021 12:26:07 +0000 (14:26 +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)

Conflicts:
src/mgr/DaemonServer.cc

src/mgr/DaemonServer.cc

index a258730aa21c7028c810b95b2be9a0bdba51d864..eb2659e277b9da9af51599404e2904610a7397ae 100644 (file)
@@ -532,21 +532,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;
   }
 }