--- /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 __MOSDALIVE_H
+#define __MOSDALIVE_H
+
+#include "msg/Message.h"
+
+class MOSDAlive : public Message {
+ public:
+ epoch_t map_epoch;
+
+ MOSDAlive(epoch_t e) : Message(MSG_OSD_ALIVE), map_epoch(e) { }
+ MOSDAlive() {}
+
+ void encode_payload() {
+ ::encode(map_epoch, payload);
+ }
+ void decode_payload() {
+ bufferlist::iterator p = payload.begin();
+ ::decode(map_epoch, p);
+ }
+
+ const char *get_type_name() { return "osd_alive"; }
+ void print(ostream &out) {
+ out << "osd_alive(" << map_epoch << ")";
+ }
+
+};
+
+#endif
#include "messages/MOSDMap.h"
#include "messages/MOSDGetMap.h"
#include "messages/MOSDBoot.h"
-#include "messages/MOSDIn.h"
-#include "messages/MOSDOut.h"
+#include "messages/MOSDAlive.h"
#include "messages/MMonCommand.h"
#include "common/Timer.h"
return preprocess_failure((MOSDFailure*)m);
case MSG_OSD_BOOT:
return preprocess_boot((MOSDBoot*)m);
- case MSG_OSD_IN:
- return preprocess_in((MOSDIn*)m);
+ case MSG_OSD_ALIVE:
+ return preprocess_alive((MOSDAlive*)m);
/*
case MSG_OSD_OUT:
return preprocess_out((MOSDOut*)m);
return prepare_failure((MOSDFailure*)m);
case MSG_OSD_BOOT:
return prepare_boot((MOSDBoot*)m);
- case MSG_OSD_IN:
- return prepare_in((MOSDIn*)m);
+ case MSG_OSD_ALIVE:
+ return prepare_alive((MOSDAlive*)m);
case MSG_MON_COMMAND:
return prepare_command((MMonCommand*)m);
// -------------
// in
-bool OSDMonitor::preprocess_in(MOSDIn *m)
+bool OSDMonitor::preprocess_alive(MOSDAlive *m)
{
int from = m->get_source().num();
if (osdmap.is_up(from) &&
osdmap.get_inst(from) == m->get_source_inst() &&
osdmap.get_alive_thru(from) >= m->map_epoch) {
// yup.
- dout(7) << "preprocess_in e" << m->map_epoch << " dup from " << m->get_source_inst() << dendl;
- _in(m);
+ dout(7) << "preprocess_alive e" << m->map_epoch << " dup from " << m->get_source_inst() << dendl;
+ _alive(m);
return true;
}
- dout(10) << "preprocess_in e" << m->map_epoch << " from " << m->get_source_inst() << dendl;
+ dout(10) << "preprocess_alive e" << m->map_epoch << " from " << m->get_source_inst() << dendl;
return false;
}
-bool OSDMonitor::prepare_in(MOSDIn *m)
+bool OSDMonitor::prepare_alive(MOSDAlive *m)
{
int from = m->get_source().num();
- dout(7) << "prepare_in e" << m->map_epoch << " from " << m->get_source_inst() << dendl;
+ dout(7) << "prepare_alive e" << m->map_epoch << " from " << m->get_source_inst() << dendl;
pending_inc.new_alive_thru[from] = m->map_epoch;
- paxos->wait_for_commit(new C_In(this,m ));
+ paxos->wait_for_commit(new C_Alive(this,m ));
return true;
}
-void OSDMonitor::_in(MOSDIn *m)
+void OSDMonitor::_alive(MOSDAlive *m)
{
- dout(7) << "_in e" << m->map_epoch
+ dout(7) << "_alive e" << m->map_epoch
<< " from " << m->get_source_inst()
<< dendl;
- mon->messenger->send_message(m, m->get_source_inst());
+ send_latest(m->get_source_inst(), m->map_epoch);
+ delete m;
}
bool prepare_boot(class MOSDBoot *m);
void _booted(MOSDBoot *m);
- bool preprocess_in(class MOSDIn *m);
- bool prepare_in(class MOSDIn *m);
- void _in(MOSDIn *m);
+ bool preprocess_alive(class MOSDAlive *m);
+ bool prepare_alive(class MOSDAlive *m);
+ void _alive(MOSDAlive *m);
struct C_Booted : public Context {
OSDMonitor *cmon;
cmon->dispatch((Message*)m);
}
};
- struct C_In : public Context {
+ struct C_Alive : public Context {
OSDMonitor *osdmon;
- MOSDIn *m;
- C_In(OSDMonitor *o, MOSDIn *mm) : osdmon(o), m(mm) {}
+ MOSDAlive *m;
+ C_Alive(OSDMonitor *o, MOSDAlive *mm) : osdmon(o), m(mm) {}
void finish(int r) {
- osdmon->_in(m);
+ osdmon->_alive(m);
}
};
struct C_Reported : public Context {