]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/osd/PG.cc
update source to 12.2.11
[ceph.git] / ceph / src / osd / PG.cc
index d2760c1aedd0adc4e9444fc9395cd19a5b1c8a32..7965757d7bd461a3d110d96c750d4ed3987ca64a 100644 (file)
@@ -3348,33 +3348,6 @@ 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
@@ -3458,7 +3431,14 @@ void PG::append_log(
        roll_forward_to));
   }
 
-  pg_log.trim(trim_to, info);
+  dout(10) << __func__ << " approx pg log length =  "
+           << pg_log.get_log().approx_size() << dendl;
+  dout(10) << __func__ << " transaction_applied = "
+           << transaction_applied << dendl;
+  if (!transaction_applied)
+    dout(10) << __func__ << " " << pg_whoami
+             << " is backfill target" << dendl;
+  pg_log.trim(trim_to, info, transaction_applied);
 
   // update the local pg, pg log
   dirty_info = true;
@@ -3920,9 +3900,14 @@ void PG::reg_next_scrub()
     return;
 
   utime_t reg_stamp;
-  if (scrubber.must_scrub ||
-      (info.stats.stats_invalid && cct->_conf->osd_scrub_invalid_stats)) {
+  bool must = false;
+  if (scrubber.must_scrub) {
+    // Set the smallest time that isn't utime_t()
+    reg_stamp = utime_t(0,1);
+    must = true;
+  } else if (info.stats.stats_invalid && cct->_conf->osd_scrub_invalid_stats) {
     reg_stamp = ceph_clock_now();
+    must = true;
   } else {
     reg_stamp = info.history.last_scrub_stamp;
   }
@@ -3936,7 +3921,7 @@ void PG::reg_next_scrub()
                                               reg_stamp,
                                               scrub_min_interval,
                                               scrub_max_interval,
-                                              scrubber.must_scrub);
+                                              must);
 }
 
 void PG::unreg_next_scrub()
@@ -4367,7 +4352,7 @@ void PG::_scan_snaps(ScrubMap &smap)
          bool done;
          t.register_on_applied_sync(
            new C_SafeCond(&my_lock, &my_cond, &done, &r));
-         r = osd->store->apply_transaction(osr.get(), std::move(t));
+         r = osd->store->queue_transaction(osr.get(), std::move(t), nullptr);
          if (r != 0) {
            derr << __func__ << ": apply_transaction got " << cpp_strerror(r)
                 << dendl;
@@ -7553,9 +7538,6 @@ 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,