]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: relax "pending_service_map.epoch > service_map.epoch" assert
authorMykola Golub <mgolub@suse.com>
Thu, 21 Apr 2022 08:57:25 +0000 (11:57 +0300)
committerVikhyat Umrao <vikhyat@redhat.com>
Fri, 19 Aug 2022 05:02:30 +0000 (10:32 +0530)
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)
(cherry picked from commit 7fc2f0f675a8c9da7cc1563854ab79578f906f1e)

Resolves: rhbz#1984881

src/mgr/DaemonServer.cc

index fd493a8d947d8ba29f0a2b6135d0108e9ee9528e..39647ff796a495118a5cd3c9281730cd05ca311f 100644 (file)
@@ -2937,13 +2937,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);
       }
     });