70 #endif // DOXYGEN_HIDE 92 bool& need_lock,
slotid_t& slot,
bool& found,
bool& took_XN,
bool& is_ghost,
btree_page_h& leaf);
118 bool& need_lock,
slotid_t& slot,
bool& found,
bool& alreay_took_XN,
145 bool& need_lock,
slotid_t& slot,
bool& found,
bool& is_ghost,
237 #endif // DOXYGEN_HIDE 300 bool allow_retry =
true 324 PageID& leaf_pid_causing_failed_upgrade
392 #endif // DOXYGEN_HIDE 536 #endif // DOXYGEN_HIDE 636 #endif // DOXYGEN_HIDE 673 #endif // DOXYGEN_HIDE 693 StoreID store,
int hash_bits,
bool& consistent);
736 #endif // DOXYGEN_HIDE 758 uint16_t inpage_defrag_ghost_threshold = 10,
759 uint16_t inpage_defrag_usage_threshold = 50,
760 bool does_adopt =
true,
761 bool does_merge =
true);
768 uint16_t inpage_defrag_ghost_threshold,
769 uint16_t inpage_defrag_usage_threshold,
799 #endif // DOXYGEN_HIDE 846 return (s_ex_need_counts[hash] > 30);
853 return s_foster_children_counts[hash];
860 if (s_ex_need_counts[hash] < 255) {
861 ++s_ex_need_counts[hash];
867 uint32_t hash =
shpid2hash(new_foster_parent_pid);
869 ++s_foster_children_counts[hash];
870 if (s_foster_children_counts[hash] < 255) {
871 ++s_foster_children_counts[hash];
879 s_ex_need_counts[hash] = 0;
884 uint32_t hash =
shpid2hash(foster_parent_pid);
886 s_foster_children_counts[hash] = 0;
890 #endif // __BTREE_IMPL_H static rc_t _ux_lookup_core(StoreID store, const w_keystr_t &key, bool &found, void *el, smsize_t &elen)
Definition: btree_impl_search.cpp:40
static rc_t _ux_overwrite_core(StoreID store, const w_keystr_t &key, const char *el, smsize_t offset, smsize_t elen)
Definition: btree_impl.cpp:412
static rc_t _sx_grow_tree(btree_page_h &root)
On root page split, allocates a new child, shifts all entries of root to new child, and has the only entry in root (pid0) point to child. Tree grows by 1 level.
Definition: btree_impl_grow.cpp:109
static void increase_ex_need(PageID real_parent_pid)
Definition: btree_impl.h:857
static rc_t _ux_assure_fence_low_entry(btree_page_h &leaf)
Assures the given leaf page has an entry whose key is the low-fence.
Definition: btree_impl_lock.cpp:197
static rc_t _ux_insert_core(StoreID store, const w_keystr_t &key, const cvec_t &elem)
Definition: btree_impl.cpp:42
#define w_assert1(x)
Level 1 should not add significant extra time.
Definition: w_base.h:198
static queue_based_lock_t * mutex_for_high_contention(PageID pid)
Definition: btree_impl.h:838
uint32_t smsize_t
Definition: basics.h:41
static rc_t _ux_verify_tree(StoreID store, int hash_bits, bool &consistent)
Verifies the integrity of whole tree using the fence-key bitmap technique.
Definition: btree_impl_verify.cpp:28
static rc_t _ux_remove(StoreID store, const w_keystr_t &key)
Removes the specified key from B+Tree.
Definition: btree_impl.cpp:458
static uint8_t s_ex_need_counts[1<< GAC_HASH_BITS]
Definition: btree_impl.h:815
static rc_t _ux_update(StoreID store, const w_keystr_t &key, const cvec_t &elem)
This function finds the given key, updates the element if found. If needed, this method also splits t...
Definition: btree_impl.cpp:292
static rc_t _ux_adopt_foster_core(btree_page_h &parent, btree_page_h &child, const w_keystr_t &new_child_key)
Definition: btree_impl_split.cpp:256
Definition: btree_impl.h:808
Page handle for B-Tree data page.
Definition: btree_page_h.h:185
Definition: btree_verify.h:84
Definition: btree_impl.h:264
uint32_t StoreID
Definition: basics.h:47
static rc_t _ux_put_core(StoreID store, const w_keystr_t &key, const cvec_t &elem)
Definition: btree_impl.cpp:155
static bool is_ex_recommended(PageID pid)
Definition: btree_impl.h:843
static rc_t _ux_create_tree_core(const StoreID &stid, const PageID &root_pid)
Definition: btree_impl_grow.cpp:20
Key string class which can represent a few special values.
Definition: w_key.h:47
static rc_t _ux_verify_tree_recurse(btree_page_h &parent, verification_context &context)
Definition: btree_impl_verify.cpp:50
Definition: btree_impl.h:258
static void _ux_traverse_search(btree_impl::traverse_mode_t traverse_mode, btree_page_h *current, const w_keystr_t &key, bool &this_is_the_leaf_page, slot_follow_t &slot_to_follow)
Internal helper function to actually search for the correct slot and test fence assumptions.
Definition: btree_impl_search.cpp:270
static rc_t _ux_insert_core_tail(StoreID store, const w_keystr_t &key, const cvec_t &el, bool &need_lock, slotid_t &slot, bool &found, bool &alreay_took_XN, bool &is_ghost, btree_page_h &leaf)
Definition: btree_impl.cpp:207
static rc_t _sx_adopt_foster(btree_page_h &parent, btree_page_h &child)
Pushes up a foster pointer of child to the parent.
Definition: btree_impl_split.cpp:240
static rc_t _ux_traverse(StoreID store, const w_keystr_t &key, traverse_mode_t traverse_mode, latch_mode_t leaf_latch_mode, btree_page_h &leaf, bool allow_retry=true)
Traverse the btree starting at root node to find an appropriate leaf page.
Definition: btree_impl_search.cpp:92
The internal implementation class which actually implements the functions of btree_m.
Definition: btree_impl.h:66
static rc_t _sx_adopt_foster_all_core(btree_page_h &parent, bool is_root, bool recursive)
Definition: btree_impl_split.cpp:210
static void _ux_adopt_foster_apply_parent(btree_page_h &parent_arg, PageID new_child_pid, lsn_t new_child_emlsn, const w_keystr_t &new_child_key)
Definition: btree_impl_split.cpp:393
static rc_t _ux_traverse_try_opportunistic_adopt(btree_page_h ¤t, btree_page_h &next)
Definition: btree_impl_search.cpp:393
element_lock_mode
Lock mode for one OKVL component (key, partition, or gap).
Definition: w_okvl.h:107
static rc_t _ux_traverse_recurse(btree_page_h &start, const w_keystr_t &key, traverse_mode_t traverse_mode, latch_mode_t leaf_latch_mode, btree_page_h &leaf, PageID &leaf_pid_causing_failed_upgrade)
For internal recursion. Assuming start is non-leaf, check children recursively.
Definition: btree_impl_search.cpp:157
A constant vec_t (meaning things pointed to cannot be changed).
Definition: vec_t.h:95
static void clear_forster_child(PageID foster_parent_pid)
Definition: btree_impl.h:883
static rc_t _sx_split_if_needed(btree_page_h &page, const w_keystr_t &new_key)
Splits the given page if we need to do so for inserting the given key.
Definition: btree_impl_split.cpp:180
Definition: btree_impl.h:248
static void inquery_verify_expect(btree_page_h &page, slot_follow_t next_follow)
Definition: btree_impl_verify.cpp:234
static rc_t _sx_shrink_tree(btree_page_h &root)
Shrink the tree. Copy the child page over the root page so the tree is effectively one level shorter...
Definition: btree_impl_grow.cpp:43
uint32_t PageID
Definition: basics.h:45
static rc_t _sx_split_foster(btree_page_h &page, PageID &new_page_id, const w_keystr_t &triggering_key)
Splits a page, making the new page as foster-child.
Definition: btree_impl_split.cpp:88
static rc_t _sx_adopt_foster_sweep_approximate(btree_page_h &parent, PageID surely_need_child_pid)
Definition: btree_impl_split.cpp:320
static rc_t _sx_reserve_ghost(btree_page_h &leaf, const w_keystr_t &key, int elem_len)
Creates a ghost record for the key as a preparation for insert. Context: System transaction.
Definition: btree_impl.cpp:272
static void _ux_adopt_foster_apply_child(btree_page_h &child)
Definition: btree_impl_split.cpp:417
static rc_t _ux_update_core_tail(StoreID store, const w_keystr_t &key, const cvec_t &elem, bool &need_lock, slotid_t &slot, bool &found, bool &is_ghost, btree_page_h &leaf)
Definition: btree_impl.cpp:361
Log Sequence Number. See Log Sequence Numbers (LSN).
Definition: lsn.h:243
static rc_t _ux_lookup(StoreID store, const w_keystr_t &key, bool &found, void *el, smsize_t &elen)
Definition: btree_impl_search.cpp:27
static uint8_t s_foster_children_counts[1<< GAC_HASH_BITS]
Definition: btree_impl.h:830
static void clear_ex_need(PageID real_parent_pid)
Definition: btree_impl.h:876
static void increase_forster_child(PageID new_foster_parent_pid)
Definition: btree_impl.h:866
static rc_t _ux_verify_volume(int hash_bits, verify_volume_result &result)
Verifies consistency of all BTree indexes in the volume.
Definition: btree_impl_verify.cpp:354
static rc_t _ux_lock_key(const StoreID &store, btree_page_h &leaf, const w_keystr_t &key, latch_mode_t latch_mode, const okvl_mode &lock_mode, bool check_only)
Acquires a lock on the given leaf page, tentatively unlatching the page if needed.
Definition: btree_impl_lock.cpp:25
static rc_t _ux_put(StoreID store, const w_keystr_t &key, const cvec_t &elem)
This function finds the given key, updates the element if found and inserts it if not...
Definition: btree_impl.cpp:140
Return code for most functions and methods.
Definition: w_rc.h:87
static rc_t _ux_traverse_try_eager_adopt(btree_page_h ¤t, PageID next_pid)
Definition: btree_impl_search.cpp:362
static okvl_mode create_part_okvl(okvl_mode::element_lock_mode mode, const w_keystr_t &key)
Definition: btree_impl.cpp:580
static rc_t _ux_lock_range(const StoreID &store, btree_page_h &leaf, const w_keystr_t &key, slotid_t slot, latch_mode_t latch_mode, const okvl_mode &exact_hit_lock_mode, const okvl_mode &miss_lock_mode, bool check_only)
Definition: btree_impl_lock.cpp:131
static rc_t _ux_defrag_page_core(btree_page_h &p)
Definition: btree_impl_defrag.cpp:61
int16_t slotid_t
Definition: basics.h:53
An MCS queuing spinlock.
Definition: mcs_lock.h:61
static rc_t _sx_norec_alloc(btree_page_h &page, PageID &new_page_id)
Creates a new empty page as a foster-child of the given page.
Definition: btree_impl_split.cpp:26
static void inquery_verify_fact(btree_page_h &page)
Definition: btree_impl_verify.cpp:187
static rc_t _ux_insert(StoreID store, const w_keystr_t &key, const cvec_t &elem)
This function finds the leaf page to insert the given tuple, inserts it to the page and...
Definition: btree_impl.cpp:26
static rc_t _ux_get_page_and_status(StoreID store, const w_keystr_t &key, bool &need_lock, slotid_t &slot, bool &found, bool &took_XN, bool &is_ghost, btree_page_h &leaf)
Function finds the leaf page for a key, locks the key if it exists, and determines if it was found an...
Definition: btree_impl.cpp:174
The context object maintained throughout the verification.
Definition: btree_verify.h:18
Represents a lock mode of one key entry in the OKVL lock manager.
Definition: w_okvl.h:95
Definition: btree_impl.h:262
static rc_t _sx_defrag_page(btree_page_h &page)
Defrags the given page to remove holes and ghost records in the page.
Definition: btree_impl_defrag.cpp:53
Definition: btree_impl.h:807
static rc_t _ux_norec_alloc_core(btree_page_h &page, PageID &new_page_id)
Definition: btree_impl_split.cpp:34
static rc_t _ux_defrag_tree_core(StoreID store, uint16_t inpage_defrag_ghost_threshold, uint16_t inpage_defrag_usage_threshold, bool does_adopt, bool does_merge)
Definition: btree_impl_defrag.cpp:39
traverse_mode_t
3 modes of traverse().
Definition: btree_impl.h:243
static rc_t _ux_shrink_tree_core(btree_page_h &root)
Definition: btree_impl_grow.cpp:58
static rc_t _ux_overwrite(StoreID store, const w_keystr_t &key, const char *el, smsize_t offset, smsize_t elen)
This function finds the given key, updates the specific part of element if found. ...
Definition: btree_impl.cpp:398
static uint8_t get_expected_childrens(PageID pid)
Definition: btree_impl.h:850
Definition: btree_impl.h:263
static rc_t _ux_update_core(StoreID store, const w_keystr_t &key, const cvec_t &elem)
Definition: btree_impl.cpp:304
static rc_t _sx_opportunistic_adopt_foster(btree_page_h &parent, btree_page_h &child, bool &pushedup)
Pushes up a foster pointer of child to the parent IF we can get EX latches immediately.
Definition: btree_impl_split.cpp:289
static rc_t _sx_adopt_foster_all(btree_page_h &root, bool recursive=false)
Checks all direct children of parent and, if some child has foster, pushes them up to parent...
Definition: btree_impl_split.cpp:205
latch_mode_t
Definition: latch.h:79
static rc_t _sx_defrag_tree(StoreID store, uint16_t inpage_defrag_ghost_threshold=10, uint16_t inpage_defrag_usage_threshold=50, bool does_adopt=true, bool does_merge=true)
Checks the whole tree to opportunistically adopt, in-page defrag and rebalance.
Definition: btree_impl_defrag.cpp:22
static void inquery_verify_init(StoreID store)
Definition: btree_impl_verify.cpp:175
Definition: btree_impl.h:253
static rc_t _ux_verify_feed_page(btree_page_h &page, verification_context &context)
Definition: btree_impl_verify.cpp:86
static rc_t _ux_undo_ghost_mark(StoreID store, const w_keystr_t &key)
Reverses the ghost record of specified key to regular state.
Definition: btree_impl.cpp:531
static rc_t _sx_adopt_foster_sweep(btree_page_h &parent_arg)
Pushes up all foster-children of children to the parent.
Definition: btree_impl_split.cpp:363
static rc_t _ux_remove_core(StoreID store, const w_keystr_t &key)
Definition: btree_impl.cpp:471
static queue_based_lock_t s_ex_need_mutex[1<< GAC_HASH_BITS]
Definition: btree_impl.h:823
static rc_t _ux_reserve_ghost_core(btree_page_h &leaf, const w_keystr_t &key, int elem_len)
Definition: btree_impl.cpp:280
static uint32_t shpid2hash(PageID pid)
Definition: btree_impl.h:833
slot_follow_t
Definition: btree_impl.h:261