]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: trim primary pglog as well when recovery finishes on a peer
authorZhiqiang Wang <zhiqiang@xsky.com>
Wed, 4 Jan 2017 08:03:08 +0000 (16:03 +0800)
committerZhiqiang Wang <zhiqiang@xsky.com>
Fri, 13 Jan 2017 05:31:23 +0000 (13:31 +0800)
When recovery finishes on primary or on a peer, primary trims pglog
on the peer osds, or peer informs primary to trim pglog. In both of
these cases, trim primary pglog as well as pglog on the peers.

Signed-off-by: Zhiqiang Wang <zhiqiang@xsky.com>
src/osd/PG.cc
src/osd/PG.h

index 5b9903a7f90c0ec21d83ca459d43289ae620ea74..d4e88f6c1b3b1259cac9439e6a838083c91e63a5 100644 (file)
@@ -2951,12 +2951,13 @@ void PG::write_if_dirty(ObjectStore::Transaction& t)
     t.omap_setkeys(coll, pgmeta_oid, km);
 }
 
-void PG::trim_peers()
+void PG::trim_log()
 {
   assert(is_primary());
   calc_trim_to();
-  dout(10) << "trim_peers " << pg_trim_to << dendl;
+  dout(10) << __func__ << " to " << pg_trim_to << dendl;
   if (pg_trim_to != eversion_t()) {
+    // inform peers to trim log
     assert(!actingbackfill.empty());
     for (set<pg_shard_t>::iterator i = actingbackfill.begin();
         i != actingbackfill.end();
@@ -2970,6 +2971,10 @@ void PG::trim_peers()
          pg_trim_to),
        get_osdmap()->get_epoch());
     }
+
+    // trim primary as well
+    pg_log.trim(pg_trim_to, info);
+    dirty_info = true;
   }
 }
 
index 607fadad7039016b3c0722ec521ea142190c6668..70133d052fd05e486e5964857fe0f6e5cf8d3165 100644 (file)
@@ -2239,7 +2239,7 @@ public:
     ObjectStore::Transaction &t,
     bool transaction_applied = true);
   bool check_log_for_corruption(ObjectStore *store);
-  void trim_peers();
+  void trim_log();
 
   std::string get_corrupt_pg_log_name() const;
   static int read_info(