OPTION(bluestore_fsck_on_umount_deep, OPT_BOOL)
OPTION(bluestore_fsck_on_mkfs, OPT_BOOL)
OPTION(bluestore_fsck_on_mkfs_deep, OPT_BOOL)
-OPTION(bluestore_fsck_error_on_legacy_stats, OPT_BOOL)
OPTION(bluestore_sync_submit_transaction, OPT_BOOL) // submit kv txn in queueing thread (not kv_sync_thread)
OPTION(bluestore_throttle_bytes, OPT_U64)
OPTION(bluestore_throttle_deferred_bytes, OPT_U64)
OPTION(bluestore_debug_random_read_err, OPT_DOUBLE)
OPTION(bluestore_debug_inject_bug21040, OPT_BOOL)
OPTION(bluestore_debug_inject_csum_err_probability, OPT_FLOAT)
-OPTION(bluestore_debug_no_per_pool_stats, OPT_BOOL)
+OPTION(bluestore_no_per_pool_stats_tolerance, OPT_STR)
OPTION(kstore_max_ops, OPT_U64)
OPTION(kstore_max_bytes, OPT_U64)
.set_default(false)
.set_description("Run deep fsck after mkfs"),
- Option("bluestore_fsck_error_on_legacy_stats", Option::TYPE_BOOL, Option::LEVEL_DEV)
- .set_default(false)
- .set_description("Popup errors on legacy (store-wide only) stats detection"),
-
Option("bluestore_sync_submit_transaction", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Try to submit metadata transaction to rocksdb in queuing thread context"),
.set_default(0.0)
.set_description("inject crc verification errors into bluestore device reads"),
- Option("bluestore_debug_no_per_pool_stats", Option::TYPE_BOOL, Option::LEVEL_DEV)
- .set_default(false)
- .set_description(""),
-
+ Option("bluestore_no_per_pool_stats_tolerance", Option::TYPE_STR, Option::LEVEL_ADVANCED)
+ .set_default("until_repair")
+ .set_flag(Option::FLAG_RUNTIME)
+ .set_enum_allowed({"enforce", "until_repair", "until_fsck"})
+ .set_description("Specified how to treat lack of per-pool stats, e.g. caused by an upgrade")
+ .set_long_description(
+ "'until_fsck' will tolerate the case for regular ops and fail on fsck or repair, the latter will fix the issue, "
+ "'until_repair' will tolerate for regular ops and fsck. Repair indicates and fixes the issue, "
+ "'enforce' will unconditionally use global stats mode."),
// -----------------------------------------
// kstore
} else {
dout(10) << __func__ << " store_statfs is corrupt, using empty" << dendl;
}
- } else if (cct->_conf->bluestore_debug_no_per_pool_stats) {
+ } 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 {
void BlueStore::_fsck_check_pool_statfs(
BlueStore::per_pool_statfs& expected_pool_statfs,
+ bool need_per_pool_stats,
int& errors,
BlueStoreRepairer* repairer)
{
- if (!per_pool_stat_collection) {
- return;
- }
auto it = db->get_iterator(PREFIX_STAT);
if (it) {
for (it->lower_bound(string()); it->valid(); it->next()) {
string key = it->key();
if (key == BLUESTORE_GLOBAL_STATFS_KEY) {
if (repairer) {
- derr << "fsck error: legacy statfs record found, removing" << dendl;
- repairer->remove_key(db, PREFIX_STAT, BLUESTORE_GLOBAL_STATFS_KEY);
- errors++;
+ 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;
+ }
} else {
const char* s = "fsck warning: ";
- if (cct->_conf->bluestore_fsck_error_on_legacy_stats) {
+ if (need_per_pool_stats) {
++errors;
s = "fsck error: ";
}
}
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
store_statfs_t* expected_statfs = nullptr;
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";
int r = _open_path();
if (r < 0)
actual_statfs.internal_metadata = 0;
actual_statfs.omap_allocated = 0;
- // switch to per-pool stats if not explicitly prohibited
- if (!per_pool_stat_collection &&
- !cct->_conf->bluestore_debug_no_per_pool_stats) {
- per_pool_stat_collection = true;
- }
+ need_per_pool_stats = per_pool_stat_collection || need_per_pool_stats;
// walk PREFIX_OBJ
dout(1) << __func__ << " walking object keyspace" << dendl;
auto pool_id = c->cid.is_pg(&pgid) ? pgid.pool() : META_POOL_ID;
dout(20) << __func__ << " collection " << c->cid << " " << c->cnode
<< dendl;
- if (per_pool_stat_collection) {
+ if (need_per_pool_stats) {
expected_statfs = &expected_pool_statfs[pool_id];
}
for (auto &r : shared_blob.ref_map.ref_map) {
extents.emplace_back(bluestore_pextent_t(r.first, r.second.length));
}
- if (per_pool_stat_collection) {
+ if (need_per_pool_stats) {
expected_statfs = &expected_pool_statfs[sbi.pool_id];
}
errors += _fsck_check_extents(sbi.cid,
continue;
}
auto pool_id = c->cid.is_pg(&pgid) ? pgid.pool() : META_POOL_ID;
- if (per_pool_stat_collection) {
+ if (need_per_pool_stats) {
expected_statfs = &expected_pool_statfs[pool_id];
}
}
}
sb_info.clear();
- if (!per_pool_stat_collection) {
+ // 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;
}
++errors;
}
- } else {
+ }
+ if (!enforce_no_per_pool_stats) {
dout(1) << __func__ << " checking pool_statfs" << dendl;
- _fsck_check_pool_statfs(expected_pool_statfs, errors,
- repair ? &repairer : nullptr);
+ _fsck_check_pool_statfs(expected_pool_statfs, need_per_pool_stats,
+ errors, repair ? &repairer : nullptr);
}
dout(1) << __func__ << " checking for stray omap data" << dendl;
vstatfs += txc->statfs_delta; //non-persistent in this mode
} else {
- txc->t->merge(PREFIX_STAT, "bluestore_statfs", bl);
+ txc->t->merge(PREFIX_STAT, BLUESTORE_GLOBAL_STATFS_KEY, bl);
std::lock_guard l(vstatfs_lock);
vstatfs += txc->statfs_delta;
SetVal(g_conf(), "bluestore_max_blob_size",
stringify(2 * offs_base).c_str());
SetVal(g_conf(), "bluestore_extent_map_shard_max_size", "12000");
- SetVal(g_conf(), "bluestore_debug_no_per_pool_stats", "true");
- SetVal(g_conf(), "bluestore_fsck_error_on_legacy_stats", "true");
+ SetVal(g_conf(), "bluestore_no_per_pool_stats_tolerance", "enforce");
StartDeferred(0x10000);
// enable per-pool stats collection hence causing fsck to fail
cerr << "per-pool statfs" << std::endl;
- SetVal(g_conf(), "bluestore_debug_no_per_pool_stats", "false");
+ SetVal(g_conf(), "bluestore_no_per_pool_stats_tolerance", "until_fsck");
g_ceph_context->_conf.apply_changes(nullptr);
ASSERT_EQ(bstore->fsck(false), 2);
ASSERT_EQ(bstore->repair(false), 0);
ASSERT_EQ(bstore->fsck(false), 0);
-
cerr << "Completing" << std::endl;
bstore->mount();