From 131686980f0a930d5de7cbce8234fead5bd438b6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 26 Jun 2013 06:52:01 -0700 Subject: [PATCH] mon/PaxosService: add post_paxos_update() hook Some services need to update internal state based on other service's state, and thus need to be run after everyone has pulled their info out of paxos. Backport: cuttlefish Signed-off-by: Sage Weil --- src/mon/Monitor.cc | 3 +++ src/mon/PaxosService.h | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 4e428a88144..42bf9d5ac0b 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -537,6 +537,9 @@ void Monitor::refresh_from_paxos(bool *need_bootstrap) for (int i = 0; i < PAXOS_NUM; ++i) { paxos_service[i]->refresh(need_bootstrap); } + for (int i = 0; i < PAXOS_NUM; ++i) { + paxos_service[i]->post_paxos_update(); + } } void Monitor::register_cluster_logger() diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 8cd8908556b..4981c34be47 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -347,6 +347,14 @@ public: */ virtual void update_from_paxos(bool *need_bootstrap) = 0; + /** + * Hook called after all services have refreshed their state from paxos + * + * This is useful for doing any update work that depends on other + * service's having up-to-date state. + */ + virtual void post_paxos_update() {} + /** * Init on startup * -- 2.47.3