]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clean out acker cruft
authorSage Weil <sage@newdream.net>
Wed, 10 Dec 2008 23:25:30 +0000 (15:25 -0800)
committerSage Weil <sage@newdream.net>
Wed, 17 Dec 2008 18:32:09 +0000 (10:32 -0800)
src/osd/OSD.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/osd_types.h

index 0fb4995538989004f3b6161ef5ad34a25b12dcc7..8597f02ff0a8595d5ab4f4010cb73b62306b10d5 100644 (file)
@@ -640,8 +640,7 @@ PG *OSD::_create_lock_new_pg(pg_t pgid, vector<int>& acting, ObjectStore::Transa
   pg->info.history.epoch_created = 
     pg->info.history.last_epoch_started =
     pg->info.history.same_since =
-    pg->info.history.same_primary_since =
-    pg->info.history.same_acker_since = osdmap->get_epoch();
+    pg->info.history.same_primary_since = osdmap->get_epoch();
 
   pg->write_info(t);
   pg->write_log(t);
@@ -825,23 +824,10 @@ void OSD::project_pg_history(pg_t pgid, PG::Info::History& h, epoch_t from,
         e > h.same_primary_since) {
       dout(15) << "project_pg_history " << pgid << " primary changed in " << e << dendl;
       h.same_primary_since = e;
-    
-      if (g_conf.osd_rep == OSD_REP_PRIMARY)
-        h.same_acker_since = h.same_primary_since;
-    }
-
-    // acker change?
-    if (g_conf.osd_rep != OSD_REP_PRIMARY) {
-      if (!(!acting.empty() && !last.empty() && acting[acting.size()-1] == last[last.size()-1]) &&
-          e > h.same_acker_since) {
-        dout(15) << "project_pg_history " << pgid << " acker changed in " << e << dendl;
-        h.same_acker_since = e;
-      }
     }
 
     if (h.same_since >= e &&
-        h.same_primary_since >= e &&
-        h.same_acker_since >= e) break;
+        h.same_primary_since >= e) break;
   }
 
   dout(15) << "project_pg_history end " << h << dendl;
@@ -2035,7 +2021,6 @@ void OSD::advance_map(ObjectStore::Transaction& t, interval_set<snapid_t>& remov
     // -- there was a change! --
     int oldrole = pg->get_role();
     int oldprimary = pg->get_primary();
-    int oldacker = pg->get_acker();
     vector<int> oldacting = pg->acting;
     
     pg->clear_prior();
@@ -2067,10 +2052,6 @@ void OSD::advance_map(ObjectStore::Transaction& t, interval_set<snapid_t>& remov
       pg->cancel_recovery();
       pg->dirty_info = true;
     }
-    if (oldacker != pg->get_acker()) {
-      pg->info.history.same_acker_since = osdmap->get_epoch();
-      pg->dirty_info = true;
-    }
     
     // deactivate.
     pg->state_clear(PG_STATE_ACTIVE);
@@ -2095,8 +2076,6 @@ void OSD::advance_map(ObjectStore::Transaction& t, interval_set<snapid_t>& remov
       if (osdmap->is_down(oldacting[i]))
        pg->on_osd_failure(oldacting[i]);
     pg->on_change();
-    if (oldacker != pg->get_acker() && oldacker == whoami)
-      pg->on_acker_change();
     
     if (role != oldrole) {
       // old primary?
@@ -3429,7 +3408,7 @@ void OSD::handle_op(MOSDOp *op)
 
     } else {
       // modify
-      if ((pg->get_primary() != whoami ||
+      if ((!pg->is_primary() ||
           !pg->same_for_modify_since(op->get_map_epoch()))) {
        dout(7) << "handle_op pg changed " << pg->info.history
                << " after " << op->get_map_epoch() 
index d986375da57ba4e1afdfa0876c5a6ee26ba86368..3820a96da1c0ff82c8e7dac495263995ed60ae25 100644 (file)
@@ -76,11 +76,10 @@ public:
 
       epoch_t same_since;          // same acting set since
       epoch_t same_primary_since;  // same primary at least back through this epoch.
-      epoch_t same_acker_since;    // same acker at least back through this epoch.
       History() :            
        epoch_created(0),
        last_epoch_started(0),
-       same_since(0), same_primary_since(0), same_acker_since(0) {}
+       same_since(0), same_primary_since(0) {}
 
       void merge(const History &other) {
        if (epoch_created < other.epoch_created)
@@ -94,14 +93,12 @@ public:
        ::encode(last_epoch_started, bl);
        ::encode(same_since, bl);
        ::encode(same_primary_since, bl);
-       ::encode(same_acker_since, bl);
       }
       void decode(bufferlist::iterator &bl) {
        ::decode(epoch_created, bl);
        ::decode(last_epoch_started, bl);
        ::decode(same_since, bl);
        ::decode(same_primary_since, bl);
-       ::decode(same_acker_since, bl);
       }
     } history;
     
@@ -764,29 +761,12 @@ public:
   int        get_nrep() const { return acting.size(); }
 
   int        get_primary() { return acting.empty() ? -1:acting[0]; }
-  //int        get_tail() { return acting.empty() ? -1:acting[ acting.size()-1 ]; }
-  //int        get_acker() { return g_conf.osd_rep == OSD_REP_PRIMARY ? get_primary():get_tail(); }
-  int        get_acker() { 
-    if (g_conf.osd_rep == OSD_REP_PRIMARY ||
-       acting.size() <= 1) 
-      return get_primary();
-    return acting[1];
-  }
   
   int        get_role() const { return role; }
   void       set_role(int r) { role = r; }
 
   bool       is_primary() const { return role == PG_ROLE_HEAD; }
   bool       is_replica() const { return role > 0; }
-  bool       is_acker() const { 
-    if (g_conf.osd_rep == OSD_REP_PRIMARY)
-      return is_primary();
-    else
-      return role == PG_ROLE_ACKER; 
-  }
-  bool       is_head() const { return role == PG_ROLE_HEAD; }
-  bool       is_middle() const { return role == PG_ROLE_MIDDLE; }
-  bool       is_residual() const { return role == PG_ROLE_STRAY; }
   
   //int  get_state() const { return state; }
   bool state_test(int m) const { return (state & m) != 0; }
@@ -848,7 +828,6 @@ public:
   virtual void wait_for_missing_object(object_t oid, Message *op) = 0;
 
   virtual void on_osd_failure(int osd) = 0;
-  virtual void on_acker_change() = 0;
   virtual void on_role_change() = 0;
   virtual void on_change() = 0;
   virtual void on_shutdown() = 0;
@@ -868,7 +847,7 @@ inline ostream& operator<<(ostream& out, const PG::Info::History& h)
 {
   return out << "ec=" << h.epoch_created
             << " les=" << h.last_epoch_started
-            << " " << h.same_since << "/" << h.same_primary_since << "/" << h.same_acker_since;
+            << " " << h.same_since << "/" << h.same_primary_since;
 }
 
 inline ostream& operator<<(ostream& out, const PG::Info& pgi) 
index 5522d25e2eef0f96809994beeabd01517aad949f..48fdc4173c9201fdf136df6958bed7212f74bf5a 100644 (file)
@@ -53,7 +53,7 @@ static const int LOAD_HYBRID     = 3;
 
 bool ReplicatedPG::same_for_read_since(epoch_t e)
 {
-  return (e >= info.history.same_acker_since);
+  return (e >= info.history.same_primary_since);
 }
 
 bool ReplicatedPG::same_for_modify_since(epoch_t e)
@@ -64,8 +64,7 @@ bool ReplicatedPG::same_for_modify_since(epoch_t e)
 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 &&
-         e >= info.history.same_acker_since);    
+  return e >= info.history.same_primary_since;
 }
 
 // ====================
@@ -705,7 +704,7 @@ void ReplicatedPG::op_read(MOSDOp *op)
          osd->store->getattr(info.pgid.to_coll(), poid, "balance-reads", &b, 1) < 0) {
        dout(-10) << "read on replica, object " << poid 
                  << " dne or no balance-reads, fw back to primary" << dendl;
-       osd->messenger->forward_message(op, osd->osdmap->get_inst(get_acker()));
+       osd->messenger->forward_message(op, osd->osdmap->get_inst(get_primary()));
        return;
       }
     }
@@ -2501,11 +2500,6 @@ void ReplicatedPG::on_osd_failure(int o)
   }
 }
 
-void ReplicatedPG::on_acker_change()
-{
-  dout(10) << "on_acker_change" << dendl;
-}
-
 void ReplicatedPG::on_shutdown()
 {
   dout(10) << "on_shutdown" << dendl;
index 19e4ba542557740b0b90cb2b95db931d3507abde..2af3a4b9a6a93015e90898cce49cd63d37ea8c71 100644 (file)
@@ -25,7 +25,7 @@
 
 
 
-#define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v006"
+#define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v007"