Zero  0.1.0
Public Member Functions | Private Attributes | List of all members
borrowed_btree_page_h Class Reference

Specialized variant of btree_page_h that borrows a B-tree page from a fixable_page_h. More...

#include <btree_page_h.h>

Inheritance diagram for borrowed_btree_page_h:
btree_page_h fixable_page_h generic_page_h

Public Member Functions

 borrowed_btree_page_h (fixable_page_h *source)
 
 ~borrowed_btree_page_h ()
 
- Public Member Functions inherited from btree_page_h
 btree_page_h ()
 
 btree_page_h (const btree_page_h &p)
 
 ~btree_page_h ()
 
btree_page_hoperator= (btree_page_h &p)
 
PageID btree_root () const
 
smsize_t used_space () const
 
smsize_t usable_space () const
 
int level () const
 Returns 1 if leaf, >1 if non-leaf. More...
 
PageID pid0 () const
 Returns left-most ptr (used only in non-leaf nodes). More...
 
PageID pid0_opaqueptr () const
 Returns left-most opaque pointer (used only in non-leaf nodes). More...
 
PageID root () const
 Returns root page; used for recovery. More...
 
bool is_leaf () const
 Is associated page a leaf? More...
 
bool is_node () const
 Returns if this page is NOT a leaf. More...
 
bool is_leaf_parent () const
 
PageID get_foster () const
 Returns ID of B-link page (0 if not linked). More...
 
PageID get_foster_opaqueptr () const
 Returns opaque pointer of B-link page (0 if not linked). More...
 
const char * get_prefix_key () const
 Returns the prefix which is removed from all entries in this page. More...
 
int16_t get_prefix_length () const
 Returns the length of prefix key (0 means no prefix compression). More...
 
const char * get_fence_low_key () const
 Returns the low fence key, which is same OR smaller than all entries in this page and its descendants. More...
 
int16_t get_fence_low_length () const
 Returns the length of low fence key. More...
 
void copy_fence_low_key (w_keystr_t &buffer) const
 Constructs w_keystr_t object containing the low-fence key of this page. More...
 
bool is_fence_low_infimum () const
 Returns if the low-fence key is infimum. More...
 
const char * get_fence_high_key_noprefix () const
 
int16_t get_fence_high_length () const
 Returns the length of high fence key with prefix. More...
 
int16_t get_fence_high_length_noprefix () const
 Returns the length of high fence key without prefix. More...
 
void copy_fence_high_key (w_keystr_t &buffer) const
 Constructs w_keystr_t object containing the low-fence key of this page. More...
 
bool is_fence_high_supremum () const
 Returns if the high-fence key is supremum. More...
 
const char * get_chain_fence_high_key () const
 Returns the high fence key of foster chain. More...
 
int16_t get_chain_fence_high_length () const
 Returns the length of high fence key of foster chain. More...
 
void copy_chain_fence_high_key (w_keystr_t &buffer) const
 Constructs w_keystr_t object containing the low-fence key of this page. More...
 
bool fence_contains (const w_keystr_t &key) const
 
int compare_with_fence_low (const w_keystr_t &key) const
 
int compare_with_fence_low (const char *key, size_t key_len) const
 overload for char*. More...
 
int compare_with_fence_low_noprefix (const char *key, size_t key_len) const
 used when the prefix part is already checked key/key_len must be WITHOUT prefix. More...
 
int compare_with_fence_high (const w_keystr_t &key) const
 
int compare_with_fence_high (const char *key, size_t key_len) const
 overload for char*. More...
 
int compare_with_fence_high_noprefix (const char *key, size_t key_len) const
 used when the prefix part is already checked key/key_len must be WITHOUT prefix. More...
 
int compare_with_chain_fence_high (const w_keystr_t &key) const
 
int compare_with_chain_fence_high (const char *key, size_t key_len) const
 overload for char*. More...
 
void accept_empty_child (lsn_t new_lsn, PageID new_page_id, const bool f_redo)
 
rc_t format_foster_child (btree_page_h &parent, const PageID &new_page_id, const w_keystr_t &triggering_key, w_keystr_t &split_key, int &move_count)
 Initialize the page as a foster child of the given parent. More...
 
bool set_foster_child (PageID foster_child_pid, const w_keystr_t &new_fence_high, const w_keystr_t &child_fence_chain)
 Sets the given page ID as foster child of this page. More...
 
void delete_range (int from, int to)
 
rc_t format_steal (lsn_t new_lsn, const PageID &pid, StoreID store, PageID root, int level, PageID pid0, lsn_t pid0_emlsn, PageID foster, lsn_t foster_emlsn, const w_keystr_t &fence_low, const w_keystr_t &fence_high, const w_keystr_t &chain_fence_high, bool log_it=true, btree_page_h *steal_src1=nullptr, int steal_from1=0, int steal_to1=0, btree_page_h *steal_src2=nullptr, int steal_from2=0, int steal_to2=0, bool steal_src2_pid0=false, const bool full_logging=false, const bool log_src_1=false, const bool ghost=false)
 Initializes the associated page, stealing records from other pages as specified. More...
 
void _steal_records (btree_page_h *steal_src, int steal_from, int steal_to, const bool full_logging)
 Steal records from steal_src. Called by format_steal. More...
 
rc_t init_fence_keys (const bool set_low, const w_keystr_t &low, const bool set_high, const w_keystr_t &high, const bool set_chain, const w_keystr_t &chain_fence_high, const bool set_pid0, const PageID new_pid0, const bool set_emlsn, const lsn_t new_pid0_emlsn, const bool set_foster, const PageID foster_pid0, const bool set_foster_emlsn, const lsn_t foster_emlsn, const int remove_count=0)
 
rc_t norecord_split (PageID foster, lsn_t foster_emlsn, const w_keystr_t &fence_high, const w_keystr_t &chain_fence_high)
 
bool check_chance_for_norecord_split (const w_keystr_t &key_to_insert) const
 Returns if whether we can do norecord insert now. More...
 
int nrecs () const
 Returns the number of records in this page. More...
 
int nghosts () const
 Returns the number of ghosts records in this page. More...
 
bool is_ghost (slotid_t slot) const
 Returns if the specified record is a ghost record. More...
 
void get_key (slotid_t slot, w_keystr_t &key) const
 Retrieves key from given record #. More...
 
const char * element (int slot, smsize_t &len, bool &ghost) const
 
bool copy_element (int slot, char *out_buffer, smsize_t &len, bool &ghost) const
 
PageID child (slotid_t slot) const
 Return the (non-opaque) child pointer of record in slot. More...
 
PageID child_opaqueptr (slotid_t slot) const
 Return the opaque child pointer of record in slot. More...
 
PageIDpage_pointer_address (int offset)
 
size_t get_rec_space (int slot) const
 
int16_t calculate_prefix_length (int16_t existing_prefix_len, w_keystr_t low_key, w_keystr_t high_key)
 
rc_t copy_records (const int rec_count, char *data_buffer, smsize_t &len)
 
rc_t insert_records_dest_redo (const int16_t prefix_len, const int32_t move_count, const int16_t record_data_len, const char *record_data)
 
void search (const w_keystr_t &key, bool &found_key, slotid_t &return_slot) const
 
void search (const char *key_raw, size_t key_raw_len, bool &found_key, slotid_t &return_slot) const
 
void search_node (const w_keystr_t &key, slotid_t &return_slot) const
 
rc_t insert_node (const w_keystr_t &key, slotid_t slot, PageID child, const lsn_t &child_emlsn)
 
void mark_ghost (slotid_t slot)
 
void unmark_ghost (slotid_t slot)
 
rc_t replace_ghost (const w_keystr_t &key, const cvec_t &elem, bool redo=false)
 
rc_t replace_fence_rec_nolog_may_defrag (const w_keystr_t &low, const w_keystr_t &high, const w_keystr_t &chain, int new_prefix_length=-1)
 Replaces the special fence record with the given new data, expanding the slot length if needed. More...
 
rc_t replace_fence_rec_nolog_no_defrag (const w_keystr_t &low, const w_keystr_t &high, const w_keystr_t &chain, int new_prefix_length)
 
rc_t remove_shift_nolog (slotid_t slot)
 
rc_t replace_el_nolog (slotid_t slot, const cvec_t &elem)
 
void overwrite_el_nolog (slotid_t slot, smsize_t offset, const char *new_el, smsize_t elen)
 
void reserve_ghost (const w_keystr_t &key, size_t element_length)
 
void reserve_ghost (const char *key_raw, size_t key_raw_len, size_t element_length)
 
void insert_nonghost (const w_keystr_t &key, const cvec_t &elem)
 
bool _is_enough_spacious_ghost (const w_keystr_t &key, slotid_t slot, const cvec_t &el)
 
bool check_space_for_insert_leaf (const w_keystr_t &trunc_key, const cvec_t &el)
 
bool check_space_for_insert_leaf (size_t trunc_key_length, size_t element_length)
 
bool check_space_for_insert_node (const w_keystr_t &key)
 for intermediate node (no element). More...
 
void suggest_fence_for_split (w_keystr_t &mid, slotid_t &right_begins_from, const w_keystr_t &triggering_key) const
 Suggests a new fence key, assuming this page is being split. More...
 
w_keystr_t recalculate_fence_for_split (slotid_t right_begins_from) const
 For recovering the separator key from boundary place. More...
 
bool is_insertion_extremely_skewed_right () const
 
bool is_insertion_skewed_right () const
 
bool is_insertion_skewed_left () const
 
rc_t defrag (const bool full_logging_redo=false)
 Defrags this page to remove holes and ghost records in the page. More...
 
rc_t compress (const w_keystr_t &low, const w_keystr_t &high, const w_keystr_t &chain, bool redo=false)
 Compress page by trying to expand the prefix and truncate keys even further. More...
 
rc_t leaf_stats (btree_lf_stats_t &btree_lf)
 stats for leaf nodes. More...
 
rc_t int_stats (btree_int_stats_t &btree_int)
 stats for interior nodes. More...
 
void print (bool print_elem=false)
 Debugs out the contents of this page. More...
 
bool is_consistent (bool check_keyorder=false, bool check_space=false) const
 
lsn_temlsn_address (general_recordid_t pos)
 
const lsn_tget_emlsn_general (general_recordid_t pos) const
 
void set_emlsn_general (general_recordid_t pos, const lsn_t &lsn)
 Sets the Expected Child LSN of pid0, foster-child, or real child. More...
 
const lsn_tget_foster_emlsn () const
 
const lsn_tget_pid0_emlsn () const
 
- Public Member Functions inherited from fixable_page_h
 fixable_page_h ()
 Create handle not yet fixed to a page. More...
 
 ~fixable_page_h ()
 
fixable_page_hoperator= (fixable_page_h &p)
 
bool is_fixed () const
 Do we have an associated page? More...
 
void unfix (bool evict=false)
 
bool is_bufferpool_managed () const
 Is this page really fixed in bufferpool or a psuedo-fix? More...
 
w_rc_t fix_nonroot (const fixable_page_h &parent, PageID pid, latch_mode_t mode, bool conditional=false, bool virgin_page=false, bool only_if_hit=false)
 
w_rc_t fix_direct (PageID pid, latch_mode_t mode, bool conditional=false, bool virgin_page=false, bool only_if_hit=false, bool do_recovery=true)
 
bf_idx pin_for_refix ()
 
w_rc_t refix_direct (bf_idx idx, latch_mode_t mode, bool conditional=false)
 
w_rc_t fix_root (StoreID store, latch_mode_t mode, bool conditional=false, bool virgin=false)
 
void fix_nonbufferpool_page (generic_page *s)
 
bool is_dirty () const
 
void update_page_lsn (const lsn_t &lsn) const
 Updates page_lsn field stored in CB of buffered page. More...
 
lsn_t get_page_lsn () const
 
uint32_t get_log_volume ()
 returns log volume in the CB More...
 
void increment_log_volume (uint32_t)
 
void reset_log_volume ()
 
bool has_check_recovery ()
 return value of _check_recovery flag on CB More...
 
void set_img_page_lsn (const lsn_t &lsn)
 Updates lsn field inside generic_page (i.e., in the page image) More...
 
bool is_to_be_deleted ()
 
w_rc_t set_to_be_deleted (bool log_it)
 
void unset_to_be_deleted ()
 
void set_check_recovery (bool)
 
void set_tag (page_tag_t tag)
 
latch_mode_t latch_mode () const
 
bool is_latched () const
 Do we hold our page's latch in SH or EX mode? More...
 
bool change_possible_after_fix () const
 
bool upgrade_latch_conditional (latch_mode_t mode=LATCH_EX)
 
bool has_children () const
 
int max_child_slot () const
 
PageIDchild_slot_address (int child_slot) const
 
PageID root () const
 
void setup_for_restore (generic_page *pp)
 
bool is_pinned_for_restore ()
 
- Public Member Functions inherited from generic_page_h
 generic_page_h (generic_page *s)
 
virtual ~generic_page_h ()
 
generic_pageget_generic_page () const
 return pointer to underlying page More...
 
PageID pid () const
 
StoreID store () const
 
page_tag_t tag () const
 
const lsn_tlsn () const
 

Private Attributes

fixable_page_h_source
 

Additional Inherited Members

- Static Public Member Functions inherited from fixable_page_h
static general_recordid_t find_page_id_slot (generic_page *page, PageID pid)
 
- Static Public Attributes inherited from btree_page_h
static smsize_t max_entry_size
 
- Static Public Attributes inherited from fixable_page_h
static int force_Q_fixing = 0
 
- Protected Member Functions inherited from generic_page_h
 generic_page_h (generic_page *s, const PageID &pid, page_tag_t tag, StoreID store)
 
- Protected Attributes inherited from fixable_page_h
bool _bufferpool_managed
 is our associated page managed by the buffer pool? More...
 
latch_mode_t _mode
 
q_ticket_t _Q_ticket
 
- Protected Attributes inherited from generic_page_h
generic_page_pp
 The actual page we are handling; may be NULL for fixable pages. More...
 

Detailed Description

Specialized variant of btree_page_h that borrows a B-tree page from a fixable_page_h.

Borrows the latch of a fixable_page_h for the duration of our existence. Returns the latch when destroyed. Do not use the original handle while its latch is borrowed. Transitive borrowing is fine.

Constructor & Destructor Documentation

§ borrowed_btree_page_h()

borrowed_btree_page_h::borrowed_btree_page_h ( fixable_page_h source)
inline

§ ~borrowed_btree_page_h()

borrowed_btree_page_h::~borrowed_btree_page_h ( )
inline

Member Data Documentation

§ _source

fixable_page_h* borrowed_btree_page_h::_source
private

The documentation for this class was generated from the following file: