From: shimin Date: Sun, 8 Oct 2023 11:15:09 +0000 (+0800) Subject: mon: fix mds metadata lost in one case. X-Git-Tag: testing/wip-pdonnell-testing-20240430.123648-reef-debug~390^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=cbb7bf0274bbdad8658c306fbf775fe1898065be;p=ceph-ci.git mon: fix mds metadata lost in one case. In most cases, peon's pending_metadata is inconsistent with mon's db. When a peon turns into leader, and at the same time a active mds stops, the new leader may flush wrong mds metadata into db. So we meed to update mds metadata from db at every fsmap change. This phenomenon can be reproduce like this: A Cluster with 3 mon and 3 mds (one active, other two standby), 6 osd. step 1. stop two standby mds; step 2. restart all mon; (make pending_medata consistent with db) step 3. start other two mds step 4. stop leader mon step 5. run "ceph mds metadata" command to check mds metadata step 6. stop active mds step 7. run "ceph mds metadata" command to check mds metadata again In step 7, we would find mds metadata lost. Fixes: https://tracker.ceph.com/issues/63166 Signed-off-by: shimin (cherry picked from commit 56cbf3f0716b556c815487d719abe86021125925) --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 4b27d828c89..0ac5060f79c 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -136,6 +136,7 @@ void MDSMonitor::update_from_paxos(bool *need_bootstrap) << ", my e " << get_fsmap().epoch << dendl; ceph_assert(version > get_fsmap().epoch); + load_metadata(pending_metadata); load_health(); // read and decode