20 #include <glog/logging.h>
35 #define CHECK_AND_ASSERT(x) do { ASSERT_ND(x); if (!(x)) \
36 return ERROR_STACK(kErrorCodeStrMasstreeFailedVerification); } while (0)
58 reinterpret_cast<MasstreeBorderPage*>(layer_root)));
64 reinterpret_cast<MasstreeIntermediatePage*>(layer_root)));
138 for (uint8_t i = 0; i <= key_count; ++i) {
150 mini_high = high_fence;
157 for (uint8_t j = 0; j <= mini_count; ++j) {
159 if (j < mini_count) {
169 page_high = mini_high;
178 if (next->is_border()) {
183 reinterpret_cast<MasstreeBorderPage*>(next)));
189 reinterpret_cast<MasstreeIntermediatePage*>(next)));
192 page_low = page_high.
slice_;
195 previous_low = mini_high.
slice_;
214 if (prev > slice || (prev == slice && prev_len > len)) {
248 CHECK_AND_ASSERT(slice < high_fence.slice_ || page->is_high_fence_supremum());
KeyLength get_remainder_length(SlotIndex index) const __attribute__((always_inline))
const KeySlice kInfimumSlice
SlotIndex get_key_count() const __attribute__((always_inline))
physical key count (those keys might be deleted) in this page.
bool verify_slot_lengthes(SlotIndex index) const
#define CHECK_AND_ASSERT(x)
KeySlice get_slice(SlotIndex index) const __attribute__((always_inline))
bool is_empty_range() const __attribute__((always_inline))
An empty-range page, either intermediate or border, never has any entries.
uint16_t SlotIndex
Index of a record in a (border) page.
bool is_both_null() const
bool is_locked() const __attribute__((always_inline))
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.
ErrorStack verify_single_thread_border(thread::Thread *context, KeySlice low_fence, HighFence high_fence, MasstreeBorderPage *page)
bool is_foster_minor_null() const __attribute__((always_inline))
PageType
The following 1-byte value is stored in the common page header.
bool is_foster_major_null() const __attribute__((always_inline))
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.
bool is_consecutive_inserts() const
Whether this page is receiving only sequential inserts.
DualPagePointer * get_next_layer(SlotIndex index) __attribute__((always_inline))
XctId xct_id_
the second 64bit: Persistent status part of TID.
uint64_t KeySlice
Each key slice is an 8-byte integer.
Definitions of IDs in this package and a few related constant values.
const uint16_t kMaxIntermediateMiniSeparators
Max number of separators stored in the second level of intermediate pages.
uint16_t KeyLength
Represents a byte-length of a key in this package.
Common base of MasstreeIntermediatePage and MasstreeBorderPage.
VolatilePagePointer get_foster_minor() const __attribute__((always_inline))
VolatilePagePointer get_foster_major() const __attribute__((always_inline))
McsRwLock lock_
the first 64bit: Locking part of TID
KeySlice get_separator(uint8_t index) const __attribute__((always_inline))
storage::Page * resolve(storage::VolatilePagePointer ptr) const
Shorthand for get_global_volatile_page_resolver.resolve_offset()
DualPagePointer pointers_[kMaxIntermediateMiniSeparators+1]
const uint16_t kMaxIntermediateSeparators
Max number of separators stored in the first level of intermediate pages.
PageType get_page_type() const
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.
uint8_t get_btree_level() const __attribute__((always_inline))
used only in masstree.
Epoch get_epoch() const __attribute__((always_inline))
const SlotIndex kBorderPageMaxSlots
Maximum number of slots in one MasstreeBorderPage.
bool is_next_layer() const __attribute__((always_inline))
uint8_t get_layer() const __attribute__((always_inline))
Layer-0 stores the first 8 byte slice, Layer-1 next 8 byte...
KeySlice get_high_fence() const __attribute__((always_inline))
P * resolve_cast(storage::VolatilePagePointer ptr) const
resolve() plus reinterpret_cast
KeySlice separators_[kMaxIntermediateMiniSeparators]
Same semantics as separators_ in enclosing class.
Used only for debugging as this is not space efficient.
bool has_foster_child() const __attribute__((always_inline))
KeySlice get_low_fence() const __attribute__((always_inline))
KeySlice get_foster_fence() const __attribute__((always_inline))
ErrorStack verify_page_basic(thread::Thread *context, MasstreePage *page, PageType page_type, KeySlice low_fence, HighFence high_fence)
bool is_high_fence_supremum() const __attribute__((always_inline))
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
const ErrorStack kRetOk
Normal return value for no-error case.
ErrorStack verify_single_thread(thread::Thread *context)
These are defined in masstree_storage_verify.cpp.
ErrorStack verify_single_thread_intermediate(thread::Thread *context, KeySlice low_fence, HighFence high_fence, MasstreeIntermediatePage *page)
bool is_being_written() const __attribute__((always_inline))
const KeySlice kSupremumSlice
xct::RwLockableXctId * get_owner_id(SlotIndex index) __attribute__((always_inline))
Represents one intermediate page in Masstree Storage.
#define WRAP_ERROR_CODE(x)
Same as CHECK_ERROR(x) except it receives only an error code, thus more efficient.
bool does_point_to_layer(SlotIndex index) const __attribute__((always_inline))
ErrorStack verify_single_thread_layer(thread::Thread *context, uint8_t layer, MasstreePage *layer_root)