]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add MOSDPGMissing
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Fri, 12 Nov 2010 22:55:40 +0000 (14:55 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 15 Nov 2010 20:15:15 +0000 (12:15 -0800)
Add MOSDPGMissing, a message which just contains the missing objects
information for a PG. We will request messages like this one in order to
locate all of our unfound objects.

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/Makefile.am
src/messages/MOSDPGMissing.h [new file with mode: 0644]
src/msg/Message.cc
src/msg/Message.h
src/osd/OSD.cc
src/osd/OSD.h

index dd45ceb5eebcdd24da457c46b6696d765a1f67b8..7bf088eb3c4a09574d92bb55f8359f834517a156 100644 (file)
@@ -764,6 +764,7 @@ noinst_HEADERS = \
         messages/MOSDPGCreate.h\
         messages/MOSDPGInfo.h\
         messages/MOSDPGLog.h\
+        messages/MOSDPGMissing.h\
         messages/MOSDPGNotify.h\
         messages/MOSDPGQuery.h\
         messages/MOSDPGRemove.h\
diff --git a/src/messages/MOSDPGMissing.h b/src/messages/MOSDPGMissing.h
new file mode 100644 (file)
index 0000000..1918ffd
--- /dev/null
@@ -0,0 +1,57 @@
+// -*- 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
index 777772c350a831bfd3b9bc8a393b804760f7721b..a38adb8e0f7c7ef50232e032331c31ad9d90febe 100644 (file)
@@ -56,6 +56,7 @@ using namespace std;
 #include "messages/MOSDPGInfo.h"
 #include "messages/MOSDPGCreate.h"
 #include "messages/MOSDPGTrim.h"
+#include "messages/MOSDPGMissing.h"
 #include "messages/MOSDScrub.h"
 
 #include "messages/MRemoveSnaps.h"
@@ -310,11 +311,12 @@ Message *decode_message(ceph_msg_header& header, ceph_msg_footer& footer,
   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;
index a846227144bcfe2d8007c4d663ac48adadebb5b1..8e054d6a127168cca789ec690523339fa30ab2f7 100644 (file)
@@ -73,6 +73,7 @@
 #define MSG_REMOVE_SNAPS       90
 
 #define MSG_OSD_SCRUB          91
+#define MSG_OSD_PG_MISSING     92
 
 
 
index fc31cb41ffcdbe9fe697b192ca97b27f87fb5c82..79ba9902ef99a2d9062932b79e3da1137cd26540 100644 (file)
@@ -58,6 +58,7 @@
 #include "messages/MOSDPGInfo.h"
 #include "messages/MOSDPGCreate.h"
 #include "messages/MOSDPGTrim.h"
+#include "messages/MOSDPGMissing.h"
 
 #include "messages/MOSDAlive.h"
 
@@ -2158,6 +2159,9 @@ void OSD::_dispatch(Message *m)
       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:
@@ -2171,7 +2175,6 @@ void OSD::_dispatch(Message *m)
       case MSG_OSD_SUBOPREPLY:
         handle_sub_op_reply((MOSDSubOpReply*)m);
         break;
-        
       }
     }
   }
@@ -3991,6 +3994,26 @@ void OSD::handle_pg_trim(MOSDPGTrim *m)
   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
index b418dd711aae1d022fb567adc7d7f97c14c0eb03..67477fdd4ee74c16ca89208e9a1dbc4a516583ab 100644 (file)
@@ -97,6 +97,7 @@ class ObjectStore;
 class OSDMap;
 class MLog;
 class MClass;
+class MOSDPGMissing;
 
 extern const coll_t meta_coll;
 
@@ -627,6 +628,7 @@ protected:
   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);