]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr: update mon metadata when monmap is updated
authorKefu Chai <kchai@redhat.com>
Sat, 16 Jan 2021 06:33:17 +0000 (14:33 +0800)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Fri, 26 Mar 2021 07:46:30 +0000 (14:46 +0700)
commitbb9d5f0bc88ee4fe4554435a4ed2f4cae5165498
tree9d748273a99e7c920e2a060efc978dcd0d8a453b
parent14db397c8c913d1587f8d137943fa6139acfa215
mgr: update mon metadata when monmap is updated

there is chance that some monitor(s) is updated / upgraded in a single
monmap update without being removed from cluster state's metata first,
so, without this change, we will not update the metadata associated with
that monitor, hence the mgr modules which consumes the metadata is not
updated accordingly and keep reporting the stale information.

in this change, we always update the metadata associated with all monitor
included by the latest monmap. multiple "mon metadata" commands are sent
to monitor for retrieving their updated metadata, instead of sending a
single one, so that we can reuse "MetadataUpdate" to update the metadata
of a given daemon. as the number of monitors in a typical cluster is
relatively small, and the frequency of monmap update is low, so this
overhead should be fine.

unlike other places where we ask mon for metadata in Mgr class, the code
sending the mon command for updated monitor metata is located outside of
`cluster_state.with_monmap()` block, the reason is that `with_monmap()`
is guraded by the monc_lock under the hood, while `start_mon_command()`
also need to acquire the monc_lock, which is not a recursive lock. so we
have to do this out of the `with_monmap()` block.

Fixes: https://tracker.ceph.com/issues/48905
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit c037f4cb5d7436879d58c34748ef516b5269781f)

backport:
  - path: src/mgr/Mgr.cc
    comment: octopus don't declared `fmt`
src/mgr/Mgr.cc