messages/MMDSCacheRejoin.h\
messages/MMDSLoadTargets.h\
messages/MMDSFragmentNotify.h\
- messages/MMDSGetMap.h\
messages/MMDSMap.h\
messages/MMDSResolve.h\
messages/MMDSResolveAck.h\
#include "messages/MGenericMessage.h"
-#include "messages/MMDSGetMap.h"
#include "messages/MMDSMap.h"
#include "osdc/Filer.h"
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);
#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
+++ /dev/null
-// -*- 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
#include "OSDMonitor.h"
#include "messages/MMDSMap.h"
-#include "messages/MMDSGetMap.h"
#include "messages/MMDSBeacon.h"
#include "messages/MMDSLoadTargets.h"
#include "messages/MMonCommand.h"
dout(4) << "new map" << dendl;
print_map(mdsmap, 0);
- send_to_waiting();
check_subs();
return true;
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);
}
}
-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;
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.
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;
}
-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";
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
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);
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();
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;
}
// MDSs
case MSG_MDS_BEACON:
case MSG_MDS_OFFLOAD_TARGETS:
- case CEPH_MSG_MDS_GETMAP:
paxos_service[PAXOS_MDSMAP]->dispatch((PaxosServiceMessage*)m);
break;
#include "messages/MMDSSlaveRequest.h"
-#include "messages/MMDSGetMap.h"
#include "messages/MMDSMap.h"
#include "messages/MMDSBeacon.h"
#include "messages/MMDSLoadTargets.h"
m = new MMDSSlaveRequest;
break;
- case CEPH_MSG_MDS_GETMAP:
- m = new MMDSGetMap;
- break;
case CEPH_MSG_MDS_MAP:
m = new MMDSMap;
break;