]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: simplify master log recreation; fix up Log::copy_after
authorSage Weil <sage@newdream.net>
Fri, 12 Dec 2008 23:00:34 +0000 (15:00 -0800)
committerSage Weil <sage@newdream.net>
Fri, 12 Dec 2008 23:12:48 +0000 (15:12 -0800)
Pull log from a given point from peer with the largest last_update.  Do
not worry about divergence on the peer; that is handled by the new
primary.  Simplifies PG::Query struct.

Fix copy_after to set an accurate .bottom, and to behave if the split
point given is divergent (i.e. doesn't actually appear in the log).

src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h

index f2a32f1c56a68929d38085084dda7342e2b24236..bfe66a532a2e1959fe2a9b719ed07f6dfd8253f3 100644 (file)
@@ -2999,14 +2999,17 @@ void OSD::handle_pg_query(MOSDPGQuery *m)
       MOSDPGLog *m = new MOSDPGLog(osdmap->get_epoch(), pg->info);
       m->missing = pg->missing;
 
+      // primary -> other, when building master log
       if (it->second.type == PG::Query::LOG) {
-        dout(10) << *pg << " sending info+missing+log since split " << it->second.split
-                 << " from floor " << it->second.floor 
+        dout(10) << *pg << " sending info+missing+log since " << it->second.floor
                  << dendl;
+       /*
         if (!m->log.copy_after_unless_divergent(pg->log, it->second.split, it->second.floor)) {
           dout(10) << *pg << "  divergent, sending backlog" << dendl;
           it->second.type = PG::Query::BACKLOG;
         }
+       */
+       m->log.copy_after(pg->log, it->second.floor);
       }
 
       if (it->second.type == PG::Query::BACKLOG) {
index 7b2b0dfbb95c71e22c0c3103195b7d8c7968bf82..cbcd403e04b1ba2db22f62838c0be70432f8d17c 100644 (file)
@@ -44,15 +44,18 @@ static ostream& _prefix(PG *pg, int whoami, OSDMap *osdmap) {
 void PG::Log::copy_after(const Log &other, eversion_t v) 
 {
   assert(v >= other.bottom);
-  top = bottom = other.top;
+  top = other.top;
+  bottom = other.bottom;
   for (list<Entry>::const_reverse_iterator i = other.log.rbegin();
        i != other.log.rend();
        i++) {
-    if (i->version == v) break;
+    if (i->version <= v) {
+      bottom = i->version;
+      break;
+    }
     assert(i->version > v);
     log.push_front(*i);
   }
-  bottom = v;
 }
 
 bool PG::Log::copy_after_unless_divergent(const Log &other, eversion_t split, eversion_t floor) 
@@ -1034,7 +1037,8 @@ void PG::peer(ObjectStore::Transaction& t,
                 << " v " << newest_update 
                 << ", querying since " << since
                 << dendl;
-       query_map[newest_update_osd][info.pgid] = Query(Query::LOG, log.top, since, info.history);
+       query_map[newest_update_osd][info.pgid] = Query(Query::LOG, since, info.history);
+       //Query(Query::LOG, log.top, since, info.history);
        peer_log_requested.insert(newest_update_osd);
       }
     } else {
index fadf684d758168b37a137df49f87ff6092f2cd1e..5cf8963cf1ffbee35982d97875928df7752e5c98 100644 (file)
@@ -148,26 +148,30 @@ public:
     const static int LOG = 1;
     const static int BACKLOG = 2;
     const static int FULLLOG = 3;
+    const static int LOGFROM = 4;
 
     __s32 type;
-    eversion_t split, floor;
+    //eversion_t split;
+    eversion_t floor;
     Info::History history;
 
     Query() : type(-1) {}
     Query(int t, Info::History& h) : 
       type(t), history(h) { assert(t != LOG); }
-    Query(int t, eversion_t s, eversion_t f, Info::History& h) : 
-      type(t), split(s), floor(f), history(h) { assert(t == LOG); }
+    Query(int t, eversion_t f, Info::History& h) : 
+      type(t),
+      //split(s), 
+      floor(f), history(h) { assert(t == LOG); }
 
     void encode(bufferlist &bl) const {
       ::encode(type, bl);
-      ::encode(split, bl);
+      //::encode(split, bl);
       ::encode(floor, bl);
       history.encode(bl);
     }
     void decode(bufferlist::iterator &bl) {
       ::decode(type, bl);
-      ::decode(split, bl);
+      //::decode(split, bl);
       ::decode(floor, bl);
       history.decode(bl);
     }