]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::calc_trim_to: don't trim past can_rollback_to
authorSamuel Just <sjust@redhat.com>
Fri, 28 Oct 2016 01:36:55 +0000 (18:36 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 17 Nov 2016 18:41:34 +0000 (10:41 -0800)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ReplicatedPG.cc

index 8ee3450cbdb8e7edd531e7c16cbd2317c483cf71..6fdadd310d6ca8727338ca7711dbeac0b8b26073 100644 (file)
@@ -1528,8 +1528,11 @@ void ReplicatedPG::calc_trim_to()
     target = cct->_conf->osd_max_pg_log_entries;
   }
 
-  if (min_last_complete_ondisk != eversion_t() &&
-      min_last_complete_ondisk != pg_trim_to &&
+  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 = pg_log.get_log().approx_size() - target;
     if (num_to_trim < cct->_conf->osd_pg_log_trim_min) {
@@ -1540,8 +1543,8 @@ void ReplicatedPG::calc_trim_to()
     for (size_t i = 0; i < num_to_trim; ++i) {
       new_trim_to = it->version;
       ++it;
-      if (new_trim_to > min_last_complete_ondisk) {
-       new_trim_to = min_last_complete_ondisk;
+      if (new_trim_to > limit) {
+       new_trim_to = limit;
        dout(10) << "calc_trim_to trimming to min_last_complete_ondisk" << dendl;
        break;
       }