.set_default(100)
.set_description("Approximate missing objects above which to force auth_log_shard to be primary temporarily"),
- Option("osd_async_recovery_min_pg_log_entries", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+ Option("osd_async_recovery_min_cost", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(100)
- .set_description("Number of entries difference above which to use asynchronous recovery when appropriate"),
+ .set_description("A mixture measure of number of current log entries difference "
+ "and historical missing objects, above which we switch to use "
+ "asynchronous recovery when appropriate"),
Option("osd_max_pg_per_osd_hard_ratio", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
.set_default(3)
// past the authoritative last_update the same as those equal to it.
version_t auth_version = auth_info.last_update.version;
version_t candidate_version = shard_info.last_update.version;
- if (auth_version > candidate_version &&
- (auth_version - candidate_version) > cct->_conf.get_val<uint64_t>("osd_async_recovery_min_pg_log_entries")) {
- candidates_by_cost.insert(make_pair(auth_version - candidate_version, shard_i));
+ auto approx_missing_objects =
+ shard_info.stats.stats.sum.num_objects_missing;
+ if (auth_version > candidate_version) {
+ approx_missing_objects += auth_version - candidate_version;
+ }
+ if (approx_missing_objects > cct->_conf.get_val<uint64_t>(
+ "osd_async_recovery_min_cost")) {
+ candidates_by_cost.insert(make_pair(approx_missing_objects, shard_i));
}
}
continue;
auto shard_info = all_info.find(shard_i)->second;
// use the approximate magnitude of the difference in length of
- // logs as the cost of recovery
+ // logs plus historical missing objects as the cost of recovery
version_t auth_version = auth_info.last_update.version;
version_t candidate_version = shard_info.last_update.version;
- size_t approx_entries;
+ auto approx_missing_objects =
+ shard_info.stats.stats.sum.num_objects_missing;
if (auth_version > candidate_version) {
- approx_entries = auth_version - candidate_version;
+ approx_missing_objects += auth_version - candidate_version;
} else {
- approx_entries = candidate_version - auth_version;
+ approx_missing_objects += candidate_version - auth_version;
}
- if (approx_entries > cct->_conf.get_val<uint64_t>("osd_async_recovery_min_pg_log_entries")) {
- candidates_by_cost.insert(make_pair(approx_entries, shard_i));
+ if (approx_missing_objects > cct->_conf.get_val<uint64_t>(
+ "osd_async_recovery_min_cost")) {
+ candidates_by_cost.insert(make_pair(approx_missing_objects, shard_i));
}
}