*
*/
+#include <algorithm>
#include <list>
#include <map>
#include <ostream>
uint64_t PullOp::cost(CephContext *cct) const
{
- return cct->_conf->osd_push_per_object_cost +
- cct->_conf->osd_recovery_max_chunk;
+ if (cct->_conf->osd_op_queue == "mclock_scheduler") {
+ return std::clamp<uint64_t>(
+ recovery_progress.estimate_remaining_data_to_recover(recovery_info),
+ 1,
+ cct->_conf->osd_recovery_max_chunk);
+ } else {
+ /* We retain this legacy behavior for WeightedPriorityQueue. It seems to
+ * require very large costs for several messages in order to do any
+ * meaningful amount of throttling. This branch should be removed after
+ * Reef.
+ */
+ return cct->_conf->osd_push_per_object_cost +
+ cct->_conf->osd_recovery_max_chunk;
+ }
}
// -- PushOp --
omap_complete;
}
+ uint64_t estimate_remaining_data_to_recover(const ObjectRecoveryInfo& info) const {
+ // Overestimates in case of clones, but avoids traversing copy_subset
+ return info.size - data_recovered_to;
+ }
+
static void generate_test_instances(std::list<ObjectRecoveryProgress*>& o);
void encode(ceph::buffer::list &bl) const;
void decode(ceph::buffer::list::const_iterator &bl);