From 264eb5627066b79d336cfb677c1a36a9c518e855 Mon Sep 17 00:00:00 2001 From: Dan van der Ster Date: Thu, 8 Apr 2021 12:12:55 +0200 Subject: [PATCH] mon: load stashed map before mkfs monmap After mkfs the store may not yet contain monmap:last_committed but might be respawning after setting mon_sync:temp_newer_monmap. Load that stashed map before falling back to the mkfs:monmap. Fixes: https://tracker.ceph.com/issues/50230 Signed-off-by: Dan van der Ster (cherry picked from commit cc0b4c77753962717da8a280a585990f7eec3c7b) --- src/ceph_mon.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 24bfe1b7c74e0..61804469f2df7 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -109,6 +109,14 @@ int obtain_monmap(MonitorDBStore &store, bufferlist &bl) } } + if (store.exists("mon_sync", "temp_newer_monmap")) { + dout(10) << __func__ << " found temp_newer_monmap" << dendl; + int err = store.get("mon_sync", "temp_newer_monmap", bl); + ceph_assert(err == 0); + ceph_assert(bl.length() > 0); + return 0; + } + if (store.exists("mkfs", "monmap")) { dout(10) << __func__ << " found mkfs monmap" << dendl; int err = store.get("mkfs", "monmap", bl); -- 2.39.5