From 49a96fa739a26c371c4a7fc57ab23b8695aa01bb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 3 Jan 2012 09:30:42 -0800 Subject: [PATCH] osd: parameterize min/max values for backfill scanning For local scans, use the optimal value for the local filestore. For remote scans, make it configurable, so we can control how frequently we need to wait for scan requests over the wire. Signed-off-by: Sage Weil --- src/common/config_opts.h | 2 ++ src/os/ObjectStore.h | 14 ++++++++++++++ src/osd/ReplicatedPG.cc | 11 +++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 10dc823b95135..c70854a0fb843 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -254,6 +254,8 @@ OPTION(osd_map_message_max, OPT_INT, 100) // max maps per MOSDMap message OPTION(osd_op_threads, OPT_INT, 2) // 0 == no threading OPTION(osd_disk_threads, OPT_INT, 1) OPTION(osd_recovery_threads, OPT_INT, 1) +OPTION(osd_backfill_scan_min, OPT_INT, 64) +OPTION(osd_backfill_scan_max, OPT_INT, 512) OPTION(osd_op_thread_timeout, OPT_INT, 30) OPTION(osd_backlog_thread_timeout, OPT_INT, 60*60*1) OPTION(osd_recovery_thread_timeout, OPT_INT, 30) diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 9996f143c521d..eae3c31052490 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -567,6 +567,20 @@ public: virtual int statfs(struct statfs *buf) = 0; + /** + * get ideal min value for collection_list_partial() + * + * default to some arbitrary values; the implementation will override. + */ + virtual int get_ideal_list_min() { return 32; } + + /** + * get ideal max value for collection_list_partial() + * + * default to some arbitrary values; the implementation will override. + */ + virtual int get_ideal_list_max() { return 64; } + // objects virtual bool exists(coll_t cid, const hobject_t& oid) = 0; // useful? virtual int stat(coll_t cid, const hobject_t& oid, struct stat *st) = 0; // struct stat? diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 2bd12748f2118..d68169c4757c6 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -916,7 +916,7 @@ void ReplicatedPG::do_scan(MOSDPGScan *m) { BackfillInterval bi; osr.flush(); - scan_range(m->begin, 100, 200, &bi); + scan_range(m->begin, g_conf->osd_backfill_scan_min, g_conf->osd_backfill_scan_max, &bi); MOSDPGScan *reply = new MOSDPGScan(MOSDPGScan::OP_SCAN_DIGEST, get_osdmap()->get_epoch(), m->query_epoch, info.pgid, bi.begin, bi.end); @@ -5485,7 +5485,10 @@ int ReplicatedPG::recover_backfill(int max) << " info " << pinfo << " interval " << pbi.begin << "-" << pbi.end << " " << pbi.objects.size() << " objects" << dendl; - + + int local_min = osd->store->get_ideal_list_min(); + int local_max = osd->store->get_ideal_list_max(); + // re-scan our local interval to cope with recent changes // FIXME: we could track the eversion_t when we last scanned, and invalidate // that way. or explicitly modify/invalidate when we actually change specific @@ -5493,7 +5496,7 @@ int ReplicatedPG::recover_backfill(int max) dout(10) << " rescanning local backfill_info from " << backfill_pos << dendl; backfill_info.clear(); osr.flush(); - scan_range(backfill_pos, 10, 20, &backfill_info); + scan_range(backfill_pos, local_min, local_max, &backfill_info); int ops = 0; map > to_push; @@ -5507,7 +5510,7 @@ int ReplicatedPG::recover_backfill(int max) if (backfill_info.begin <= pbi.begin && !backfill_info.extends_to_end() && backfill_info.empty()) { osr.flush(); - scan_range(backfill_info.end, 10, 20, &backfill_info); + scan_range(backfill_info.end, local_min, local_max, &backfill_info); backfill_info.trim(); } backfill_pos = backfill_info.begin > pbi.begin ? pbi.begin : backfill_info.begin; -- 2.39.5