desc: Remove allocation info from RocksDB and store the info in a new allocation file
default: true
with_legacy: true
+- name: bluestore_debug_inject_allocation_from_file_failure
+ type: float
+ level: dev
+ desc: Enables random error injections when restoring allocation map from file.
+ long_desc: Specifies error injection probability for restoring allocation map from file
+ hence causing full recovery. Intended primarily for testing.
+ default: 0
+ with_legacy: true
- name: bluestore_fsck_on_umount_deep
type: bool
level: dev
#include <boost/container/flat_set.hpp>
#include <boost/algorithm/string.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/uniform_real.hpp>
#include "include/cpp-btree/btree_set.h"
string key;
get_shared_blob_key(sbid, &key);
bluestore_shared_blob_t persistent(sbid);
- persistent.ref_map.get(0xdead0000, 0x1000);
+ persistent.ref_map.get(0xdead0000, min_alloc_size);
bufferlist bl;
encode(persistent, bl);
dout(20) << __func__ << " sbid " << sbid
//-----------------------------------------------------------------------------------
int BlueStore::__restore_allocator(Allocator* allocator, uint64_t *num, uint64_t *bytes)
{
+ if (cct->_conf->bluestore_debug_inject_allocation_from_file_failure > 0) {
+ boost::mt11213b rng(time(NULL));
+ boost::uniform_real<> ur(0, 1);
+ if (ur(rng) < cct->_conf->bluestore_debug_inject_allocation_from_file_failure) {
+ derr << __func__ << " failure injected." << dendl;
+ return -1;
+ }
+ }
utime_t start_time = ceph_clock_now();
BlueFS::FileReader *p_temp_handle = nullptr;
int ret = bluefs->open_for_read(allocator_dir, allocator_file, &p_temp_handle, false);
// set small cache sizes so we see trimming during Synthetic tests
g_ceph_context->_conf.set_val_or_die("bluestore_cache_size_hdd", "4000000");
g_ceph_context->_conf.set_val_or_die("bluestore_cache_size_ssd", "4000000");
+ g_ceph_context->_conf.set_val_or_die(
+ "bluestore_debug_inject_allocation_from_file_failure", "0.67");
// very short *_max prealloc so that we fall back to async submits
g_ceph_context->_conf.set_val_or_die("bluestore_blobid_prealloc", "10");