20 #include <glog/logging.h>
35 uint32_t current_count = 0;
36 for (uint16_t minipage_index = 0; minipage_index <= key_count; ++minipage_index) {
37 const auto& minipage = page->
get_minipage(minipage_index);
56 uint32_t desired_count,
57 bool disable_no_record_split) {
58 LOG(INFO) <<
"Masstree-" <<
get_name() <<
" being fatified for " << desired_count
59 <<
", disable_no_record_split=" << disable_no_record_split;
61 if (desired_count > kIntermediateAlmostFull) {
62 LOG(INFO) <<
"desired_count too large. adjusted to the max";
65 uint32_t initial_children;
67 LOG(INFO) <<
"initial_children=" << initial_children;
72 uint16_t iterations = 0;
73 for (uint32_t count = initial_children; count < desired_count && iterations < 10U; ++iterations) {
77 if (count == new_count) {
78 LOG(WARNING) <<
"Not enough descendants for further fatification. Stopped here";
84 uint32_t after_children;
87 LOG(INFO) <<
"fatify done: Iterations=" << iterations
88 <<
", took " << watch.
elapsed_us() <<
"us in total."
89 <<
" child count: " << initial_children <<
"->" << after_children;
96 bool disable_no_record_split) {
100 uint16_t root_retries = 0;
102 uint16_t skipped_children = 0;
103 uint16_t adopted_children = 0;
104 uint32_t initial_children;
107 if (initial_children + adopted_children >= kIntermediateAlmostFull) {
108 LOG(INFO) <<
"Root page nearing full. Stopped fatification";
120 if (root_retries > 50U) {
121 LOG(WARNING) <<
"Hm? there might be some contention to prevent grow-root. Gave up";
136 minipage.pointers_ + pointer_index,
148 auto mid_slice = low_slice + (high_slice - low_slice) / 2U;
149 SplitBorder split(context, casted, mid_slice, disable_no_record_split);
158 if (grandchild_count >= 2U) {
168 Adopt adopt(context, root, child);
173 uint32_t after_children;
176 LOG(INFO) <<
"fatify_double: adopted " << adopted_children <<
" root-children and skipped "
177 << skipped_children <<
" that are already too sparse in " << watch.
elapsed_us() <<
"us."
178 <<
" child count: " << initial_children <<
"->" << after_children;
const KeySlice kInfimumSlice
const StorageName & get_name() const
void start()
Take current time tick.
SlotIndex get_key_count() const __attribute__((always_inline))
physical key count (those keys might be deleted) in this page.
ErrorStack fatify_first_root(thread::Thread *context, uint32_t desired_count, bool disable_no_record_split)
Defined in masstree_storage_fatify.cpp.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
bool is_moved() const __attribute__((always_inline))
bool is_border() const __attribute__((always_inline))
Represents one thread running on one NUMA core.
ErrorCode follow_page(thread::Thread *context, bool for_writes, storage::DualPagePointer *pointer, MasstreePage **page)
Thread::follow_page_pointer() for masstree.
MiniPage & get_minipage(uint8_t index) __attribute__((always_inline))
Represents one border page in Masstree Storage.
Brings error stacktrace information as return value of functions.
uint64_t KeySlice
Each key slice is an 8-byte integer.
constexpr uint32_t kIntermediateAlmostFull
Common base of MasstreeIntermediatePage and MasstreeBorderPage.
uint32_t count_children_approximate(const MasstreeIntermediatePage *page)
ErrorStack fatify_first_root_double(thread::Thread *context, bool disable_no_record_split)
ErrorCode get_first_root(thread::Thread *context, bool for_write, MasstreeIntermediatePage **root)
Root-node related, such as a method to retrieve 1st-root, to grow, etc.
A system transaction to split a border page in Master-Tree.
uint64_t stop()
Take another current time tick.
KeySlice get_high_fence() const __attribute__((always_inline))
KeySlice get_low_fence() const __attribute__((always_inline))
double elapsed_us() const
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
const ErrorStack kRetOk
Normal return value for no-error case.
const uint32_t kMaxIntermediatePointers
Max number of pointers (if completely filled) stored in an intermediate pages.
const KeySlice kSupremumSlice
Represents one intermediate page in Masstree Storage.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
A high-resolution stop watch.
ErrorCode run_nested_sysxct(xct::SysxctFunctor *functor, uint32_t max_retries=0)
Methods related to System transactions (sysxct) nested under this thread.
#define WRAP_ERROR_CODE(x)
Same as CHECK_ERROR(x) except it receives only an error code, thus more efficient.
A system transaction to adopt foster twins into an intermediate page.
ErrorCode
Enum of error codes defined in error_code.xmacro.
uint8_t find_minipage(KeySlice slice) const __attribute__((always_inline))
Navigates a searching key-slice to one of the mini pages in this page.
uint8_t find_pointer(KeySlice slice) const __attribute__((always_inline))
Navigates a searching key-slice to one of pointers in this mini-page.
ErrorCode approximate_count_root_children(thread::Thread *context, uint32_t *out)
Returns the count of direct children in the first-root node.