"osd_memory_cache_min",
"bluestore_cache_autotune",
"bluestore_cache_autotune_interval",
- "bluestore_no_per_pool_stats_tolerance",
"bluestore_warn_on_legacy_statfs",
NULL
};
void BlueStore::handle_conf_change(const ConfigProxy& conf,
const std::set<std::string> &changed)
{
- if (changed.count("bluestore_no_per_pool_stats_tolerance") ||
- changed.count("bluestore_warn_on_legacy_statfs")) {
+ if (changed.count("bluestore_warn_on_legacy_statfs")) {
_check_legacy_statfs_alert();
}
dout(10) << __func__ << " store_statfs is corrupt, using empty" << dendl;
}
_check_legacy_statfs_alert();
- } else if (cct->_conf->bluestore_no_per_pool_stats_tolerance == "enforce") {
- per_pool_stat_collection = false;
- dout(10) << __func__ << " store_statfs is requested but missing, using empty" << dendl;
} else {
per_pool_stat_collection = true;
dout(10) << __func__ << " per-pool statfs is enabled" << dendl;
void BlueStore::_fsck_check_pool_statfs(
BlueStore::per_pool_statfs& expected_pool_statfs,
- bool need_per_pool_stats,
int64_t& errors,
int64_t& warnings,
BlueStoreRepairer* repairer)
string key = it->key();
if (key == BLUESTORE_GLOBAL_STATFS_KEY) {
if (repairer) {
- if (need_per_pool_stats) {
- ++errors;
- repairer->remove_key(db, PREFIX_STAT, BLUESTORE_GLOBAL_STATFS_KEY);
- derr << "fsck error: " << "legacy statfs record found, removing" << dendl;
- } else {
- derr << "fsck warning: " << "legacy statfs record found, bypassing" << dendl;
- ++warnings;
- }
- } else {
- const char* s;
- if (need_per_pool_stats) {
- ++errors;
- s = "fsck error: ";
- } else {
- s = "fsck warning: ";
- ++warnings;
- }
- derr << s << "legacy statfs record found, suggest to "
- "run store repair/quick_fix to get consistent statistic reports"
+ ++errors;
+ repairer->remove_key(db, PREFIX_STAT, BLUESTORE_GLOBAL_STATFS_KEY);
+ derr << "fsck error: " << "legacy statfs record found, removing"
<< dendl;
}
continue;
}
- if (!need_per_pool_stats) {
- continue;
- }
uint64_t pool_id;
if (get_key_pool_stat(key, &pool_id) < 0) {
derr << "fsck error: bad key " << key
expected_pool_statfs.erase(stat_it);
}
} // if (it)
- for( auto s = expected_pool_statfs.begin(); s != expected_pool_statfs.end();
- ++s) {
- if (s->second.is_zero()) {
+ for (auto& s : expected_pool_statfs) {
+ if (s.second.is_zero()) {
// we might lack empty statfs recs in DB
continue;
}
derr << "fsck error: missing Pool StatFS record for pool "
- << std::hex << s->first << std::dec << dendl;
+ << std::hex << s.first << std::dec << dendl;
if (repairer) {
string key;
- get_pool_stat_key(s->first, &key);
- repairer->fix_statfs(db, key, s->second);
+ get_pool_stat_key(s.first, &key);
+ repairer->fix_statfs(db, key, s.second);
}
++errors;
}
+ if (!per_pool_stat_collection &&
+ cct->_conf->bluestore_fsck_error_on_no_per_pool_stats &&
+ repairer) {
+ // by virtue of running this method, we correct the top-level
+ // error of having global stats
+ repairer->inc_repaired();
+ }
}
BlueStore::OnodeRef BlueStore::fsck_check_objects_shallow(
BlueStore::FSCKDepth depth,
- bool need_per_pool_stats,
int64_t pool_id,
BlueStore::CollectionRef c,
const ghobject_t& oid,
auto& sb_info = ctx.sb_info;
auto repairer = ctx.repairer;
- store_statfs_t* res_statfs = need_per_pool_stats ?
+ store_statfs_t* res_statfs = (per_pool_stat_collection || repairer) ?
&ctx.expected_pool_statfs[pool_id] :
&ctx.expected_store_statfs;
size_t batchCount;
BlueStore* store = nullptr;
- bool need_per_pool_stats;
mempool::bluestore_fsck::list<string>* expecting_shards = nullptr;
ceph::mutex* sb_info_lock = nullptr;
FSCKWorkQueue(std::string n,
size_t _batchCount,
BlueStore* _store,
- bool _need_per_pool_stats,
mempool::bluestore_fsck::list<string>& _expecting_shards,
ceph::mutex* _sb_info_lock,
BlueStore::sb_info_map_t& _sb_info,
WorkQueue_(n, time_t(), time_t()),
batchCount(_batchCount),
store(_store),
- need_per_pool_stats(_need_per_pool_stats),
expecting_shards(&_expecting_shards),
sb_info_lock(_sb_info_lock),
sb_info(&_sb_info),
store->fsck_check_objects_shallow(
BlueStore::FSCK_SHALLOW,
- need_per_pool_stats,
entry.pool_id,
entry.c,
entry.oid,
};
void BlueStore::_fsck_check_objects(FSCKDepth depth,
- bool need_per_pool_stats,
BlueStore::FSCK_ObjectCtx& ctx)
{
//no need for the below lock when in non-shallow mode as
"FSCKWorkQueue",
(thread_count ? : 1) * 32,
this,
- need_per_pool_stats,
expecting_shards,
sb_info_lock,
sb_info,
o = fsck_check_objects_shallow(
depth,
- need_per_pool_stats,
pool_id,
c,
oid,
BlueStoreRepairer repairer;
utime_t start = ceph_clock_now();
- const auto& no_pps_mode = cct->_conf->bluestore_no_per_pool_stats_tolerance;
- bool need_per_pool_stats = no_pps_mode == "until_fsck" ||
- ((no_pps_mode == "until_repair") && repair);
- bool enforce_no_per_pool_stats = no_pps_mode == "enforce";
_fsck_collections(&errors);
used_blocks.resize(fm->get_alloc_units());
errors += r;
}
+ if (!per_pool_stat_collection) {
+ const char *w;
+ if (cct->_conf->bluestore_fsck_error_on_no_per_pool_stats) {
+ w = "error";
+ ++errors;
+ } else {
+ w = "warning";
+ ++warnings;
+ }
+ derr << "fsck " << w << ": store not yet converted to per-pool stats"
+ << dendl;
+ }
// get expected statfs; reset unaffected fields to be able to compare
// structs
statfs(&actual_statfs);
actual_statfs.internal_metadata = 0;
actual_statfs.omap_allocated = 0;
- need_per_pool_stats = per_pool_stat_collection || need_per_pool_stats;
-
if (g_conf()->bluestore_debug_fsck_abort) {
dout(1) << __func__ << " debug abort" << dendl;
goto out_scan;
expected_pool_statfs,
repair ? &repairer : nullptr);
_fsck_check_objects(depth,
- need_per_pool_stats,
ctx);
}
dout(1) << __func__ << " checking shared_blobs" << dendl;
it = db->get_iterator(PREFIX_SHARED_BLOB);
if (it) {
- //FIXME minor: perhaps simplify for shallow mode?
- //fill global if not overriden below
+ // FIXME minor: perhaps simplify for shallow mode?
+ // fill global if not overriden below
auto expected_statfs = &expected_store_statfs;
for (it->lower_bound(string()); it->valid(); it->next()) {
for (auto &r : shared_blob.ref_map.ref_map) {
extents.emplace_back(bluestore_pextent_t(r.first, r.second.length));
}
- if (need_per_pool_stats) {
+ if (per_pool_stat_collection || repair) {
expected_statfs = &expected_pool_statfs[sbi.pool_id];
}
errors += _fsck_check_extents(sbi.cid,
interval_set<uint64_t> to_release;
it = db->get_iterator(PREFIX_OBJ);
if (it) {
- //fill global if not overriden below
+ // fill global if not overriden below
auto expected_statfs = &expected_store_statfs;
CollectionRef c;
if (!c) {
continue;
}
- auto pool_id = c->cid.is_pg(&pgid) ? pgid.pool() : META_POOL_ID;
- if (need_per_pool_stats) {
+ if (per_pool_stat_collection || repair) {
+ auto pool_id = c->cid.is_pg(&pgid) ? pgid.pool() : META_POOL_ID;
expected_statfs = &expected_pool_statfs[pool_id];
}
}
}
sb_info.clear();
- // check global stats if no-pps is enforced only
- if (!need_per_pool_stats) {
- if (!(actual_statfs == expected_store_statfs)) {
- derr << "fsck error: actual " << actual_statfs
- << " != expected " << expected_store_statfs << dendl;
- if (repair) {
- repairer.fix_statfs(db, BLUESTORE_GLOBAL_STATFS_KEY,
- expected_store_statfs);
- }
- ++errors;
+ // check global stats only if fscking (not repairing) w/o per-pool stats
+ if (!per_pool_stat_collection &&
+ !repair &&
+ !(actual_statfs == expected_store_statfs)) {
+ derr << "fsck error: actual " << actual_statfs
+ << " != expected " << expected_store_statfs << dendl;
+ if (repair) {
+ repairer.fix_statfs(db, BLUESTORE_GLOBAL_STATFS_KEY,
+ expected_store_statfs);
}
+ ++errors;
}
- if (!enforce_no_per_pool_stats) {
- dout(1) << __func__ << " checking pool_statfs" << dendl;
- _fsck_check_pool_statfs(expected_pool_statfs, need_per_pool_stats,
- errors, warnings, repair ? &repairer : nullptr);
- }
+
+ dout(1) << __func__ << " checking pool_statfs" << dendl;
+ _fsck_check_pool_statfs(expected_pool_statfs,
+ errors, warnings, repair ? &repairer : nullptr);
if (depth != FSCK_SHALLOW) {
dout(1) << __func__ << " checking for stray omap data" << dendl;
{
string s;
if (!per_pool_stat_collection &&
- cct->_conf->bluestore_no_per_pool_stats_tolerance != "enforce" &&
- cct->_conf->bluestore_warn_on_legacy_statfs) {
+ cct->_conf->bluestore_warn_on_legacy_statfs) {
s = "legacy statfs reporting detected, "
"suggest to run store repair to get consistent statistic reports";
}