From fca79085db306dd2e54368d7c3d8e2575856712f Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 8 Aug 2011 13:48:29 -0700 Subject: [PATCH] pgmon: call check_osd_map via a new on_active implementation Previously it was possible to lose PG creations if a monitor election happened at the right time. The issue would get rectified on the next OSDMap update, but that could take...a while. (My observed time when I discovered the bug had it go without creation for 43 minutes, at which point I killed it.) Signed-off-by: Greg Farnum --- src/mon/PGMonitor.cc | 9 ++++++++- src/mon/PGMonitor.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index c48e671097986..265817c001324 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -90,6 +90,13 @@ void PGMonitor::on_election_start() last_osd_report.clear(); } +void PGMonitor::on_active() +{ + if (mon->is_leader()) { + check_osd_map(mon->osdmon()->osdmap.epoch); + } +} + void PGMonitor::tick() { if (!paxos->is_active()) return; @@ -654,7 +661,7 @@ bool PGMonitor::register_new_pgs() new_pool); } } - } + } int max = MIN(osdmap->get_max_osd(), osdmap->crush.get_max_devices()); int removed = 0; diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h index eb9facae0c1f9..a8280bab81d98 100644 --- a/src/mon/PGMonitor.h +++ b/src/mon/PGMonitor.h @@ -102,6 +102,11 @@ public: virtual void on_election_start(); + /* Courtesy function provided by PaxosService, called when an election + * finishes and the cluster goes active. We use it here to make sure we + * haven't lost any PGs from new pools. */ + virtual void on_active(); + void tick(); // check state, take actions void check_osd_map(epoch_t epoch); -- 2.39.5