messages/MOSDPGCreate.h\
messages/MOSDPGInfo.h\
messages/MOSDPGLog.h\
+ messages/MOSDPGMissing.h\
messages/MOSDPGNotify.h\
messages/MOSDPGQuery.h\
messages/MOSDPGRemove.h\
--- /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) 2010 Dreamhost
+ *
+ * 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 CEPH_MOSDPGMISSING_H
+#define CEPH_MOSDPGMISSING_H
+
+#include "msg/Message.h"
+
+class MOSDPGMissing : public Message {
+ epoch_t epoch;
+
+public:
+ PG::Info info;
+ PG::Missing missing;
+
+ epoch_t get_epoch() { return epoch; }
+
+ MOSDPGMissing() {}
+ MOSDPGMissing(version_t mv, const PG::Info &info_,
+ const PG::Missing &missing_)
+ : Message(MSG_OSD_PG_MISSING), epoch(mv), info(info_),
+ missing(missing_) { }
+private:
+ ~MOSDPGMissing() {}
+
+public:
+ const char *get_type_name() { return "pg_missing"; }
+ void print(ostream& out) {
+ out << "pg_missing(" << info.pgid << " e" << epoch << ")";
+ }
+
+ void encode_payload() {
+ ::encode(epoch, payload);
+ ::encode(info, payload);
+ ::encode(missing, payload);
+ }
+ void decode_payload() {
+ bufferlist::iterator p = payload.begin();
+ ::decode(epoch, p);
+ ::decode(info, p);
+ ::decode(missing, p);
+ }
+};
+
+#endif
#include "messages/MOSDPGInfo.h"
#include "messages/MOSDPGCreate.h"
#include "messages/MOSDPGTrim.h"
+#include "messages/MOSDPGMissing.h"
#include "messages/MOSDScrub.h"
#include "messages/MRemoveSnaps.h"
case MSG_OSD_SCRUB:
m = new MOSDScrub;
break;
-
case MSG_REMOVE_SNAPS:
m = new MRemoveSnaps;
break;
-
+ case MSG_OSD_PG_MISSING:
+ m = new MOSDPGMissing;
+ break;
// auth
case CEPH_MSG_AUTH:
m = new MAuth;
#define MSG_REMOVE_SNAPS 90
#define MSG_OSD_SCRUB 91
+#define MSG_OSD_PG_MISSING 92
#include "messages/MOSDPGInfo.h"
#include "messages/MOSDPGCreate.h"
#include "messages/MOSDPGTrim.h"
+#include "messages/MOSDPGMissing.h"
#include "messages/MOSDAlive.h"
case MSG_OSD_PG_TRIM:
handle_pg_trim((MOSDPGTrim*)m);
break;
+ case MSG_OSD_PG_MISSING:
+ handle_pg_missing((MOSDPGMissing*)m);
+ break;
// client ops
case CEPH_MSG_OSD_OP:
case MSG_OSD_SUBOPREPLY:
handle_sub_op_reply((MOSDSubOpReply*)m);
break;
-
}
}
}
m->put();
}
+void OSD::handle_pg_missing(MOSDPGMissing *m)
+{
+ dout(7) << __func__ << " " << *m << " from " << m->get_source() << dendl;
+
+ if (!require_osd_peer(m))
+ return;
+
+ int from = m->get_source().num();
+ if (!require_same_or_newer_map(m, m->get_epoch()))
+ return;
+
+ PG::Log empty_log;
+ int created = 0;
+ _process_pg_info(m->get_epoch(), from, m->info,
+ empty_log, m->missing, NULL, created);
+ if (created)
+ update_heartbeat_peers();
+
+ m->put();
+}
/** PGQuery
* from primary to replica | stray
class OSDMap;
class MLog;
class MClass;
+class MOSDPGMissing;
extern const coll_t meta_coll;
bool require_same_or_newer_map(Message *m, epoch_t e);
void handle_pg_query(class MOSDPGQuery *m);
+ void handle_pg_missing(class MOSDPGMissing *m);
void handle_pg_notify(class MOSDPGNotify *m);
void handle_pg_log(class MOSDPGLog *m);
void handle_pg_info(class MOSDPGInfo *m);