From: Guang Yang Date: Wed, 2 Dec 2015 23:46:34 +0000 (+0000) Subject: mon: support recovery_priority and recovery_op_priority with monitor commands X-Git-Tag: v10.0.2~110^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f0cc7220d6d72743f12f8ac3adad144fe2650f60;p=ceph.git mon: support recovery_priority and recovery_op_priority with monitor commands Fixes: 13121 Signed-off-by: Guang Yang yguang@yahoo-inc.com --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 0e82188a7eab..8d09f91fba04 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -674,11 +674,11 @@ COMMAND("osd pool rename " \ "rename to ", "osd", "rw", "cli,rest") COMMAND("osd pool get " \ "name=pool,type=CephPoolname " \ - "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval", \ + "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority", \ "get pool parameter ", "osd", "r", "cli,rest") COMMAND("osd pool set " \ "name=pool,type=CephPoolname " \ - "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|debug_fake_ec_pool|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|auid|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval " \ + "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|debug_fake_ec_pool|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|auid|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority " \ "name=val,type=CephString " \ "name=force,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \ "set pool parameter to ", "osd", "rw", "cli,rest") diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index b6148789a75a..d63078eda98e 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2907,7 +2907,8 @@ namespace { ERASURE_CODE_PROFILE, MIN_READ_RECENCY_FOR_PROMOTE, MIN_WRITE_RECENCY_FOR_PROMOTE, FAST_READ, HIT_SET_GRADE_DECAY_RATE, HIT_SET_SEARCH_LAST_N, - SCRUB_MIN_INTERVAL, SCRUB_MAX_INTERVAL, DEEP_SCRUB_INTERVAL}; + SCRUB_MIN_INTERVAL, SCRUB_MAX_INTERVAL, DEEP_SCRUB_INTERVAL, + RECOVERY_PRIORITY, RECOVERY_OP_PRIORITY}; std::set subtract_second_from_first(const std::set& first, @@ -3386,7 +3387,9 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) ("hit_set_search_last_n", HIT_SET_SEARCH_LAST_N) ("scrub_min_interval", SCRUB_MIN_INTERVAL) ("scrub_max_interval", SCRUB_MAX_INTERVAL) - ("deep_scrub_interval", DEEP_SCRUB_INTERVAL); + ("deep_scrub_interval", DEEP_SCRUB_INTERVAL) + ("recovery_priority", RECOVERY_PRIORITY) + ("recovery_op_priority", RECOVERY_OP_PRIORITY); typedef std::set choices_set_t; @@ -3568,6 +3571,8 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) case SCRUB_MIN_INTERVAL: case SCRUB_MAX_INTERVAL: case DEEP_SCRUB_INTERVAL: + case RECOVERY_PRIORITY: + case RECOVERY_OP_PRIORITY: for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) { if (i->second == *it) break; @@ -3699,6 +3704,8 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) case SCRUB_MIN_INTERVAL: case SCRUB_MAX_INTERVAL: case DEEP_SCRUB_INTERVAL: + case RECOVERY_PRIORITY: + case RECOVERY_OP_PRIORITY: for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) { if (i->second == *it) break; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 92201d0d6a97..ba7cfa91f90b 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3127,7 +3127,7 @@ void ReplicatedPG::do_backfill(OpRequestRef op) get_osdmap()->get_epoch(), m->query_epoch, spg_t(info.pgid.pgid, primary.shard)); - reply->set_priority(cct->_conf->osd_recovery_op_priority); + reply->set_priority(get_recovery_op_priority()); osd->send_message_osd_cluster(reply, m->get_connection()); queue_peering_event( CephPeeringEvtRef( @@ -10199,7 +10199,7 @@ int ReplicatedPG::recover_primary(int max, ThreadPool::TPHandle &handle) ++skipped; } else { int r = recover_missing( - soid, need, cct->_conf->osd_recovery_op_priority, h); + soid, need, get_recovery_op_priority(), h); switch (r) { case PULL_YES: ++started; @@ -10222,7 +10222,7 @@ int ReplicatedPG::recover_primary(int max, ThreadPool::TPHandle &handle) pg_log.set_last_requested(v); } - pgbackend->run_recovery_op(h, cct->_conf->osd_recovery_op_priority); + pgbackend->run_recovery_op(h, get_recovery_op_priority()); return started; } @@ -10364,7 +10364,7 @@ int ReplicatedPG::recover_replicas(int max, ThreadPool::TPHandle &handle) } } - pgbackend->run_recovery_op(h, cct->_conf->osd_recovery_op_priority); + pgbackend->run_recovery_op(h, get_recovery_op_priority()); return started; } @@ -10709,7 +10709,7 @@ int ReplicatedPG::recover_backfill( prep_backfill_object_push(to_push[i].get<0>(), to_push[i].get<1>(), to_push[i].get<2>(), to_push[i].get<3>(), h); } - pgbackend->run_recovery_op(h, cct->_conf->osd_recovery_op_priority); + pgbackend->run_recovery_op(h, get_recovery_op_priority()); dout(5) << "backfill_pos is " << backfill_pos << dendl; for (set::iterator i = backfills_in_flight.begin(); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index e31c9fdeecbc..9f328e50d592 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -1491,6 +1491,11 @@ private: hobject_t generate_temp_object(); ///< generate a new temp object name /// generate a new temp object name (for recovery) hobject_t get_temp_recovery_object(eversion_t version, snapid_t snap); + int get_recovery_op_priority() const { + int pri = 0; + pool.info.opts.get(pool_opts_t::RECOVERY_OP_PRIORITY, &pri); + return pri > 0 ? pri : cct->_conf->osd_recovery_op_priority; + } void log_missing(unsigned missing, const boost::optional &head, LogChannelRef clog, diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py index 9ac47c1582ed..53d420f8f870 100755 --- a/src/test/pybind/test_ceph_argparse.py +++ b/src/test/pybind/test_ceph_argparse.py @@ -1034,7 +1034,8 @@ class TestOSD(TestArgparse): for var in ('size', 'min_size', 'crash_replay_interval', 'pg_num', 'pgp_num', 'crush_ruleset', 'auid', 'fast_read', 'scrub_min_interval', 'scrub_max_interval', - 'deep_scrub_interval'): + 'deep_scrub_interval', 'recovery_priority', + 'recovery_op_priority'): self.assert_valid_command(['osd', 'pool', 'get', 'poolname', var]) assert_equal({}, validate_command(sigdict, ['osd', 'pool'])) assert_equal({}, validate_command(sigdict, ['osd', 'pool', @@ -1053,7 +1054,8 @@ class TestOSD(TestArgparse): 'pg_num', 'pgp_num', 'crush_ruleset', 'hashpspool', 'auid', 'fast_read', 'scrub_min_interval', 'scrub_max_interval', - 'deep_scrub_interval'): + 'deep_scrub_interval', 'recovery_priority', + 'recovery_op_priority'): self.assert_valid_command(['osd', 'pool', 'set', 'poolname', var, 'value']) assert_equal({}, validate_command(sigdict, ['osd', 'pool',