Skip to content

Commit

Permalink
Merge PR #30525 into master
Browse files Browse the repository at this point in the history
* refs/pull/30525/head:
	qa/tasks/ceph.conf.template: disable power-of-2 warning
	qa/standalone/mon/health-mute: use power of 2 for pg_num
	osd/OSDMap: remove remaining g_conf() usage
	PendingReleaseNotes: add note for 14.2.5 so we can backport this
	osd/OSDMap: health alert for non-power-of-two pg_num

Reviewed-by: Kai Wagner <kwagner@suse.com>
Reviewed-by: Nathan Cutler <ncutler@suse.com>
Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
  • Loading branch information
liewegas committed Sep 27, 2019
2 parents 964bed7 + 71cbda4 commit dff5697
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 14 deletions.
26 changes: 25 additions & 1 deletion PendingReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,21 @@
ensuring that all clients are hammer or newer allows new features
only supported for `straw2` buckets to be used, including the
`crush-compat` mode for the :ref:`balancer`.



14.2.5
------

* Ceph will now issue a health warning if a RADOS pool as a ``pg_num``
value that is not a power of two. This can be fixed by adjusting
the pool to a nearby power of two::

ceph osd pool set <pool-name> pg_num <new-pg-num>

Alternatively, the warning can be silenced with::

ceph config set global mon_warn_on_pool_pg_num_not_power_of_two false


>=15.0.0
--------
Expand Down Expand Up @@ -148,6 +162,16 @@
* New OSD daemon command dump_scrub_reservations which reveals the
scrub reservations that are held for local (primary) and remote (replica) PGs.

* Ceph will now issue a health warning if a RADOS pool as a ``pg_num``
value that is not a power of two. This can be fixed by adjusting
the pool to a nearby power of two::

ceph osd pool set <pool-name> pg_num <new-pg-num>

Alternatively, the warning can be silenced with::

ceph config set global mon_warn_on_pool_pg_num_not_power_of_two false

* The ``pg_autoscale_mode`` is now set to ``on`` by default for newly
created pools, which means that Ceph will automatically manage the
number of PGs. To change this behavior, or to learn more about PG
Expand Down
17 changes: 17 additions & 0 deletions doc/rados/operations/health-checks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,23 @@ The PG count for existing pools can be increased or new pools can be created.
Please refer to :ref:`choosing-number-of-placement-groups` for more
information.

POOL_PG_NUM_NOT_POWER_OF_TWO
____________________________

One or more pools has a ``pg_num`` value that is not a power of two.
Although this is not strictly incorrect, it does lead to a less
balanced distribution of data because some PGs have roughly twice as
much data as others.

This is easily corrected by setting the ``pg_num`` value for the
affected pool(s) to a nearby power of two::

ceph osd pool set <pool-name> pg_num <value>

This health warning can be disabled with::

ceph config set global mon_warn_on_pool_pg_num_not_power_of_two false

POOL_TOO_FEW_PGS
________________

Expand Down
2 changes: 1 addition & 1 deletion qa/standalone/mon/health-mute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function TEST_mute() {
run_osd $dir 1 || return 1
run_osd $dir 2 || return 1

ceph osd pool create foo 10
ceph osd pool create foo 8
ceph osd pool application enable foo rbd --yes-i-really-mean-it
wait_for_clean || return 1

Expand Down
1 change: 1 addition & 0 deletions qa/tasks/ceph.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
mon warn on no sortbitwise = false
mon warn on osd down out interval zero = false
mon warn on too few osds = false
mon_warn_on_pool_pg_num_not_power_of_two = false

osd pool default erasure code profile = "plugin=jerasure technique=reed_sol_van k=2 m=1 ruleset-failure-domain=osd crush-failure-domain=osd"

Expand Down
5 changes: 5 additions & 0 deletions src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,11 @@ std::vector<Option> get_global_options() {
.add_service("mgr")
.set_description("issue POOL_APP_NOT_ENABLED health warning if pool has not application enabled"),

Option("mon_warn_on_pool_pg_num_not_power_of_two", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(true)
.add_service("mon")
.set_description("issue POOL_PG_NUM_NOT_POWER_OF_TWO warning if pool has a non-power-of-two pg_num value"),

Option("mon_warn_on_misplaced", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.add_service("mgr")
Expand Down
2 changes: 1 addition & 1 deletion src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)

// health
health_check_map_t next;
tmp.check_health(&next);
tmp.check_health(cct, &next);
encode_health(next, t);
}

Expand Down
39 changes: 30 additions & 9 deletions src/osd/OSDMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "common/errno.h"
#include "common/Formatter.h"
#include "common/TextTable.h"
#include "global/global_context.h"
#include "include/ceph_features.h"
#include "include/str_map.h"

Expand Down Expand Up @@ -5468,7 +5467,8 @@ void print_osd_utilization(const OSDMap& osdmap,
}
}

void OSDMap::check_health(health_check_map_t *checks) const
void OSDMap::check_health(CephContext *cct,
health_check_map_t *checks) const
{
int num_osds = get_num_osds();

Expand Down Expand Up @@ -5513,7 +5513,7 @@ void OSDMap::check_health(health_check_map_t *checks) const
break;
type = crush->get_bucket_type(parent_id);
if (!subtree_type_is_down(
g_ceph_context, parent_id, type,
cct, parent_id, type,
&down_in_osds, &up_in_osds, &subtree_up, &subtree_type_down))
break;
current = parent_id;
Expand Down Expand Up @@ -5645,7 +5645,7 @@ void OSDMap::check_health(health_check_map_t *checks) const
{
// An osd could configure failsafe ratio, to something different
// but for now assume it is the same here.
float fsr = g_conf()->osd_failsafe_full_ratio;
float fsr = cct->_conf->osd_failsafe_full_ratio;
if (fsr > 1.0) fsr /= 100;
float fr = get_full_ratio();
float br = get_backfillfull_ratio();
Expand Down Expand Up @@ -5798,19 +5798,19 @@ void OSDMap::check_health(health_check_map_t *checks) const
}

// OLD_CRUSH_TUNABLES
if (g_conf()->mon_warn_on_legacy_crush_tunables) {
if (cct->_conf->mon_warn_on_legacy_crush_tunables) {
string min = crush->get_min_required_version();
if (min < g_conf()->mon_crush_min_required_version) {
if (min < cct->_conf->mon_crush_min_required_version) {
ostringstream ss;
ss << "crush map has legacy tunables (require " << min
<< ", min is " << g_conf()->mon_crush_min_required_version << ")";
<< ", min is " << cct->_conf->mon_crush_min_required_version << ")";
auto& d = checks->add("OLD_CRUSH_TUNABLES", HEALTH_WARN, ss.str(), 0);
d.detail.push_back("see http://docs.ceph.com/docs/master/rados/operations/crush-map/#tunables");
}
}

// OLD_CRUSH_STRAW_CALC_VERSION
if (g_conf()->mon_warn_on_crush_straw_calc_version_zero) {
if (cct->_conf->mon_warn_on_crush_straw_calc_version_zero) {
if (crush->get_straw_calc_version() == 0) {
ostringstream ss;
ss << "crush map has straw_calc_version=0";
Expand All @@ -5821,7 +5821,7 @@ void OSDMap::check_health(health_check_map_t *checks) const
}

// CACHE_POOL_NO_HIT_SET
if (g_conf()->mon_warn_on_cache_pools_without_hit_sets) {
if (cct->_conf->mon_warn_on_cache_pools_without_hit_sets) {
list<string> detail;
for (auto p = pools.cbegin(); p != pools.cend(); ++p) {
const pg_pool_t& info = p->second;
Expand Down Expand Up @@ -5900,6 +5900,27 @@ void OSDMap::check_health(health_check_map_t *checks) const
d.detail.swap(nearfull_detail);
}
}

// POOL_PG_NUM_NOT_POWER_OF_TWO
if (cct->_conf.get_val<bool>("mon_warn_on_pool_pg_num_not_power_of_two")) {
list<string> detail;
for (auto it : get_pools()) {
if (!isp2(it.second.get_pg_num_target())) {
ostringstream ss;
ss << "pool '" << get_pool_name(it.first)
<< "' pg_num " << it.second.get_pg_num_target()
<< " is not a power of two";
detail.push_back(ss.str());
}
}
if (!detail.empty()) {
ostringstream ss;
ss << detail.size() << " pool(s) have non-power-of-two pg_num";
auto& d = checks->add("POOL_PG_NUM_NOT_POWER_OF_TWO", HEALTH_WARN,
ss.str(), detail.size());
d.detail.swap(detail);
}
}
}

int OSDMap::parse_osd_id_list(const vector<string>& ls, set<int> *out,
Expand Down
2 changes: 1 addition & 1 deletion src/osd/OSDMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ class OSDMap {
static void generate_test_instances(std::list<OSDMap*>& o);
bool check_new_blacklist_entries() const { return new_blacklist_entries; }

void check_health(health_check_map_t *checks) const;
void check_health(CephContext *cct, health_check_map_t *checks) const;

int parse_osd_id_list(const std::vector<std::string>& ls,
std::set<int> *out,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/osdmaptool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ int main(int argc, const char **argv)

if (health) {
health_check_map_t checks;
osdmap.check_health(&checks);
osdmap.check_health(cct.get(), &checks);
JSONFormatter jf(true);
jf.dump_object("checks", checks);
jf.flush(cout);
Expand Down

0 comments on commit dff5697

Please sign in to comment.