]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: log monitor election events
authorSage Weil <sage@newdream.net>
Thu, 2 Apr 2009 13:34:50 +0000 (06:34 -0700)
committerSage Weil <sage@newdream.net>
Thu, 2 Apr 2009 13:34:50 +0000 (06:34 -0700)
src/TODO
src/mon/Elector.cc
src/mon/Monitor.cc
src/mon/Monitor.h

index 2a18ec996871f9ad27a1c2f0d923b40e7a64c389..71c032b0be42c1110d15673b989ade78464fd24f 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -29,11 +29,6 @@ v0.7.2
 v0.8
 - kill fill_trace
 - return extra inode(s) in reply (namely, unlink)?
-- allow mon to log messages
-  - log client mount successes, failures
-  - mon elections
-  - ?
-- test deep mounts on kclient
 - store root inode on mds
 - allow chmod/whatever of root inode
 
index 319d94645392e960626475aa528c67ff8b786c17..4322d149db8c7419fbc25d0ce6cb6f1a3384ac04 100644 (file)
@@ -178,7 +178,7 @@ void Elector::handle_propose(MMonElection *m)
       // a mon just started up, call a new election so they can rejoin!
       dout(5) << " got propose from old epoch, quorum is " << mon->quorum 
              << ", " << m->get_source() << " must have just started" << dendl;
-      mon->call_election();//start();
+      mon->call_election(false);//start();
     } else {
       dout(5) << " ignoring old propose" << dendl;
       delete m;
@@ -194,7 +194,7 @@ void Elector::handle_propose(MMonElection *m)
     } else {
       // wait, i should win!
       if (!electing_me)
-      mon->call_election();//start();
+       mon->call_election(false);//start();
     }
   } else {
     // they would win over me
@@ -220,7 +220,7 @@ void Elector::handle_ack(MMonElection *m)
   if (m->epoch > epoch) {
     dout(5) << "woah, that's a newer epoch, i must have rebooted.  bumping and re-starting!" << dendl;
     bump_epoch(m->epoch);
-    mon->call_election();//start();
+    mon->call_election(false);//start();
     delete m;
     return;
   }
@@ -257,7 +257,7 @@ void Elector::handle_victory(MMonElection *m)
   if (m->epoch != epoch + 1) { 
     dout(5) << "woah, that's a funny epoch, i must have rebooted.  bumping and re-starting!" << dendl;
     bump_epoch(m->epoch);
-    mon->call_election();//start();
+    mon->call_election(true);//start();
     delete m;
     return;
   }
index 855fd09e4e2de33135f7603c8dd86adc5dff7571..48aa8bc8b52477c573da0ba577037420c6c82d70 100644 (file)
@@ -158,10 +158,16 @@ void Monitor::shutdown()
 }
 
 
-void Monitor::call_election()
+void Monitor::call_election(bool is_new)
 {
   if (monmap->size() == 1) return;
   
+  if (is_new) {
+    stringstream ss;
+    ss << "mon" << whoami << " calling new monitor election";
+    logclient.log(LOG_INFO, ss);
+  }
+
   dout(10) << "call_election" << dendl;
   state = STATE_STARTING;
   
@@ -182,6 +188,10 @@ void Monitor::win_election(epoch_t epoch, set<int>& active)
   mon_epoch = epoch;
   quorum = active;
   dout(10) << "win_election, epoch " << mon_epoch << " quorum is " << quorum << dendl;
+
+  stringstream ss;
+  ss << "mon" << whoami << " won leader election";
+  logclient.log(LOG_INFO, ss);
   
   for (vector<Paxos*>::iterator p = paxos.begin(); p != paxos.end(); p++)
     (*p)->leader_init();
index ae3467ccb365cd6ab04bff5a5b11842d26b01a79..ed3c8279f2cbdfc63a7e64a5a43204ff5f3c0b7b 100644 (file)
@@ -99,7 +99,7 @@ public:
     return quorum.size() == monmap->size();
   }
 
-  void call_election();  // initiate election
+  void call_election(bool is_new=true);  // initiate election
   void win_election(epoch_t epoch, set<int>& q);         // end election (called by Elector)
   void lose_election(epoch_t epoch, set<int>& q, int l); // end election (called by Elector)