From 689a8d283908e6700966a50ead74e09f7cb7e987 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 6 Aug 2008 11:16:20 -0700 Subject: [PATCH] mon: read() needn't check is_readable() --- src/mon/ClientMonitor.cc | 26 +++++++++++--------------- src/mon/PGMonitor.cc | 21 +++++++++------------ src/mon/Paxos.cc | 5 ----- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/mon/ClientMonitor.cc b/src/mon/ClientMonitor.cc index 03735d643665e..83b5d47835333 100644 --- a/src/mon/ClientMonitor.cc +++ b/src/mon/ClientMonitor.cc @@ -63,21 +63,17 @@ bool ClientMonitor::update_from_paxos() while (paxosv > client_map.version) { bufferlist bl; bool success = paxos->read(client_map.version+1, bl); - if (success) { - dout(7) << "update_from_paxos applying incremental " << client_map.version+1 << dendl; - Incremental inc; - bufferlist::iterator p = bl.begin(); - inc.decode(p); - client_map.apply_incremental(inc); - - dout(1) << client_map.client_addr.size() << " clients (+" - << inc.mount.size() << " -" << inc.unmount.size() << ")" - << dendl; - - } else { - dout(7) << "update_from_paxos couldn't read incremental " << client_map.version+1 << dendl; - return false; - } + assert(success); + + dout(7) << "update_from_paxos applying incremental " << client_map.version+1 << dendl; + Incremental inc; + bufferlist::iterator p = bl.begin(); + inc.decode(p); + client_map.apply_incremental(inc); + + dout(1) << client_map.client_addr.size() << " clients (+" + << inc.mount.size() << " -" << inc.unmount.size() << ")" + << dendl; } // save latest diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 8a0fc4ebc74a9..8ed2f82a305ad 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -128,18 +128,15 @@ bool PGMonitor::update_from_paxos() while (paxosv > pg_map.version) { bufferlist bl; bool success = paxos->read(pg_map.version+1, bl); - if (success) { - dout(7) << "update_from_paxos applying incremental " << pg_map.version+1 << dendl; - PGMap::Incremental inc; - bufferlist::iterator p = bl.begin(); - inc.decode(p); - pg_map.apply_incremental(inc); - - dout(0) << *this << dendl; - } else { - dout(7) << "update_from_paxos couldn't read incremental " << pg_map.version+1 << dendl; - return false; - } + assert(success); + + dout(7) << "update_from_paxos applying incremental " << pg_map.version+1 << dendl; + PGMap::Incremental inc; + bufferlist::iterator p = bl.begin(); + inc.decode(p); + pg_map.apply_incremental(inc); + + dout(0) << *this << dendl; } // save latest diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index b4a62f5e50c14..2c751ec27a89f 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -779,9 +779,6 @@ bool Paxos::is_readable() bool Paxos::read(version_t v, bufferlist &bl) { - if (!is_readable()) - return false; - if (!mon->store->get_bl_sn(bl, machine_name, v)) return false; return true; @@ -789,8 +786,6 @@ bool Paxos::read(version_t v, bufferlist &bl) version_t Paxos::read_current(bufferlist &bl) { - if (!is_readable()) - return 0; if (read(last_committed, bl)) return last_committed; return 0; -- 2.39.5