From: xie xingguo Date: Wed, 23 Mar 2016 08:50:43 +0000 (+0800) Subject: osd/pg: reset handle during add_batch_sources_info() X-Git-Tag: v10.1.1~95^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f2a752d9f2c80ad4403708490d7d7b5b88f1c71d;p=ceph.git osd/pg: reset handle during add_batch_sources_info() So if needs_recovery_map gets too big, we don't starve serving thread during peering. Signed-off-by: xie xingguo --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a0dd96ce2acd..4e3a60349abc 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -487,12 +487,17 @@ bool PG::MissingLoc::readable_with_acting( } void PG::MissingLoc::add_batch_sources_info( - const set &sources) + const set &sources, ThreadPool::TPHandle* handle) { dout(10) << __func__ << ": adding sources in batch " << sources.size() << dendl; + unsigned loop = 0; for (map::const_iterator i = needs_recovery_map.begin(); i != needs_recovery_map.end(); ++i) { + if (handle && ++loop >= g_conf->osd_loop_before_reset_tphandle) { + handle->reset_tp_timeout(); + loop = 0; + } missing_loc[i->first].insert(sources.begin(), sources.end()); missing_loc_sources.insert(sources.begin(), sources.end()); } @@ -1801,7 +1806,7 @@ void PG::activate(ObjectStore::Transaction& t, // and covers vast majority of the use cases, like one OSD/host is down for // a while for hardware repairing if (complete_shards.size() + 1 == actingbackfill.size()) { - missing_loc.add_batch_sources_info(complete_shards); + missing_loc.add_batch_sources_info(complete_shards, ctx->handle); } else { missing_loc.add_source_info(pg_whoami, info, pg_log.get_missing(), get_sort_bitwise(), ctx->handle); diff --git a/src/osd/PG.h b/src/osd/PG.h index 941010e225be..b3c68e9510c9 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -409,7 +409,8 @@ public: /// Adds recovery sources in batch void add_batch_sources_info( - const set &sources ///< [in] a set of resources which can be used for all objects + const set &sources, ///< [in] a set of resources which can be used for all objects + ThreadPool::TPHandle* handle ///< [in] ThreadPool handle ); /// Uses osdmap to update structures for now down sources