From 89d4d12cc782d0d8179d8aef63ee4c5638fdbb57 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 9 Oct 2009 21:47:22 -0700 Subject: [PATCH] mon: kill MMDSGetMap, clean up MDSMonitor map sending code 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 | 1 - src/client/Client.cc | 4 +--- src/include/ceph_fs.h | 1 - src/messages/MMDSGetMap.h | 47 --------------------------------------- src/mon/MDSMonitor.cc | 46 ++++---------------------------------- src/mon/MDSMonitor.h | 11 --------- src/mon/Monitor.cc | 6 +++-- src/msg/Message.cc | 4 ---- 8 files changed, 9 insertions(+), 111 deletions(-) delete mode 100644 src/messages/MMDSGetMap.h diff --git a/src/Makefile.am b/src/Makefile.am index 702aebd8d0d09..837058fd05fb1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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\ diff --git a/src/client/Client.cc b/src/client/Client.cc index 3d36db2601aa9..e415a51cc5f2d 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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); diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index b3bbab1952c91..64ef06fadb45b 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -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 index c1cef56dbf41b..0000000000000 --- a/src/messages/MMDSGetMap.h +++ /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 - * - * 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 diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 22ecb5210d75d..4ba836803c33d 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -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::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 diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index c7f8c8708242d..a07a9feb8e76c 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -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 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(); diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 371082cd2b6d8..ca18c9344c8b8 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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; diff --git a/src/msg/Message.cc b/src/msg/Message.cc index 5b70f19266ba3..ebebe2b9d2648 100644 --- a/src/msg/Message.cc +++ b/src/msg/Message.cc @@ -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; -- 2.39.5