]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: scrub: set a min age before we update whole-object digest
authorSage Weil <sage@redhat.com>
Wed, 10 Dec 2014 17:32:50 +0000 (09:32 -0800)
committerSage Weil <sage@redhat.com>
Sat, 20 Dec 2014 15:30:03 +0000 (07:30 -0800)
If an object is being actively updated, the whole-object digest will
quickly be invalidated.  On deep scrub, only record that digest if the
object is a few hours old.  Otherwise, we are wasting an IO.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/osd/PGBackend.cc

index e4e6de21e2bd795c911e4afd1fb33d3a537cef2e..4c191101d5550ef47d096bc7beeda8031232db72 100644 (file)
@@ -566,6 +566,7 @@ OPTION(osd_scrub_chunk_max, OPT_INT, 25)
 OPTION(osd_scrub_sleep, OPT_FLOAT, 0)   // sleep between [deep]scrub ops
 OPTION(osd_deep_scrub_interval, OPT_FLOAT, 60*60*24*7) // once a week
 OPTION(osd_deep_scrub_stride, OPT_INT, 524288)
+OPTION(osd_deep_scrub_update_digest_min_age, OPT_INT, 2*60*60)   // objects must be this old (seconds) before we update the whole-object digest on scrub
 OPTION(osd_scan_list_ping_tp_interval, OPT_U64, 100)
 OPTION(osd_auto_weight, OPT_BOOL, false)
 OPTION(osd_class_dir, OPT_STR, CEPH_LIBDIR "/rados-classes") // where rados plugins are stored
index 1576678a9ca89d69730cd3d2dcf54ab9798bdd73..f0a73ff335c9f8b6e3527a009f0a8fd56a0b566e 100644 (file)
@@ -546,6 +546,7 @@ void PGBackend::be_compare_scrubmaps(
   map<hobject_t,ScrubMap::object>::const_iterator i;
   map<pg_shard_t, ScrubMap *>::const_iterator j;
   set<hobject_t> master_set;
+  utime_t now = ceph_clock_now(NULL);
 
   // Construct master set
   for (j = maps.begin(); j != maps.end(); ++j) {
@@ -619,10 +620,16 @@ void PGBackend::be_compare_scrubmaps(
     if (okseed &&
        auth_object.digest_present && auth_object.omap_digest_present &&
        (!auth_oi.is_data_digest() || !auth_oi.is_omap_digest())) {
-      dout(20) << __func__ << " noting missing digest on " << *k << dendl;
-      missing_digest[*k] = make_pair(auth_object.digest,
-                                    auth_object.omap_digest);
+      utime_t age = now - auth_oi.local_mtime;
+      if (age > g_conf->osd_deep_scrub_update_digest_min_age) {
+       dout(20) << __func__ << " noting missing digest on " << *k << dendl;
+       missing_digest[*k] = make_pair(auth_object.digest,
+                                      auth_object.omap_digest);
+      } else {
+       dout(20) << __func__ << " missing digest but age " << age
+                << " < " << g_conf->osd_deep_scrub_update_digest_min_age
+                << " on " << *k << dendl;
+      }
     }
-
   }
 }