]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: relax "pending_service_map.epoch > service_map.epoch" assert 46688/head
authorMykola Golub <mgolub@suse.com>
Thu, 21 Apr 2022 08:57:25 +0000 (11:57 +0300)
committerMykola Golub <mgolub@suse.com>
Wed, 15 Jun 2022 09:04:52 +0000 (12:04 +0300)
When we are activating we may receive several service map updates
initiated by the previous active mgr. Treat them all as initial map.

The code also adds "pending_service_map_dirty == 0" assert, which we
expect is true when receiving an initial map -- otherwise we can't
just initialize pending_service_map with received map.

Fixes: https://tracker.ceph.com/issues/51835
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit cc2721ccdb33248a732abd1919df808ef8a1f80f)

src/mgr/DaemonServer.cc

index 1ab00e0afd6f393606b0f1363b2800b37e82ec96..87d5cc5cb48086bcc953891cb1ade5dab7db5c50 100644 (file)
@@ -2982,13 +2982,19 @@ void DaemonServer::got_service_map()
       if (pending_service_map.epoch == 0) {
        // we just started up
        dout(10) << "got initial map e" << service_map.epoch << dendl;
+       ceph_assert(pending_service_map_dirty == 0);
+       pending_service_map = service_map;
+       pending_service_map.epoch = service_map.epoch + 1;
+      } else if (pending_service_map.epoch <= service_map.epoch) {
+       // we just started up but got one more not our own map
+       dout(10) << "got newer initial map e" << service_map.epoch << dendl;
+       ceph_assert(pending_service_map_dirty == 0);
        pending_service_map = service_map;
        pending_service_map.epoch = service_map.epoch + 1;
       } else {
-       // we we already active and therefore must have persisted it,
+       // we already active and therefore must have persisted it,
        // which means ours is the same or newer.
        dout(10) << "got updated map e" << service_map.epoch << dendl;
-       ceph_assert(pending_service_map.epoch > service_map.epoch);
       }
     });