]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: make PaxosService::update_from_paxos return void.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 6 Feb 2012 23:31:20 +0000 (15:31 -0800)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Wed, 8 Feb 2012 00:27:11 +0000 (16:27 -0800)
You can't really recover from a failed update (as PGMonitor was trying
to do), and nothing in the system checks the return values.
So rip out the return values and change failed updates to an assert
failure (most of the other Monitors continue to have decode exceptions,
but we can keep the pretty that we have).

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
13 files changed:
src/mon/AuthMonitor.cc
src/mon/AuthMonitor.h
src/mon/LogMonitor.cc
src/mon/LogMonitor.h
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h
src/mon/MonmapMonitor.cc
src/mon/MonmapMonitor.h
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/mon/PGMonitor.cc
src/mon/PGMonitor.h
src/mon/PaxosService.h

index 6cc002f8662ce556e6b63dfed3f8642a8509b00b..29c5e7dab0b6205e3071e111709cfee68338acad 100644 (file)
@@ -109,13 +109,13 @@ void AuthMonitor::create_initial()
   pending_auth.push_back(inc);
 }
 
-bool AuthMonitor::update_from_paxos()
+void AuthMonitor::update_from_paxos()
 {
   dout(10) << "update_from_paxos()" << dendl;
   version_t paxosv = paxos->get_version();
   version_t keys_ver = mon->key_server.get_ver();
   if (paxosv == keys_ver)
-    return true;
+    return;
   assert(paxosv >= keys_ver);
 
   if (keys_ver != paxos->get_stashed_version()) {
@@ -190,8 +190,6 @@ bool AuthMonitor::update_from_paxos()
   if (mon->is_leader() &&
       paxosv > max)
     paxos->trim_to(paxosv - max);
-
-  return true;
 }
 
 void AuthMonitor::increase_max_global_id()
index 056484540b4a465e29911e784b04d38034a6f0ac..c09abbe05cf58a07807697ec24b58e8b9b88919d 100644 (file)
@@ -94,7 +94,7 @@ private:
   void election_finished();
   bool should_propose(double& delay);
   void create_initial();
-  bool update_from_paxos();
+  void update_from_paxos();
   void create_pending();  // prepare a new pending
   bool prepare_global_id(MMonGlobalID *m);
   void increase_max_global_id();
index 2122aff362665e886f0451f1f6161f45c1fba2e5..199054d2747840ab4a8bf51222bf680c06ac0e8c 100644 (file)
@@ -90,11 +90,11 @@ void LogMonitor::create_initial()
   pending_log.insert(pair<utime_t,LogEntry>(e.stamp, e));
 }
 
-bool LogMonitor::update_from_paxos()
+void LogMonitor::update_from_paxos()
 {
   version_t paxosv = paxos->get_version();
   if (paxosv == summary.version)
-    return true;
+    return;
   assert(paxosv >= summary.version);
 
   bufferlist blog;
@@ -172,8 +172,6 @@ bool LogMonitor::update_from_paxos()
   unsigned max = g_conf->mon_max_log_epochs;
   if (mon->is_leader() && paxosv > max)
     paxos->trim_to(paxosv - max);
-
-  return true;
 }
 
 void LogMonitor::create_pending()
index da4c8d4cedadbc03b64480157dcbc1af06c10e47..38d11f132d61d8176acafa676beabc6d5de43c61 100644 (file)
@@ -34,7 +34,7 @@ private:
   LogSummary pending_summary, summary;
 
   void create_initial();
-  bool update_from_paxos();
+  void update_from_paxos();
   void create_pending();  // prepare a new pending
   void encode_pending(bufferlist &bl);  // propose pending update to peers
 
index e704300e8541bb057f14b17ce02e276f532e5723..96a69fca45119d644c733841814b407562476e95 100644 (file)
@@ -80,11 +80,11 @@ void MDSMonitor::create_initial()
 }
 
 
-bool MDSMonitor::update_from_paxos()
+void MDSMonitor::update_from_paxos()
 {
   version_t paxosv = paxos->get_version();
   if (paxosv == mdsmap.epoch)
-    return true;
+    return;
   assert(paxosv >= mdsmap.epoch);
 
   dout(10) << "update_from_paxos paxosv " << paxosv 
@@ -106,8 +106,6 @@ bool MDSMonitor::update_from_paxos()
 
   check_subs();
   update_logger();
-
-  return true;
 }
 
 void MDSMonitor::create_pending()
index 0b162375b9f9b472c86e87d5549aaee4e6ea7df7..cf869aef5eb089501757f285236f0f3f9c2ebb9f 100644 (file)
@@ -67,7 +67,7 @@ class MDSMonitor : public PaxosService {
 
   // service methods
   void create_initial();
-  bool update_from_paxos();
+  void update_from_paxos();
   void create_pending(); 
   void encode_pending(bufferlist &bl);
 
index 4d30561e1da1098ae50c69bd06d398f620a109d2..1ef58906c8295a162ebb66fce2184e0704125d7a 100644 (file)
@@ -47,12 +47,12 @@ void MonmapMonitor::create_initial()
   pending_map.epoch = 1;
 }
 
-bool MonmapMonitor::update_from_paxos()
+void MonmapMonitor::update_from_paxos()
 {
   version_t paxosv = paxos->get_version();
   if (paxosv <= paxos->get_stashed_version() &&
       paxosv <= mon->monmap->get_epoch())
-    return true;
+    return;
 
   dout(10) << "update_from_paxos paxosv " << paxosv
           << ", my v " << mon->monmap->epoch << dendl;
@@ -86,7 +86,6 @@ bool MonmapMonitor::update_from_paxos()
 
   if (need_restart)
     mon->bootstrap();
-  return true;
 }
 
 void MonmapMonitor::create_pending()
index 0393de9dff0ec17d14ef64fdaa8efd5c6b110680..2f0d01fa5343d787f5e0614a0c2b2d103e925968 100644 (file)
@@ -45,7 +45,7 @@ class MonmapMonitor : public PaxosService {
 
   void create_initial();
 
-  bool update_from_paxos();
+  void update_from_paxos();
 
   void create_pending();
 
index e9e6a5fa592ad93f60eb757fd1a49f87007ca417..139d5f943b922a80614d94db9e022acc7d4d4968 100644 (file)
@@ -86,11 +86,11 @@ void OSDMonitor::create_initial()
   newmap.encode(pending_inc.fullmap);
 }
 
-bool OSDMonitor::update_from_paxos()
+void OSDMonitor::update_from_paxos()
 {
   version_t paxosv = paxos->get_version();
   if (paxosv == osdmap.epoch)
-    return true;
+    return;
   assert(paxosv >= osdmap.epoch);
 
   dout(15) << "update_from_paxos paxos e " << paxosv 
@@ -146,8 +146,6 @@ bool OSDMonitor::update_from_paxos()
 
   share_map_with_random_osd();
   update_logger();
-
-  return true;
 }
 
 void OSDMonitor::on_active()
index 5cf95fe107bfcfd9ee1b201baac48e76c3db5846..f3b42b0b33ae177977d5e53f26624c18c117da89 100644 (file)
@@ -53,7 +53,7 @@ private:
 public:  
   void create_initial();
 private:
-  bool update_from_paxos();
+  void update_from_paxos();
   void create_pending();  // prepare a new pending
   void encode_pending(bufferlist &bl);
   void on_active();
index 2af59255c0f2c9de6063d1641d9bee4f4dc9c5d8..c2b0566972f7e57d250a5978fdde356f70b8f69b 100644 (file)
@@ -197,11 +197,11 @@ void PGMonitor::create_initial()
   dout(10) << "create_initial -- creating initial map" << dendl;
 }
 
-bool PGMonitor::update_from_paxos()
+void PGMonitor::update_from_paxos()
 {
   version_t paxosv = paxos->get_version();
   if (paxosv == pg_map.version)
-    return true;
+    return;
   assert(paxosv >= pg_map.version);
 
   if (pg_map.version != paxos->get_stashed_version()) {
@@ -217,7 +217,8 @@ bool PGMonitor::update_from_paxos()
     catch (const std::exception &e) {
       dout(0) << "update_from_paxos: error parsing update: "
              << e.what() << dendl;
-      return false;
+      assert(0 == "update_from_paxos: error parsing update");
+      return;
     }
   } 
 
@@ -237,7 +238,8 @@ bool PGMonitor::update_from_paxos()
     catch (const std::exception &e) {
       dout(0) << "update_from_paxos: error parsing "
              << "incremental update: " << e.what() << dendl;
-      return false;
+      assert(0 == "update_from_paxos: error parsing incremental update");
+      return;
     }
 
     pg_map.apply_incremental(inc);
@@ -272,8 +274,6 @@ bool PGMonitor::update_from_paxos()
   send_pg_creates();
 
   update_logger();
-
-  return true;
 }
 
 void PGMonitor::handle_osd_timeouts()
index 65204b36d501a6ec669144a99cf27f3377d2431b..42ba9c4dd882efdd827bb5eec6886dae59beceae 100644 (file)
@@ -53,7 +53,7 @@ private:
   PGMap::Incremental pending_inc;
 
   void create_initial();
-  bool update_from_paxos();
+  void update_from_paxos();
   void handle_osd_timeouts();
   void create_pending();  // prepare a new pending
   void encode_pending(bufferlist &bl);  // propose pending update to peers
index c8dc93bd7cf72d2690096be96854718d88042fb3..43e92823b7b036330cbcfadbd1c13235662e02c7 100644 (file)
@@ -96,7 +96,7 @@ public:
    * it's newer than the current Monitor state.
    * Return true on success.
    */
-  virtual bool update_from_paxos() = 0;
+  virtual void update_from_paxos() = 0;
 
   /*
    * This function is only called on a leader. Create the pending state.