From 55bf020b5763e31c6de96bfd9909115a5a7a3261 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 10 Dec 2014 09:32:50 -0800 Subject: [PATCH] osd: scrub: set a min age before we update whole-object digest 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 --- src/common/config_opts.h | 1 + src/osd/PGBackend.cc | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index e4e6de21e2bd7..4c191101d5550 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 1576678a9ca89..f0a73ff335c9f 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -546,6 +546,7 @@ void PGBackend::be_compare_scrubmaps( map::const_iterator i; map::const_iterator j; set 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; + } } - } } -- 2.39.5