]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
* lots of fixes.
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 18 Jun 2007 22:20:49 +0000 (22:20 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 18 Jun 2007 22:20:49 +0000 (22:20 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1425 29311d96-e01e-0410-9327-a35deaab8ce9

19 files changed:
branches/sage/mon2/TODO
branches/sage/mon2/cmonctl.cc
branches/sage/mon2/config.cc
branches/sage/mon2/config.h
branches/sage/mon2/cosd.cc
branches/sage/mon2/mds/MDS.cc
branches/sage/mon2/messages/MMDSBeacon.h
branches/sage/mon2/messages/MMonCommand.h
branches/sage/mon2/messages/MOSDBoot.h
branches/sage/mon2/messages/MOSDFailure.h
branches/sage/mon2/mon/ClientMonitor.cc
branches/sage/mon2/mon/MDSMonitor.cc
branches/sage/mon2/mon/OSDMonitor.cc
branches/sage/mon2/mon/OSDMonitor.h
branches/sage/mon2/mon/PaxosService.cc
branches/sage/mon2/mon/PaxosService.h
branches/sage/mon2/osd/OSD.cc
branches/sage/mon2/osd/OSDMap.h
branches/sage/mon2/osdc/Objecter.cc

index 17c6321345fb98760a74e1d94fb5c322301573f4..a908231cf01607b8256bf08ca0680f003f571f79 100644 (file)
@@ -150,19 +150,12 @@ foreign rename
 - rejoin will need to explicitly resolve uncommitted items.
   - fully implement link/unlink first, and use that as a model?
 
-monitor
-- finish generic paxos
-
 osdmon
-- distribute w/ paxos framework
 - allow fresh replacement osds.  add osd_created in osdmap, probably
 - monitor needs to monitor some osds...
 - monitor pg states, notify on out?
 - watch osd utilization; adjust overload in cluster map
 
-mdsmon
-- distribute w/ paxos framework
-
 journaler
 - fix up for large events (e.g. imports)
 - use set_floor_and_read for safe takeover from possibly-not-quite-dead otherguy.
index 19148942acc76608aa6cda8867764ee25788266a..34bd80f9a4d8f065efab34381e98b45f252712cf 100644 (file)
@@ -64,8 +64,13 @@ int main(int argc, char **argv, char *envp[]) {
   int r = monmap.read(".ceph_monmap");
   assert(r >= 0);
   
+  // start up network
+  rank.start_rank();
+  messenger = rank.register_entity(entity_name_t(entity_name_t::TYPE_ADMIN));
+  messenger->set_dispatcher(&dispatcher);
+  
   // build command
-  MMonCommand *m = new MMonCommand;
+  MMonCommand *m = new MMonCommand(messenger->get_myinst());
   string cmd;
   for (unsigned i=0; i<args.size(); i++) {
     if (i) cmd += " ";
@@ -76,11 +81,6 @@ int main(int argc, char **argv, char *envp[]) {
 
   dout(0) << "mon" << mon << " <- '" << cmd << "'" << endl;
 
-  // start up network
-  rank.start_rank();
-  messenger = rank.register_entity(entity_name_t(entity_name_t::TYPE_ADMIN));
-  messenger->set_dispatcher(&dispatcher);
-  
   // send it
   messenger->send_message(m, monmap.get_inst(mon));
 
index ba61b6f1c97cd004c80065814ab782a2ad675c6d..a92ea5a3cab716211fce3792c4e61f1e24e8d856 100644 (file)
@@ -130,6 +130,7 @@ md_config_t g_conf = {
   mon_lease_ack_timeout: 10.0, // on leader, if lease isn't acked by all peons
   mon_lease_timeout: 10.0,     // on peon, if lease isn't extended
   mon_accept_timeout: 10.0,    // on leader, if paxos update isn't accepted
+  mon_stop_on_last_unmount: false,
   mon_stop_with_last_mds: false,
 
   // --- client ---
@@ -196,7 +197,6 @@ md_config_t g_conf = {
   mds_trim_on_rejoin: true,
   mds_commit_on_shutdown: true,
   mds_shutdown_check: 0, //30,
-  mds_shutdown_on_last_unmount: true,
 
   mds_verify_export_dirauth: true,
 
@@ -592,8 +592,6 @@ void parse_config_options(std::vector<char*>& args)
       g_conf.mds_commit_on_shutdown = atoi(args[++i]);
     else if (strcmp(args[i], "--mds_shutdown_check") == 0) 
       g_conf.mds_shutdown_check = atoi(args[++i]);
-    else if (strcmp(args[i], "--mds_shutdown_on_last_unmount") == 0) 
-      g_conf.mds_shutdown_on_last_unmount = atoi(args[++i]);
     else if (strcmp(args[i], "--mds_log_flush_on_shutdown") == 0) 
       g_conf.mds_log_flush_on_shutdown = atoi(args[++i]);
 
@@ -655,6 +653,8 @@ void parse_config_options(std::vector<char*>& args)
 
     else if (strcmp(args[i], "--mon_osd_down_out_interval") == 0)
       g_conf.mon_osd_down_out_interval = atoi(args[++i]);
+    else if (strcmp(args[i], "--mon_stop_on_last_unmount") == 0) 
+      g_conf.mon_stop_on_last_unmount = atoi(args[++i]);
     else if (strcmp(args[i], "--mon_stop_with_last_mds") == 0)
       g_conf.mon_stop_with_last_mds = atoi(args[++i]);
 
index f29d1a26701549ba17541f67ff2a62873c193669..ccf130533818a29496b4032a1d7aa7db127cf5cf 100644 (file)
@@ -118,6 +118,7 @@ struct md_config_t {
   float mon_lease_ack_timeout;
   float mon_lease_timeout;
   float mon_accept_timeout;
+  bool mon_stop_on_last_unmount;
   bool mon_stop_with_last_mds;
 
   // client
@@ -197,7 +198,6 @@ struct md_config_t {
   bool  mds_trim_on_rejoin;
   bool  mds_commit_on_shutdown;
   int   mds_shutdown_check;
-  bool  mds_shutdown_on_last_unmount;
 
   bool  mds_verify_export_dirauth;     // debug flag
 
index 800eacf5acd9a0151220cacf8eef3ca68a64a563..4f3c8ab71a19f667572db9141abd5c7441fcdfd7 100644 (file)
@@ -66,7 +66,8 @@ int main(int argc, char **argv)
   if (g_conf.clock_tare) g_clock.tare();
 
   // osd specific args
-  char *dev;
+  char *dev = 0;
+  char dev_default[20];
   int whoami = -1;
   for (unsigned i=0; i<args.size(); i++) {
     if (strcmp(args[i],"--dev") == 0) 
@@ -78,6 +79,13 @@ int main(int argc, char **argv)
       return -1;
     }
   }
+  if (whoami < 0) {
+    cerr << "must specify '--osd #' where # is the osd number" << endl;
+  }
+  if (!dev) {
+    sprintf(dev_default, "dev/osd%d", whoami);
+    dev = dev_default;
+  }
   cout << "dev " << dev << endl;
   
 
index 06d836a08148409f9b396df6bea451d157142e3d..f2e40bff824a49d375a672642a5eb92582496042 100644 (file)
@@ -364,7 +364,7 @@ void MDS::beacon_send()
   beacon_seq_stamp[beacon_last_seq] = g_clock.now();
   
   int mon = monmap->pick_mon();
-  messenger->send_message(new MMDSBeacon(want_state, beacon_last_seq),
+  messenger->send_message(new MMDSBeacon(messenger->get_myinst(), want_state, beacon_last_seq),
                          monmap->get_inst(mon));
 
   // schedule next sender
index 4789c809572c4a4732169b6f76053efcab9df5f9..d8b73a45a31227ece07d196a68504cb83f17feb7 100644 (file)
 #include "mds/MDSMap.h"
 
 class MMDSBeacon : public Message {
+  entity_inst_t inst;
   int state;
   version_t seq;
 
  public:
   MMDSBeacon() : Message(MSG_MDS_BEACON) {}
-  MMDSBeacon(int st, version_t se) : Message(MSG_MDS_BEACON), 
-                                    state(st), seq(se) { }
+  MMDSBeacon(entity_inst_t i, int st, version_t se) : 
+    Message(MSG_MDS_BEACON), 
+    inst(i), state(st), seq(se) { }
 
+  entity_inst_t& get_mds_inst() { return inst; }
   int get_state() { return state; }
   version_t get_seq() { return seq; }
   char *get_type_name() { return "mdsbeacon"; }
 
   void print(ostream& out) {
-    out << "mdsbeacon(" << MDSMap::get_state_name(state) 
+    out << "mdsbeacon(" << inst
+       << " " << MDSMap::get_state_name(state) 
        << " seq " << seq << ")";
   }
   
   void encode_payload() {
-    payload.append((char*)&state, sizeof(state));
-    payload.append((char*)&seq, sizeof(seq));
+    ::_encode(inst, payload);
+    ::_encode(state, payload);
+    ::_encode(seq, payload);
   }
   void decode_payload() {
     int off = 0;
-    payload.copy(off, sizeof(state), (char*)&state);
-    off += sizeof(state);
-    payload.copy(off, sizeof(seq), (char*)&seq);
-    off += sizeof(seq);
+    ::_decode(inst, payload, off);
+    ::_decode(state, payload, off);
+    ::_decode(seq, payload, off);
   }
 };
 
index d5fd8ae64017a8fdfa5cc75681d47425ae59106d..3ad110e623d4e34b26bccf4c1634b3494b82b238 100644 (file)
@@ -22,9 +22,13 @@ using std::vector;
 
 class MMonCommand : public Message {
  public:
+  entity_inst_t inst;
   vector<string> cmd;
 
   MMonCommand() : Message(MSG_MON_COMMAND) {}
+  MMonCommand(entity_inst_t &i) : 
+    Message(MSG_MON_COMMAND),
+    inst(i) { }
   
   virtual char *get_type_name() { return "mon_command"; }
   void print(ostream& o) {
@@ -37,10 +41,12 @@ class MMonCommand : public Message {
   }
   
   void encode_payload() {
+    ::_encode(inst, payload);
     ::_encode(cmd, payload);
   }
   void decode_payload() {
     int off = 0;
+    ::_decode(inst, payload, off);
     ::_decode(cmd, payload, off);
   }
 };
index 9ae5a68d6c59afa8e40674f6ba538546de0594ac..00c94ad1a2a801d93a3602e089ba7f30dc8d0ce7 100644 (file)
 
 class MOSDBoot : public Message {
  public:
+  entity_inst_t inst;
   OSDSuperblock sb;
 
   MOSDBoot() {}
-  MOSDBoot(OSDSuperblock& s) : 
+  MOSDBoot(entity_inst_t i, OSDSuperblock& s) : 
     Message(MSG_OSD_BOOT),
+    inst(i),
     sb(s) {
   }
 
-  char *get_type_name() { return "oboot"; }
+  char *get_type_name() { return "osd_boot"; }
+  void print(ostream& out) {
+    out << "osd_boot(" << inst << ")";
+  }
   
   void encode_payload() {
-    payload.append((char*)&sb, sizeof(sb));
+    ::_encode(inst, payload);
+    ::_encode(sb, payload);
   }
   void decode_payload() {
     int off = 0;
-    payload.copy(off, sizeof(sb), (char*)&sb);
-    off += sizeof(sb);
+    ::_decode(inst, payload, off);
+    ::_decode(sb, payload, off);
   }
 };
 
index 5bc7a5d5ee9f61a70fc19cd2773071236015fa87..965d622a5f5e22d13f9577500b9c3c695beaed8d 100644 (file)
 
 class MOSDFailure : public Message {
  public:
+  entity_inst_t from;
   entity_inst_t failed;
   epoch_t       epoch;
 
   MOSDFailure() {}
-  MOSDFailure(entity_inst_t f, epoch_t e) : 
+  MOSDFailure(entity_inst_t fr, entity_inst_t f, epoch_t e) : 
     Message(MSG_OSD_FAILURE),
-    failed(f), epoch(e) {}
+    from(fr), failed(f), epoch(e) {}
  
+  entity_inst_t get_from() { return from; }
   entity_inst_t get_failed() { return failed; }
   epoch_t get_epoch() { return epoch; }
 
   void decode_payload() {
     int off = 0;
-    payload.copy(off, sizeof(failed), (char*)&failed);
-    off += sizeof(failed);
-    payload.copy(off, sizeof(epoch), (char*)&epoch);
-    off += sizeof(epoch);
+    ::_decode(from, payload, off);
+    ::_decode(failed, payload, off);
+    ::_decode(epoch, payload, off);
   }
   void encode_payload() {
-    payload.append((char*)&failed, sizeof(failed));
-    payload.append((char*)&epoch, sizeof(epoch));
+    ::_encode(from, payload);
+    ::_encode(failed, payload);
+    ::_encode(epoch, payload);
   }
 
-  virtual char *get_type_name() { return "osdfail"; }
+  virtual char *get_type_name() { return "osd_failure"; }
+  void print(ostream& out) {
+    out << "osd_failure(" << failed << " e" << epoch << ")";
+  }
 };
 
 #endif
index 5debbda7cad4d9f77cbfb70d1fa491f29273d5b7..b97624b63e7a3c068491876ef69994d27bf46887 100644 (file)
@@ -224,10 +224,11 @@ void ClientMonitor::_unmounted(MClientUnmount *m)
   mon->messenger->send_message(m, m->inst);
 
   // auto-shutdown?
+  // (hack for fakesyn/newsyn, mostly)
   if (mon->is_leader() &&
       client_map.version > 1 &&
       client_map.client_addr.empty() && 
-      g_conf.mds_shutdown_on_last_unmount) {
+      g_conf.mon_stop_on_last_unmount) {
     dout(1) << "last client unmounted" << endl;
     mon->do_stop();
   }
index 0259133c4cd5915feb00bae27f87a7ccc02d9768..519f32cae7e5a8f0737a29ab467ef3ebd0e61577 100644 (file)
@@ -151,8 +151,7 @@ bool MDSMonitor::preprocess_query(Message *m)
 bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
 {
   dout(12) << "preprocess_beacon " << *m
-          << " from " << m->get_source()
-          << " " << m->get_source_inst()
+          << " from " << m->get_mds_inst()
           << endl;
 
   // fw to leader?
@@ -163,7 +162,7 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
   }
 
   // let's see.
-  int from = m->get_source().num();
+  int from = m->get_mds_inst().name.num();
   int state = m->get_state();
   version_t seq = m->get_seq();
 
@@ -172,7 +171,7 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
   // boot?
   if (state == MDSMap::STATE_BOOT) {
     // already booted?
-    int already = mdsmap.get_addr_rank(m->get_source_addr());
+    int already = mdsmap.get_addr_rank(m->get_mds_inst().addr);
     if (already < 0) 
       return false;  // need to update map
     
@@ -190,8 +189,8 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
   // reply to beacon?
   if (state != MDSMap::STATE_OUT) {
     last_beacon[from] = g_clock.now();  // note time
-    mon->messenger->send_message(new MMDSBeacon(state, seq), 
-                                m->get_source_inst());
+    mon->messenger->send_message(new MMDSBeacon(m->get_mds_inst(), state, seq), 
+                                m->get_mds_inst());
   }
   
   // is there a state change here?
@@ -235,10 +234,9 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
 {
   // -- this is an update --
   dout(12) << "handle_beacon " << *m
-          << " from " << m->get_source()
-          << " " << m->get_source_inst()
+          << " from " << m->get_mds_inst()
           << endl;
-  int from = m->get_source().num();
+  int from = m->get_mds_inst().name.num();
   int state = m->get_state();
   version_t seq = m->get_seq();
 
@@ -253,13 +251,13 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
       } else if (mdsmap.is_out(from)) {
        dout(10) << "mds_beacon boot: mds" << from << " was out, starting" << endl;
        state = MDSMap::STATE_STARTING;
-      } else if (mdsmap.get_inst(from) != m->get_source_inst()) {
+      } else if (!mdsmap.have_inst(from) || mdsmap.get_inst(from) != m->get_mds_inst()) {
        dout(10) << "mds_beacon boot: mds" << from << " is someone else" << endl;
        from = -1;
       }
     }
     if (from < 0) {
-      from = pending_mdsmap.get_addr_rank(m->get_source_addr());
+      from = pending_mdsmap.get_addr_rank(m->get_mds_inst().addr);
       if (from >= 0) {
        state = pending_mdsmap.mds_state[from];
        dout(10) << "mds_beacon boot: already pending mds" << from
@@ -296,7 +294,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
     assert(state != MDSMap::STATE_BOOT);
 
     // put it in the map.
-    pending_mdsmap.mds_inst[from].addr = m->get_source_addr();
+    pending_mdsmap.mds_inst[from].addr = m->get_mds_inst().addr;
     pending_mdsmap.mds_inst[from].name = MSG_ADDR_MDS(from);
     pending_mdsmap.mds_inc[from]++;
     
@@ -445,6 +443,7 @@ void MDSMonitor::tick()
   // make sure mds's are still alive
   utime_t now = g_clock.now();
 
+  // ...if i am an active leader
   if (!mon->is_leader()) return;
   if (!paxos->is_active()) return;
 
index eb09a672b80113d74112844a28518db48584b9ca..31cba0a197b99101bd1a6215f4486851366c390b 100644 (file)
@@ -418,66 +418,78 @@ bool OSDMonitor::preprocess_failure(MOSDFailure *m)
 {
   int badboy = m->get_failed().name.num();
 
+  // weird?
+  if (!osdmap.have_inst(badboy) ||
+      osdmap.get_inst(badboy) != m->get_failed()) {
+    dout(5) << "preprocess_failure weird: " << m->get_failed() << " from " << m->get_from() << endl;
+    send_incremental(m->get_epoch(), m->get_from());
+    return true;
+  }
+
   // already reported?
-  if (osdmap.is_down(badboy) &&
-      (!osdmap.have_inst(badboy) ||
-       osdmap.get_inst(badboy) == m->get_failed())) {
-    dout(5) << "preprocess_failure dup: " << m->get_failed() << " from " << m->get_source() << endl;
-    send_incremental(m->get_epoch(), m->get_source_inst());
+  if (osdmap.is_down(badboy)) {
+    dout(5) << "preprocess_failure dup: " << m->get_failed() << " from " << m->get_from() << endl;
+    send_incremental(m->get_epoch(), m->get_from());
     return true;
   }
 
-  dout(10) << "preprocess_failure new: " << m->get_failed() << " from " << m->get_source() << endl;
+  dout(10) << "preprocess_failure new: " << m->get_failed() << " from " << m->get_from() << endl;
   return false;
 }
 
 bool OSDMonitor::prepare_failure(MOSDFailure *m)
 {
-  dout(1) << "prepare_failure " << m->get_failed() << " from " << m->get_source() << endl;
+  dout(1) << "prepare_failure " << m->get_failed() << " from " << m->get_from() << endl;
   
   // FIXME
   // take their word for it
   int badboy = m->get_failed().name.num();
-  if (osdmap.is_up(badboy) &&
-      (osdmap.osd_inst.count(badboy) == 0 ||
-       osdmap.osd_inst[badboy] == m->get_failed())) {
-    
-    pending_inc.new_down[badboy] = m->get_failed();
-    
-    if (osdmap.is_in(badboy))
-      down_pending_out[badboy] = g_clock.now();
-  }
+  assert(osdmap.is_up(badboy));
+  assert(osdmap.osd_inst[badboy] == m->get_failed());
+  
+  pending_inc.new_down[badboy] = m->get_failed();
+  
+  if (osdmap.is_in(badboy))
+    down_pending_out[badboy] = g_clock.now();
 
+  paxos->wait_for_commit(new C_Reported(this, m));
+  
   delete m;
   return true;
 }
 
+void OSDMonitor::_reported_failure(MOSDFailure *m)
+{
+  dout(7) << "_reported_failure on " << m->get_failed() << ", telling " << m->get_from() << endl;
+  send_latest(m->get_epoch(), m->get_from());
+}
+
 
 // boot --
 
 bool OSDMonitor::preprocess_boot(MOSDBoot *m)
 {
-  assert(m->get_source().is_osd());
-  int from = m->get_source().num();
+  assert(m->inst.name.is_osd());
+  int from = m->inst.name.num();
   
   // already booted?
   if (osdmap.is_up(from) &&
-      osdmap.get_inst(from) == m->get_source_inst()) {
+      osdmap.get_inst(from) == m->inst) {
     // yup.
-    dout(7) << "preprocess_boot dup from " << m->get_source() << endl;
+    dout(7) << "preprocess_boot dup from " << m->inst << endl;
     _booted(m);
     return true;
   }
   
-  dout(10) << "preprocess_boot from " << m->get_source() << endl;
+  dout(10) << "preprocess_boot from " << m->inst << endl;
   return false;
 }
 
 bool OSDMonitor::prepare_boot(MOSDBoot *m)
 {
-  dout(7) << "prepare_boot from " << m->get_source() << endl;
-  assert(m->get_source().is_osd());
-  int from = m->get_source().num();
+  dout(7) << "prepare_boot from " << m->inst << endl;
+  assert(m->inst.name.is_osd());
+  int from = m->inst.name.num();
   
   // does this osd exist?
   if (!osdmap.exists(from)) {
@@ -488,7 +500,7 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
 
   // already up?  mark down first?
   if (osdmap.is_up(from)) {
-    assert(osdmap.get_inst(from) != m->get_source_inst());  // preproces should have caught it
+    assert(osdmap.get_inst(from) != m->inst);  // preproces should have caught it
     
     // mark previous guy down
     pending_inc.new_down[from] = osdmap.osd_inst[from];
@@ -496,8 +508,7 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
   
   // mark new guy up.
   down_pending_out.erase(from);  // if any
-  assert(osdmap.is_down(from));
-  pending_inc.new_up[from] = m->get_source_inst();
+  pending_inc.new_up[from] = m->inst;
   
   // mark in?
   if (osdmap.out_osds.count(from)) 
@@ -511,8 +522,8 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
 
 void OSDMonitor::_booted(MOSDBoot *m)
 {
-  dout(7) << "_booted " << m->get_source() << endl;
-  send_latest(m->sb.current_epoch, m->get_source_inst());
+  dout(7) << "_booted " << m->inst << endl;
+  send_latest(m->sb.current_epoch, m->inst);
   delete m;
 }
 
index ed53a2db352e3b263e8132b6586719c8a38634e1..9927cf805f2bcd630c91777e353b7c9f71895a5e 100644 (file)
@@ -67,6 +67,7 @@ private:
 
   bool preprocess_failure(class MOSDFailure *m);
   bool prepare_failure(class MOSDFailure *m);
+  void _reported_failure(MOSDFailure *m);
 
   bool preprocess_boot(class MOSDBoot *m);
   bool prepare_boot(class MOSDBoot *m);
@@ -85,6 +86,19 @@ private:
        cmon->dispatch((Message*)m);
     }
   };
+  class C_Reported : public Context {
+    OSDMonitor *cmon;
+    MOSDFailure *m;
+  public:
+    C_Reported(OSDMonitor *cm, MOSDFailure *m_) : 
+      cmon(cm), m(m_) {}
+    void finish(int r) {
+      if (r >= 0)
+       cmon->_reported_failure(m);
+      else
+       cmon->dispatch((Message*)m);
+    }
+  };
 
   bool preprocess_in(class MOSDIn *m);
   bool prepare_in(class MOSDIn *m);
index b6653a9837cd3e93d54f4912d10e3e87365a4da5..0816b0db467b06a184c00c959bf201c12fe9b252 100644 (file)
@@ -105,9 +105,6 @@ void PaxosService::election_finished()
     have_pending = false;
   }
 
-  if (g_conf.mkfs) 
-    _try_create_initial();
-  
   // make sure we update our state
   if (paxos->is_active())
     _active();
@@ -118,28 +115,20 @@ void PaxosService::election_finished()
 void PaxosService::_active()
 {
   dout(10) << "_active" << endl;
-  update_from_paxos();
+  assert(paxos->is_active());
 
-  if (mon->is_leader() &&
-      !have_pending) {
-    create_pending();
-    have_pending = true;
-  }
-}
+  // pull latest from paxos
+  update_from_paxos();
 
-void PaxosService::_try_create_initial()
-{
-  if (mon->is_leader() && 
-      paxos->get_version() == 0) {
-    
-    if (!paxos->is_writeable()) {
-      dout(1) << "election_finished -- waiting for writeable to create initial state" << endl;
-      paxos->wait_for_writeable(new C_CreateInitial(this));
-    } else {
-      // do it
-      assert(have_pending == false);
+  // create pending state?
+  if (mon->is_leader()) {
+    if (!have_pending) {
       create_pending();
       have_pending = true;
+    }
+
+    if (g_conf.mkfs &&
+       paxos->get_version() == 0) {
       create_initial();
       propose_pending();
     }
index f299f9d434a8cce22cc5bb6830be3e97a59e2b2a..32bcb3e4b11fb7aa85da36036d69cdcdc40c718f 100644 (file)
@@ -54,15 +54,6 @@ protected:
     }
   };
   friend class C_Update;
-  class C_CreateInitial : public Context {
-    PaxosService *svc;
-  public:
-    C_CreateInitial(PaxosService *s) : svc(s) {}
-    void finish(int r) {
-      svc->_try_create_initial();
-    }
-  };
-  friend class C_CreateInitial;
 
 private:
   bool have_pending;
@@ -76,7 +67,6 @@ public:
   void election_finished();
 
 private:
-  void _try_create_initial();
   void _active();
   void _commit();
 
index 22bea5e792d347db90e8adfd2281d9619304fee5..1d6c7a3193c7fd48cb084ae98afd7a9c87746f51 100644 (file)
@@ -275,7 +275,7 @@ int OSD::init()
     
     // announce to monitor i exist and have booted.
     int mon = monmap->pick_mon();
-    messenger->send_message(new MOSDBoot(superblock), monmap->get_inst(mon));
+    messenger->send_message(new MOSDBoot(messenger->get_myinst(), superblock), monmap->get_inst(mon));
     
     // start the heart
     timer.add_event_after(g_conf.osd_heartbeat_interval, new C_Heartbeat(this));
@@ -744,7 +744,7 @@ void OSD::ms_handle_failure(Message *m, const entity_inst_t& inst)
             << ", dropping and reporting to mon" << mon 
            << " " << *m
             << dendl;
-    messenger->send_message(new MOSDFailure(inst, osdmap->get_epoch()),
+    messenger->send_message(new MOSDFailure(messenger->get_myinst(), inst, osdmap->get_epoch()),
                             monmap->get_inst(mon));
     delete m;
   } else if (dest.is_mon()) {
index 1913efba118105a1262c8230348b42ab218ffd78..f27146d559a82676c18221e94d646647fbe06d26 100644 (file)
@@ -195,15 +195,6 @@ private:
     }
 
     // nope, incremental.
-    for (map<int,entity_inst_t>::iterator i = inc.new_up.begin();
-         i != inc.new_up.end(); 
-         i++) {
-      assert(down_osds.count(i->first));
-      down_osds.erase(i->first);
-      assert(osd_inst.count(i->first) == 0);
-      osd_inst[i->first] = i->second;
-      //cout << "epoch " << epoch << " up osd" << i->first << endl;
-    }
     for (map<int,entity_inst_t>::iterator i = inc.new_down.begin();
          i != inc.new_down.end();
          i++) {
@@ -214,13 +205,6 @@ private:
       osd_inst.erase(i->first);
       //cout << "epoch " << epoch << " down osd" << i->first << endl;
     }
-    for (list<int>::iterator i = inc.new_in.begin();
-         i != inc.new_in.end();
-         i++) {
-      assert(out_osds.count(*i));
-      out_osds.erase(*i);
-      //cout << "epoch " << epoch << " in osd" << *i << endl;
-    }
     for (list<int>::iterator i = inc.new_out.begin();
          i != inc.new_out.end();
          i++) {
@@ -228,17 +212,34 @@ private:
       out_osds.insert(*i);
       //cout << "epoch " << epoch << " out osd" << *i << endl;
     }
-    for (map<int,float>::iterator i = inc.new_overload.begin();
-         i != inc.new_overload.end();
-         i++) {
-      overload_osds[i->first] = i->second;
-    }
     for (list<int>::iterator i = inc.old_overload.begin();
          i != inc.old_overload.end();
          i++) {
       assert(overload_osds.count(*i));
       overload_osds.erase(*i);
     }
+
+    for (map<int,entity_inst_t>::iterator i = inc.new_up.begin();
+         i != inc.new_up.end(); 
+         i++) {
+      assert(down_osds.count(i->first));
+      down_osds.erase(i->first);
+      assert(osd_inst.count(i->first) == 0);
+      osd_inst[i->first] = i->second;
+      //cout << "epoch " << epoch << " up osd" << i->first << endl;
+    }
+    for (list<int>::iterator i = inc.new_in.begin();
+         i != inc.new_in.end();
+         i++) {
+      assert(out_osds.count(*i));
+      out_osds.erase(*i);
+      //cout << "epoch " << epoch << " in osd" << *i << endl;
+    }
+    for (map<int,float>::iterator i = inc.new_overload.begin();
+         i != inc.new_overload.end();
+         i++) {
+      overload_osds[i->first] = i->second;
+    }
   }
 
   // serialize, unserialize
index e27f62ddac6c86b3444b0ef4297798af7ba32bcd..43c43a4ee6b5c8279afbfccd385458bf8c9fd253 100644 (file)
@@ -833,7 +833,7 @@ void Objecter::ms_handle_failure(Message *m, entity_name_t dest, const entity_in
     dout(0) << "ms_handle_failure " << dest << " inst " << inst 
             << ", dropping and reporting to mon" << mon 
             << endl;
-    messenger->send_message(new MOSDFailure(inst, osdmap->get_epoch()), 
+    messenger->send_message(new MOSDFailure(messenger->get_myinst(), inst, osdmap->get_epoch()), 
                             monmap->get_inst(mon));
     delete m;
   } else {