]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make calc_trim_to() independent of min_last_complete_ondisk
authorNeha Ojha <nojha@redhat.com>
Mon, 16 Jul 2018 21:46:21 +0000 (14:46 -0700)
committerNeha Ojha <nojha@redhat.com>
Fri, 18 Jan 2019 19:06:13 +0000 (14:06 -0500)
Signed-off-by: Neha Ojha <nojha@redhat.com>
(cherry picked from commit 1ae5fd32c92ea2f025344c663535d00f71f2cdda)

Conflicts:
src/osd/PrimaryLogPG.cc: min_last_complete_ondisk and
        pg_log.get_can_rollback_to() are no longer the limit of the pg log.
        Make the head of the pg log the new limit for pg log trimming.

src/osd/PrimaryLogPG.cc

index 3d5e76a75160e68289dc4e71d129ff295d2a3971..aefc3bfdac7266e51c97d03826c7205c170f3c33 100644 (file)
@@ -1575,15 +1575,18 @@ void PrimaryLogPG::calc_trim_to()
                 PG_STATE_BACKFILL_TOOFULL)) {
     target = cct->_conf->osd_max_pg_log_entries;
   }
+  // limit pg log trimming up to the head of the log
+  eversion_t limit = pg_log.get_head();
+  dout(10) << __func__ << " limit = " << limit << dendl;
 
-  eversion_t limit = MIN(
-    min_last_complete_ondisk,
-    pg_log.get_can_rollback_to());
   if (limit != eversion_t() &&
       limit != pg_trim_to &&
       pg_log.get_log().approx_size() > target) {
-    size_t num_to_trim = MIN(pg_log.get_log().approx_size() - target,
-                            cct->_conf->osd_pg_log_trim_max);
+    dout(10) << __func__ << " approx pg log length =  "
+             << pg_log.get_log().approx_size() << dendl;
+    size_t num_to_trim = std::min(pg_log.get_log().approx_size() - target,
+                                 cct->_conf->osd_pg_log_trim_max);
+    dout(10) << __func__ << " num_to_trim =  " << num_to_trim << dendl;
     if (num_to_trim < cct->_conf->osd_pg_log_trim_min &&
        cct->_conf->osd_pg_log_trim_max >= cct->_conf->osd_pg_log_trim_min) {
       return;
@@ -1593,16 +1596,15 @@ void PrimaryLogPG::calc_trim_to()
     for (size_t i = 0; i < num_to_trim; ++i) {
       new_trim_to = it->version;
       ++it;
-      if (new_trim_to > limit) {
+      if (new_trim_to >= limit) {
        new_trim_to = limit;
-       dout(10) << "calc_trim_to trimming to min_last_complete_ondisk" << dendl;
+        dout(10) << "calc_trim_to trimming to limit: " << limit << dendl;
        break;
       }
     }
     dout(10) << "calc_trim_to " << pg_trim_to << " -> " << new_trim_to << dendl;
     pg_trim_to = new_trim_to;
     assert(pg_trim_to <= pg_log.get_head());
-    assert(pg_trim_to <= min_last_complete_ondisk);
   }
 }