]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pgmonitor shell
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 17 Jul 2007 05:07:49 +0000 (05:07 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 17 Jul 2007 05:07:49 +0000 (05:07 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1513 29311d96-e01e-0410-9327-a35deaab8ce9

branches/sage/pgs/Makefile
branches/sage/pgs/mon/Monitor.cc
branches/sage/pgs/mon/Monitor.h
branches/sage/pgs/mon/PGMap.h [new file with mode: 0644]
branches/sage/pgs/mon/PGMonitor.h [new file with mode: 0644]
branches/sage/pgs/mon/mon_types.h

index 9c2c757032eaf27ab0ea38274cf854c2e31dbb7d..03e13425c5b5e9c81942de8d18db81eeb2c81f78 100644 (file)
@@ -79,6 +79,7 @@ MON_OBJS= \
        mon/OSDMonitor.o\
        mon/MDSMonitor.o\
        mon/ClientMonitor.o\
+       mon/PGMonitor.o\
        mon/Elector.o\
        mon/MonitorStore.o
 
index 55af22cb3439bde19222b408531506d7b32e490f..299dbaf2f11c79f8832d888728c47e5989e4ab11 100644 (file)
@@ -37,6 +37,7 @@
 #include "OSDMonitor.h"
 #include "MDSMonitor.h"
 #include "ClientMonitor.h"
+#include "PGMonitor.h"
 
 #include "config.h"
 #undef dout
@@ -65,12 +66,14 @@ void Monitor::init()
   osdmon = new OSDMonitor(this, &paxos_osdmap);
   mdsmon = new MDSMonitor(this, &paxos_mdsmap);
   clientmon = new ClientMonitor(this, &paxos_clientmap);
+  pgmon = new PGMonitor(this, &paxos_pgmap);
   
   // init paxos
   paxos_test.init();
   paxos_osdmap.init();
   paxos_mdsmap.init();
   paxos_clientmap.init();
+  paxos_pgmap.init();
   
   // i'm ready!
   messenger->set_dispatcher(this);
@@ -130,6 +133,7 @@ void Monitor::shutdown()
   if (osdmon) delete osdmon;
   if (mdsmon) delete mdsmon;
   if (clientmon) delete clientmon;
+  if (pgmon) delete pgmon;
   
   // die.
   messenger->shutdown();
@@ -167,11 +171,13 @@ void Monitor::win_election(epoch_t epoch, set<int>& active)
   paxos_mdsmap.leader_init();
   paxos_osdmap.leader_init();
   paxos_clientmap.leader_init();
+  paxos_pgmap.leader_init();
   
   // init
   osdmon->election_finished();
   mdsmon->election_finished();
   clientmon->election_finished();
+  pgmon->election_finished();
 } 
 
 void Monitor::lose_election(epoch_t epoch, int l) 
@@ -186,11 +192,13 @@ void Monitor::lose_election(epoch_t epoch, int l)
   paxos_mdsmap.peon_init();
   paxos_osdmap.peon_init();
   paxos_clientmap.peon_init();
+  paxos_pgmap.peon_init();
   
   // init
   osdmon->election_finished();
   mdsmon->election_finished();
   clientmon->election_finished();
+  pgmon->election_finished();
 }
 
 
index 015e5797ca6dfe2b0342f0d9c3caf4d6d5509a07..934916760e28c0a58566bd206fde3e6ecd514b07 100644 (file)
@@ -30,7 +30,7 @@ class MonitorStore;
 class OSDMonitor;
 class MDSMonitor;
 class ClientMonitor;
-
+class PGMonitor;
 
 class Monitor : public Dispatcher {
 public:
@@ -90,6 +90,7 @@ public:
   Paxos paxos_mdsmap;
   Paxos paxos_osdmap;
   Paxos paxos_clientmap;
+  Paxos paxos_pgmap;
   friend class Paxos;
   
 
@@ -97,10 +98,12 @@ public:
   OSDMonitor *osdmon;
   MDSMonitor *mdsmon;
   ClientMonitor *clientmon;
+  PGMonitor *pgmon;
 
   friend class OSDMonitor;
   friend class MDSMonitor;
   friend class ClientMonitor;
+  friend class PGMonitor;
 
 
   // messages
@@ -128,6 +131,7 @@ public:
     paxos_mdsmap(this, w, PAXOS_MDSMAP),
     paxos_osdmap(this, w, PAXOS_OSDMAP),
     paxos_clientmap(this, w, PAXOS_CLIENTMAP),
+    paxos_pgmap(this, w, PAXOS_PGMAP),
 
     osdmon(0), mdsmon(0), clientmon(0)
   {
diff --git a/branches/sage/pgs/mon/PGMap.h b/branches/sage/pgs/mon/PGMap.h
new file mode 100644 (file)
index 0000000..dc6b500
--- /dev/null
@@ -0,0 +1,30 @@
+// -*- 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 __PGMAP_H
+#define __PGMAP_H
+
+#include "osd/osd_types.h"
+
+class PGMap {
+  
+public:
+  class Incremental {
+
+  };
+
+
+};
+
+#endif
diff --git a/branches/sage/pgs/mon/PGMonitor.h b/branches/sage/pgs/mon/PGMonitor.h
new file mode 100644 (file)
index 0000000..917d6e2
--- /dev/null
@@ -0,0 +1,52 @@
+// -*- 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 __PGMONITOR_H
+#define __PGMONITOR_H
+
+#include <map>
+#include <set>
+using namespace std;
+
+#include "include/types.h"
+#include "msg/Messenger.h"
+#include "PaxosService.h"
+
+#include "PGMap.h"
+
+class PGMonitor : public PaxosService {
+public:
+
+
+private:
+  PGMap pg_map;
+  PGMap::Incremental pending_inc;
+
+  void create_initial();
+  bool update_from_paxos();
+  void create_pending();  // prepare a new pending
+  void encode_pending(bufferlist &bl);  // propose pending update to peers
+
+  bool preprocess_query(Message *m);  // true if processed.
+  bool prepare_update(Message *m);
+
+  
+ public:
+  PGMonitor(Monitor *mn, Paxos *p) : PaxosService(mn, p) { }
+  
+  //void tick();  // check state, take actions
+
+};
+
+#endif
index 852e42b8d983f7912f8d73b00d08b6e8277446b6..8d1ac92822356e8f51fa661fcf0c38c6e9c2278f 100644 (file)
@@ -19,6 +19,7 @@
 #define PAXOS_MDSMAP     1
 #define PAXOS_OSDMAP     2
 #define PAXOS_CLIENTMAP  3
+#define PAXOS_PGMAP      4
 
 inline const char *get_paxos_name(int p) {
   switch (p) {
@@ -26,6 +27,7 @@ inline const char *get_paxos_name(int p) {
   case PAXOS_MDSMAP: return "mdsmap";
   case PAXOS_OSDMAP: return "osdmap";
   case PAXOS_CLIENTMAP: return "clientmap";
+  case PAXOS_PGMAP: return "pgmap";
   default: assert(0); return 0;
   }
 }