]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: start PG state machine when loading pre-existing PGs
authorJosh Durgin <josh.durgin@dreamhost.com>
Wed, 4 May 2011 19:23:08 +0000 (12:23 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Wed, 4 May 2011 19:23:14 +0000 (12:23 -0700)
This caused a crash when restarting a killed OSD because the Initial
state was receiving the ActMap event.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/osd/OSD.cc
src/osd/OSD.h

index a2f2b485ac003e8610feef0d282e1fc63866face..23feecfff8f96506dc20c7a0ef17e191943ee6b8 100644 (file)
@@ -568,8 +568,10 @@ int OSD::init()
   }
 
   // load up pgs (as they previously existed)
-  load_pgs();
-  
+  // defer querying until after the messenger is initialized
+  map<int, map<pg_t, PG::Query> > query_map;
+  load_pgs(query_map);
+
   dout(2) << "superblock: i am osd" << superblock.whoami << dendl;
   assert_warn(whoami == superblock.whoami);
   if (whoami != superblock.whoami) {
@@ -620,6 +622,8 @@ int OSD::init()
   dout(0) << "started rotating keys" << dendl;
 #endif
 
+  do_queries(query_map);
+
   return 0;
 }
 
@@ -1049,7 +1053,7 @@ PG *OSD::lookup_lock_raw_pg(pg_t pgid)
 }
 
 
-void OSD::load_pgs()
+void OSD::load_pgs(map<int, map<pg_t, PG::Query> > &query_map)
 {
   assert(osd_lock.is_locked());
   dout(10) << "load_pgs" << dendl;
@@ -1089,6 +1093,9 @@ void OSD::load_pgs()
     int role = osdmap->calc_pg_role(whoami, pg->acting, nrep);
     pg->set_role(role);
 
+    PG::RecoveryCtx rctx(&query_map, 0, 0, 0, 0);
+    pg->handle_create(&rctx);
+
     dout(10) << "load_pgs loaded " << *pg << " " << pg->log << dendl;
     pg->unlock();
   }
index 40ff50644ba19f355e0be013e886d63854f430c6..b1b1ae8f4a939e25550ebff636c1d336badb4c67 100644 (file)
@@ -514,7 +514,7 @@ protected:
                       ObjectStore::Transaction **pt,
                       C_Contexts **pfin);
   
-  void load_pgs();
+  void load_pgs(map<int, map<pg_t, PG::Query> > &query_map);
   void calc_priors_during(pg_t pgid, epoch_t start, epoch_t end, set<int>& pset);
   void project_pg_history(pg_t pgid, PG::Info::History& h, epoch_t from,
                          vector<int>& lastup, vector<int>& lastacting);