From: Sage Weil Date: Fri, 18 Apr 2014 18:12:23 +0000 (-0700) Subject: mon: wait for PaxosService readable in handle_get_version X-Git-Tag: v0.80-rc1~19^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09985d25a8b5d419bfb6153bf5a7985f78486470;p=ceph.git mon: wait for PaxosService readable in handle_get_version We were waiting for the election to finish, but we need to *also* wait for paxos to recover. Being a peon or leader is not sufficient and we may return a map that is still old. Fixes: #7997 Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index ae1c857d13f2a..b548f31bdf98d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3538,7 +3538,6 @@ void Monitor::handle_get_version(MMonGetVersion *m) { dout(10) << "handle_get_version " << *m << dendl; PaxosService *svc = NULL; - MMonGetVersionReply *reply = NULL; MonSession *s = static_cast(m->get_connection()->get_priv()); if (!s) { @@ -3553,22 +3552,27 @@ void Monitor::handle_get_version(MMonGetVersion *m) goto out; } - MMonGetVersionReply *reply = new MMonGetVersionReply(); - reply->handle = m->handle; if (m->what == "mdsmap") { - reply->version = mdsmon()->mdsmap.get_epoch(); - reply->oldest_version = mdsmon()->get_first_committed(); + svc = mdsmon(); } else if (m->what == "osdmap") { - reply->version = osdmon()->osdmap.get_epoch(); - reply->oldest_version = osdmon()->get_first_committed(); + svc = osdmon(); } else if (m->what == "monmap") { - reply->version = monmap->get_epoch(); - reply->oldest_version = monmon()->get_first_committed(); + svc = monmon(); } else { derr << "invalid map type " << m->what << dendl; } - messenger->send_message(reply, m->get_source_inst()); + if (svc) { + if (!svc->is_readable()) { + svc->wait_for_readable(new C_RetryMessage(this, m)); + goto out; + } + MMonGetVersionReply *reply = new MMonGetVersionReply(); + reply->handle = m->handle; + reply->version = svc->get_last_committed(); + reply->oldest_version = svc->get_first_committed(); + messenger->send_message(reply, m->get_source_inst()); + } m->put();