This ability only makes sense as a step that allows to perform fsck before commiting recovered bluefs log.
Fixes: https://tracker.ceph.com/issues/46552
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
(cherry-picked from commit
7b01af4d95bfa789b3b3247d016431fdbfd844a4)
Conflicts:
src/os/bluestore/BlueFS.cc
OPTION(bluefs_preextend_wal_files, OPT_BOOL) // this *requires* that rocksdb has recycling enabled
OPTION(bluefs_log_replay_check_allocations, OPT_BOOL)
OPTION(bluefs_replay_recovery, OPT_BOOL)
+OPTION(bluefs_replay_recovery_disable_compact, OPT_BOOL)
OPTION(bluestore_bluefs, OPT_BOOL)
OPTION(bluestore_bluefs_env_mirror, OPT_BOOL) // mirror to normal Env for debug
"This options enables heuristics that scans devices for missing data. "
"DO NOT ENABLE BY DEFAULT"),
+ Option("bluefs_replay_recovery_disable_compact", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+ .set_default(false)
+ .set_description(""),
+
Option("bluestore_bluefs", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(true)
.set_flag(Option::FLAG_CREATE)
void BlueFS::compact_log()
{
- std::unique_lock l(lock);
- if (cct->_conf->bluefs_compact_log_sync) {
- _compact_log_sync();
- } else {
- _compact_log_async(l);
+ std::unique_lock<ceph::mutex> l(lock);
+ if (!cct->_conf->bluefs_replay_recovery_disable_compact) {
+ if (cct->_conf->bluefs_compact_log_sync) {
+ _compact_log_sync();
+ } else {
+ _compact_log_async(l);
+ }
}
}
void BlueFS::sync_metadata(bool avoid_compact)
{
- std::unique_lock l(lock);
+ std::unique_lock<ceph::mutex> l(lock);
if (log_t.empty() && dirty_files.empty()) {
dout(10) << __func__ << " - no pending log events" << dendl;
} else {
dout(10) << __func__ << " done in " << (ceph_clock_now() - start) << dendl;
}
- if (!avoid_compact && _should_compact_log()) {
+ if (!avoid_compact) {
+ _maybe_compact_log(l);
+ }
+}
+
+void BlueFS::_maybe_compact_log(std::unique_lock<ceph::mutex>& l)
+{
+ if (!cct->_conf->bluefs_replay_recovery_disable_compact &&
+ _should_compact_log()) {
if (cct->_conf->bluefs_compact_log_sync) {
_compact_log_sync();
} else {
uint64_t jump_to = 0);
uint64_t _estimate_log_size();
bool _should_compact_log();
+ void _maybe_compact_log(std::unique_lock<ceph::mutex>& l);
enum {
REMOVE_DB = 1,