]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "src/osd/PG.cc: remove redundant call to trim_log()"
authorNeha Ojha <nojha@redhat.com>
Fri, 2 Nov 2018 23:47:54 +0000 (19:47 -0400)
committerNeha Ojha <nojha@redhat.com>
Fri, 2 Nov 2018 23:47:54 +0000 (19:47 -0400)
This reverts commit 31616627dcfb2b6ab7db7da025e191dc34094bb8.

Signed-off-by: Neha Ojha <nojha@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index 6581cc2988b9eca7872d20be9bbbcb340711649e..7dfa1a95adbaee5b476585ad6302b570751227f0 100644 (file)
@@ -3348,6 +3348,33 @@ void PG::write_if_dirty(ObjectStore::Transaction& t)
     t.omap_setkeys(coll, pgmeta_oid, km);
 }
 
+void PG::trim_log()
+{
+  assert(is_primary());
+  calc_trim_to();
+  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();
+        ++i) {
+      if (*i == pg_whoami) continue;
+      osd->send_message_osd_cluster(
+       i->osd,
+       new MOSDPGTrim(
+         get_osdmap()->get_epoch(),
+         spg_t(info.pgid.pgid, i->shard),
+         pg_trim_to),
+       get_osdmap()->get_epoch());
+    }
+
+    // trim primary as well
+    pg_log.trim(pg_trim_to, info);
+    dirty_info = true;
+  }
+}
+
 void PG::add_log_entry(const pg_log_entry_t& e, bool applied)
 {
   // raise last_complete only if we were previously up to date
@@ -7553,6 +7580,9 @@ PG::RecoveryState::Recovered::Recovered(my_context ctx)
     pg->publish_stats_to_osd();
   }
 
+  // trim pglog on recovered
+  pg->trim_log();
+
   // adjust acting set?  (e.g. because backfill completed...)
   bool history_les_bound = false;
   if (pg->acting != pg->up && !pg->choose_acting(auth_log_shard,
index 12bf9e977836ab6d37be4c33aa293d4210cf57f3..234ac13f505ed7fb3ce06cd722fd7ffc9c3bd21e 100644 (file)
@@ -2654,6 +2654,7 @@ public:
     ObjectStore::Transaction &t,
     bool transaction_applied = true);
   bool check_log_for_corruption(ObjectStore *store);
+  void trim_log();
 
   std::string get_corrupt_pg_log_name() const;
   static int read_info(