summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-26 06:52:01 -0700
committerSage Weil <sage@inktank.com>2013-06-28 15:42:51 -0700
commit4d07fb014178da3c88edeb8765e1aaacb8cb8ffa (patch)
treec2c0f49a12efea0a5bbde8bda9d1cef669d4c1bf
parent90f5c448abeb127ae5a5528a79bd7bdbc74cb497 (diff)
downloadceph-4d07fb014178da3c88edeb8765e1aaacb8cb8ffa.tar.gz
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 <sage@inktank.com> (cherry picked from commit 131686980f0a930d5de7cbce8234fead5bd438b6)
-rw-r--r--src/mon/Monitor.cc3
-rw-r--r--src/mon/PaxosService.h8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 5d7811c3916..89778053cfc 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -531,6 +531,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 100ec4f52fd..5ede4adf020 100644
--- a/src/mon/PaxosService.h
+++ b/src/mon/PaxosService.h
@@ -341,6 +341,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
*
* This is called on mon startup, after all of the PaxosService instances'