]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: use same_acting_since instead of same_primary_since in most cases
authorSage Weil <sage@newdream.net>
Fri, 7 Aug 2009 17:19:08 +0000 (10:19 -0700)
committerSage Weil <sage@newdream.net>
Mon, 10 Aug 2009 20:14:31 +0000 (13:14 -0700)
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc

index 84f9f163887b0e1636e69b9fff9f93ffcb6df5e3..b9ee9faac6aca1d5ca1d67592de12a2cba7277fc 100644 (file)
@@ -2867,9 +2867,9 @@ void OSD::handle_pg_notify(MOSDPGNotify *m)
       PG::Info::History history = it->history;
       project_pg_history(pgid, history, m->get_epoch(), up, acting);
 
-      if (m->get_epoch() < history.same_primary_since) {
-        dout(10) << "handle_pg_notify pg " << pgid << " primary changed in "
-                 << history.same_primary_since << " (msg from " << m->get_epoch() << ")" << dendl;
+      if (m->get_epoch() < history.same_acting_since) {
+        dout(10) << "handle_pg_notify pg " << pgid << " acting changed in "
+                 << history.same_acting_since << " (msg from " << m->get_epoch() << ")" << dendl;
         continue;
       }
 
@@ -2912,9 +2912,9 @@ void OSD::handle_pg_notify(MOSDPGNotify *m)
     } else {
       // already had it.  am i (still) the primary?
       pg = _lookup_lock_pg(pgid);
-      if (m->get_epoch() < pg->info.history.same_primary_since) {
-        dout(10) << *pg << " handle_pg_notify primary changed in "
-                 << pg->info.history.same_primary_since
+      if (m->get_epoch() < pg->info.history.same_acting_since) {
+        dout(10) << *pg << " handle_pg_notify acting changed in "
+                 << pg->info.history.same_acting_since
                  << " (msg from " << m->get_epoch() << ")" << dendl;
         pg->unlock();
         continue;
@@ -3006,7 +3006,7 @@ void OSD::_process_pg_info(epoch_t epoch, int from,
     created++;
   } else {
     pg = _lookup_lock_pg(info.pgid);
-    if (epoch < pg->info.history.same_primary_since) {
+    if (epoch < pg->info.history.same_acting_since) {
       dout(10) << *pg << " got old info " << info << ", ignoring" << dendl;
       pg->unlock();
       return;
@@ -3117,7 +3117,7 @@ void OSD::handle_pg_trim(MOSDPGTrim *m)
     dout(10) << " don't have pg " << m->pgid << dendl;
   } else {
     PG *pg = _lookup_lock_pg(m->pgid);
-    if (m->epoch < pg->info.history.same_primary_since) {
+    if (m->epoch < pg->info.history.same_acting_since) {
       dout(10) << *pg << " got old trim to " << m->trim_to << ", ignoring" << dendl;
       pg->unlock();
       goto out;
@@ -3179,9 +3179,9 @@ void OSD::handle_pg_query(MOSDPGQuery *m)
       PG::Info::History history = it->second.history;
       project_pg_history(pgid, history, m->get_epoch(), up, acting);
 
-      if (m->get_epoch() < history.same_primary_since) {
+      if (m->get_epoch() < history.same_acting_since) {
         dout(10) << " pg " << pgid << " dne, and pg has changed in "
-                 << history.same_primary_since << " (msg from " << m->get_epoch() << ")" << dendl;
+                 << history.same_acting_since << " (msg from " << m->get_epoch() << ")" << dendl;
         continue;
       }
 
@@ -3209,9 +3209,9 @@ void OSD::handle_pg_query(MOSDPGQuery *m)
       pg = _lookup_lock_pg(pgid);
       
       // same primary?
-      if (m->get_epoch() < pg->info.history.same_primary_since) {
-        dout(10) << *pg << " handle_pg_query primary changed in "
-                 << pg->info.history.same_primary_since
+      if (m->get_epoch() < pg->info.history.same_acting_since) {
+        dout(10) << *pg << " handle_pg_query changed in "
+                 << pg->info.history.same_acting_since
                  << " (msg from " << m->get_epoch() << ")" << dendl;
        pg->unlock();
         continue;
index a88d1ad5d2ba6811d2140f331d712e535f3c7e7a..07ddb19eb237aed3765861159fda371589d22a22 100644 (file)
@@ -2132,9 +2132,9 @@ void PG::sub_op_scrub(MOSDSubOp *op)
 {
   dout(7) << "sub_op_scrub" << dendl;
 
-  if (op->map_epoch < info.history.same_primary_since) {
+  if (op->map_epoch < info.history.same_acting_since) {
     dout(10) << "sub_op_scrub discarding old sub_op from "
-            << op->map_epoch << " < " << info.history.same_primary_since << dendl;
+            << op->map_epoch << " < " << info.history.same_acting_since << dendl;
     delete op;
     return;
   }
index 23732dc35eb76f19e6ce7966b16776e815efacda..f7265d765952047cc2585b07723d0d4e170d1ce1 100644 (file)
@@ -117,17 +117,16 @@ public:
       void encode(bufferlist &bl) const {
        ::encode(epoch_created, bl);
        ::encode(last_epoch_started, bl);
-       ::encode(same_up_since, bl);
        ::encode(same_acting_since, bl);
-       ::encode(same_primary_since, bl);
+       ::encode(same_up_since, bl);
+       //::encode(same_primary_since, bl);
       }
-      void decode(bufferlist::iterator &bl, int v=0) {
+      void decode(bufferlist::iterator &bl) {
        ::decode(epoch_created, bl);
        ::decode(last_epoch_started, bl);
-       if (v && v >= 20)
-         ::decode(same_up_since, bl);
        ::decode(same_acting_since, bl);
-       ::decode(same_primary_since, bl);
+       ::decode(same_up_since, bl);
+       //::decode(same_primary_since, bl);
       }
     } history;
     
@@ -161,7 +160,7 @@ public:
       ::decode(log_tail, bl);
       ::decode(log_backlog, bl);
       ::decode(stats, bl);
-      history.decode(bl, v);
+      history.decode(bl);
       ::decode(snap_trimq, bl);
     }
   };
@@ -933,7 +932,7 @@ inline ostream& operator<<(ostream& out, const PG::Info::History& h)
 {
   return out << "ec=" << h.epoch_created
             << " les=" << h.last_epoch_started
-            << " " << h.same_up_since << "/" << h.same_acting_since;
+            << " " << h.same_up_since << "/" << h.same_acting_since << "/" << h.same_primary_since;
 }
 
 inline ostream& operator<<(ostream& out, const PG::Info& pgi) 
index 78232bbcff3f9550c211869740862fbcc45e4452..0fc2ebc0d7a40ccf511201984fc0855f9e036dcf 100644 (file)
@@ -57,18 +57,18 @@ static const int LOAD_HYBRID     = 3;
 
 bool ReplicatedPG::same_for_read_since(epoch_t e)
 {
-  return (e >= info.history.same_primary_since);
+  return (e >= info.history.same_acting_since);
 }
 
 bool ReplicatedPG::same_for_modify_since(epoch_t e)
 {
-  return (e >= info.history.same_primary_since);
+  return (e >= info.history.same_acting_since);
 }
 
 bool ReplicatedPG::same_for_rep_modify_since(epoch_t e)
 {
   // check osd map: same set, or primary+acker?
-  return e >= info.history.same_primary_since;
+  return e >= info.history.same_acting_since;
 }
 
 // ====================
@@ -2456,7 +2456,7 @@ void ReplicatedPG::sub_op_modify(MOSDSubOp *op)
           << dendl;  
 
   // sanity checks
-  assert(op->map_epoch >= info.history.same_primary_since);
+  assert(op->map_epoch >= info.history.same_acting_since);
   assert(is_active());
   assert(is_replica());