]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: kill MMDSGetMap, clean up MDSMonitor map sending code
authorSage Weil <sage@newdream.net>
Sat, 10 Oct 2009 04:47:22 +0000 (21:47 -0700)
committerSage Weil <sage@newdream.net>
Sat, 10 Oct 2009 04:47:22 +0000 (21:47 -0700)
We don't need most of this crap anymore.. subscriptions solve all of these
problems!  The getmap message isn't even used anymore.

src/Makefile.am
src/client/Client.cc
src/include/ceph_fs.h
src/messages/MMDSGetMap.h [deleted file]
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h
src/mon/Monitor.cc
src/msg/Message.cc

index 702aebd8d0d0957c12d3bb504d78b7d97870c51c..837058fd05fb1ca524ad05afae9a11634dca5993 100644 (file)
@@ -557,7 +557,6 @@ noinst_HEADERS = \
         messages/MMDSCacheRejoin.h\
        messages/MMDSLoadTargets.h\
         messages/MMDSFragmentNotify.h\
-        messages/MMDSGetMap.h\
         messages/MMDSMap.h\
         messages/MMDSResolve.h\
         messages/MMDSResolveAck.h\
index 3d36db2601aa95b0b4db328afd443ce645b5e8f6..e415a51cc5f2d15d3fa0b6607bb7a6f4ac5a3b2c 100644 (file)
@@ -49,7 +49,6 @@ using namespace std;
 
 #include "messages/MGenericMessage.h"
 
-#include "messages/MMDSGetMap.h"
 #include "messages/MMDSMap.h"
 
 #include "osdc/Filer.h"
@@ -862,8 +861,7 @@ int Client::make_request(MetaRequest *request,
       Cond cond;
 
       if (!mdsmap->is_active(mds)) {
-       dout(10) << "no address for mds" << mds << ", requesting new mdsmap" << dendl;
-       //monclient->send_mon_message(new MMDSGetMap(monclient->get_fsid(), mdsmap->get_epoch()));
+       dout(10) << "no address for mds" << mds << ", waiting for new mdsmap" << dendl;
        waiting_for_mdsmap.push_back(&cond);
        cond.Wait(client_lock);
 
index b3bbab1952c91501946512d126dd6f4010d2f626..64ef06fadb45b7a5177e7aee4810ad79bcda736d 100644 (file)
@@ -100,7 +100,6 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
 #define CEPH_MSG_MON_SUBSCRIBE_ACK      16
 
 /* client <-> mds */
-#define CEPH_MSG_MDS_GETMAP             20
 #define CEPH_MSG_MDS_MAP                21
 
 #define CEPH_MSG_CLIENT_SESSION         22
diff --git a/src/messages/MMDSGetMap.h b/src/messages/MMDSGetMap.h
deleted file mode 100644 (file)
index c1cef56..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef __MMDSGETMAP_H
-#define __MMDSGETMAP_H
-
-#include "messages/PaxosServiceMessage.h"
-
-#include "include/types.h"
-
-class MMDSGetMap : public PaxosServiceMessage {
- public:
-  ceph_fsid_t fsid;
-
-  MMDSGetMap() : PaxosServiceMessage(CEPH_MSG_MDS_GETMAP, 0) {}
-  MMDSGetMap(const ceph_fsid_t &f, epoch_t have=0) : 
-    PaxosServiceMessage(CEPH_MSG_MDS_GETMAP, have), 
-    fsid(f) { }
-
-  const char *get_type_name() { return "mds_getmap"; }
-  void print(ostream& out) {
-    out << "mds_getmap(have v" << version << ")";
-  }
-  
-  void encode_payload() {
-    paxos_encode();
-    ::encode(fsid, payload);
-  }
-  void decode_payload() {
-    bufferlist::iterator p = payload.begin();
-    paxos_decode(p);
-    ::decode(fsid, p);
-  }
-};
-
-#endif
index 22ecb5210d75dd047af8eed3cb5f2d34592cbe10..4ba836803c33d0c9453a46c4983e3664e51960bf 100644 (file)
@@ -19,7 +19,6 @@
 #include "OSDMonitor.h"
 
 #include "messages/MMDSMap.h"
-#include "messages/MMDSGetMap.h"
 #include "messages/MMDSBeacon.h"
 #include "messages/MMDSLoadTargets.h"
 #include "messages/MMonCommand.h"
@@ -93,7 +92,6 @@ bool MDSMonitor::update_from_paxos()
   dout(4) << "new map" << dendl;
   print_map(mdsmap, 0);
 
-  send_to_waiting();
   check_subs();
 
   return true;
@@ -129,10 +127,6 @@ bool MDSMonitor::preprocess_query(PaxosServiceMessage *m)
   case MSG_MDS_BEACON:
     return preprocess_beacon((MMDSBeacon*)m);
     
-  case CEPH_MSG_MDS_GETMAP:
-    handle_mds_getmap((MMDSGetMap*)m);
-    return true;
-
   case MSG_MON_COMMAND:
     return preprocess_command((MMonCommand*)m);
 
@@ -146,15 +140,6 @@ bool MDSMonitor::preprocess_query(PaxosServiceMessage *m)
   }
 }
 
-void MDSMonitor::handle_mds_getmap(MMDSGetMap *m)
-{
-  if (m->version < mdsmap.get_epoch())
-    send_full(m->get_orig_source_inst());
-  else
-    waiting_for_map.push_back(m->get_orig_source_inst());
-}
-
-
 bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
 {
   entity_addr_t addr = m->get_orig_source_inst().addr;
@@ -179,7 +164,7 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
   if (pending_mdsmap.is_dne(addr)) {
     if (state != MDSMap::STATE_BOOT) {
       dout(7) << "mds_beacon " << *m << " is not in mdsmap" << dendl;
-      send_latest(m->get_orig_source_inst());
+      mon->send_reply(m, new MMDSMap(mon->monmap->fsid, &mdsmap));
       goto out;
     } else {
       return false;  // not booted yet.
@@ -366,7 +351,7 @@ void MDSMonitor::_updated(MMDSBeacon *m)
 
   if (m->get_state() == MDSMap::STATE_STOPPED) {
     // send the map manually (they're out of the map, so they won't get it automatic)
-    send_latest(m->get_orig_source_inst());
+    mon->send_reply(m, new MMDSMap(mon->monmap->fsid, &mdsmap));
   }
 
   delete m;
@@ -534,30 +519,6 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
 }
 
 
-void MDSMonitor::send_full(entity_inst_t dest)
-{
-  dout(11) << "send_full to " << dest << dendl;
-  mon->messenger->send_message(new MMDSMap(mon->monmap->fsid, &mdsmap), dest);
-}
-
-void MDSMonitor::send_to_waiting()
-{
-  dout(10) << "send_to_waiting " << mdsmap.get_epoch() << dendl;
-  for (list<entity_inst_t>::iterator i = waiting_for_map.begin();
-       i != waiting_for_map.end();
-       i++) 
-    send_full(*i);
-  waiting_for_map.clear();
-}
-
-void MDSMonitor::send_latest(entity_inst_t dest)
-{
-  if (paxos->is_readable()) 
-    send_full(dest);
-  else
-    waiting_for_map.push_back(dest);
-}
-
 void MDSMonitor::check_subs()
 {
   nstring type = "mdsmap";
@@ -572,7 +533,8 @@ void MDSMonitor::check_subs()
 void MDSMonitor::check_sub(Subscription *sub)
 {
   if (sub->last < mdsmap.get_epoch()) {
-    send_full(sub->session->inst);
+    mon->messenger->send_message(new MMDSMap(mon->monmap->fsid, &mdsmap),
+                                sub->session->inst);
     if (sub->onetime)
       mon->session_map.remove_sub(sub);
     else
index c7f8c8708242dac56ee8e9a2265f0e87fbcdf148..a07a9feb8e76c9f8437069c78ad5dd24ef0e6d35 100644 (file)
@@ -78,7 +78,6 @@ class MDSMonitor : public PaxosService {
 
   bool preprocess_beacon(class MMDSBeacon *m);
   bool prepare_beacon(class MMDSBeacon *m);
-  void handle_mds_getmap(MMDSGetMap *m);
 
   bool preprocess_offload_targets(MMDSLoadTargets *m);
   bool prepare_offload_targets(MMDSLoadTargets *m);
@@ -96,16 +95,6 @@ class MDSMonitor : public PaxosService {
 public:
   MDSMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p) { }
 
-  // sending the map
-private:
-  list<entity_inst_t> waiting_for_map;
-
-  void send_full(entity_inst_t dest);
-  void send_to_waiting();
-
-public:
-  void send_latest(entity_inst_t dest);
-
   void tick();     // check state, take actions
   void do_stop();
 
index 371082cd2b6d85c1bb6e8a2a7701b86e5bdfc725..ca18c9344c8b881f12d49f738c4f84d52487e8ae 100644 (file)
@@ -384,7 +384,10 @@ void Monitor::handle_route(MRoute *m)
     rr->session->routed_request_tids.insert(rr->tid);
     delete rr;
   } else {
-    dout(10) << " don't have routed request tid " << m->session_mon_tid << ", dropping" << dendl;
+    dout(10) << " don't have routed request tid " << m->session_mon_tid
+            << ", trying to send anyway" << dendl;
+    messenger->send_message(m->msg, m->dest);
+    m->msg = NULL;
   }
   delete m;
 }
@@ -520,7 +523,6 @@ bool Monitor::ms_dispatch(Message *m)
       // MDSs
     case MSG_MDS_BEACON:
     case MSG_MDS_OFFLOAD_TARGETS:
-    case CEPH_MSG_MDS_GETMAP:
       paxos_service[PAXOS_MDSMAP]->dispatch((PaxosServiceMessage*)m);
       break;
 
index 5b70f19266ba391d139a191991553d527a65d215..ebebe2b9d2648511d44b152bacfb0c8b3a8cfbf1 100644 (file)
@@ -82,7 +82,6 @@ using namespace std;
 
 #include "messages/MMDSSlaveRequest.h"
 
-#include "messages/MMDSGetMap.h"
 #include "messages/MMDSMap.h"
 #include "messages/MMDSBeacon.h"
 #include "messages/MMDSLoadTargets.h"
@@ -372,9 +371,6 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer,
     m = new MMDSSlaveRequest;
     break;
 
-  case CEPH_MSG_MDS_GETMAP:
-    m = new MMDSGetMap;
-    break;
   case CEPH_MSG_MDS_MAP:
     m = new MMDSMap;
     break;