|
Zero
0.1.0
|
Handle class for pages that may be fixed (i.e., paged in by the main buffer manager, zero::buffer_pool::BufferPool) More...
#include <fixable_page_h.h>
Public Member Functions | |
| fixable_page_h () | |
| Create handle not yet fixed to a page. More... | |
| ~fixable_page_h () | |
| fixable_page_h & | operator= (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 |
| PageID * | child_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_page * | get_generic_page () const |
| return pointer to underlying page More... | |
| PageID | pid () const |
| StoreID | store () const |
| page_tag_t | tag () const |
| const lsn_t & | lsn () const |
Static Public Member Functions | |
| static general_recordid_t | find_page_id_slot (generic_page *page, PageID pid) |
Static Public Attributes | |
| static int | force_Q_fixing = 0 |
Protected Attributes | |
| 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... | |
Friends | |
| class | borrowed_btree_page_h |
Additional Inherited Members | |
Protected Member Functions inherited from generic_page_h | |
| generic_page_h (generic_page *s, const PageID &pid, page_tag_t tag, StoreID store) | |
Handle class for pages that may be fixed (i.e., paged in by the main buffer manager, zero::buffer_pool::BufferPool)
Currently, only B-tree pages are fixable.
Pages fixed using latching mode Q for the page being fixed are still subject to modification by other threads at any time, including replacement by a different page; the methods of this class are safe to use in this case (but may return errors such as eLATCHQFAIL) but super or subclass methods may not be safe to use in this case unless their description specifically says so or they are labeled "robust".
|
inline |
Create handle not yet fixed to a page.
|
inline |
| bool fixable_page_h::change_possible_after_fix | ( | ) | const |
Could someone else have changed our page via a EX latch since we last fixed it?
Returns false for non-bufferpool managed pages as they are assumed to be private pages not in the buffer pool.
| PageID * fixable_page_h::child_slot_address | ( | int | child_slot | ) | const |
valid slots are [-1 .. max_child_slot()], where -1 is foster pointer and 0 is pid0
|
static |
Search in the given page to find the slot that contains the page id as a child. Returns >0 if a normal slot, 0 if pid0, -1 if foster, -2 if not found.
| w_rc_t fixable_page_h::fix_direct | ( | PageID | pid, |
| latch_mode_t | mode, | ||
| bool | conditional = false, |
||
| bool | virgin_page = false, |
||
| bool | only_if_hit = false, |
||
| bool | do_recovery = true |
||
| ) |
| void fixable_page_h::fix_nonbufferpool_page | ( | generic_page * | s | ) |
Imaginery 'fix' for a non-bufferpool-managed page.
The resulting page is considered to be latched in EX mode.
| w_rc_t fixable_page_h::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 |
||
| ) |
Fixes a non-root page in the bufferpool. This method receives the parent page and efficiently fixes the page if the shpid (pointer) is already swizzled by the parent page. The optimization is transparent for most of the code because the shpid stored in the parent page is automatically (and atomically) changed to a swizzled pointer when permited by the latch mode.
| [in] | parent | parent of the page to be fixed. If you can't provide this, use fix_direct() though it can't exploit pointer swizzling and thus will be slower. |
| [in] | pid | ID of the page to fix (or bufferpool index when swizzled) |
| [in] | mode | latch mode. Can be Q, SH, or EX. |
| [in] | conditional | whether the fix is conditional (returns immediately even if failed). |
| [in] | virgin_page | whether the page is a new page and thus doesn't have to be read from disk. |
| [in] | only_if_hit | whether the page shouldn't be fixed on a page miss. |
If parent.latch_mode() or mode is LATCH_Q, can return eLATCHQFAIL, ePARENTLATCHQFAIL, or eNEEDREALLATCH. The later occurs only when virgin_page is true or pid is not swizzled.
| w_rc_t fixable_page_h::fix_root | ( | StoreID | store, |
| latch_mode_t | mode, | ||
| bool | conditional = false, |
||
| bool | virgin = false |
||
| ) |
Fixes an existing (not virgin) root page for the given store. This method doesn't receive page ID because it's already known by bufferpool.
| uint32_t fixable_page_h::get_log_volume | ( | ) |
returns log volume in the CB
| lsn_t fixable_page_h::get_page_lsn | ( | ) | const |
| bool fixable_page_h::has_check_recovery | ( | ) |
return value of _check_recovery flag on CB
| bool fixable_page_h::has_children | ( | ) | const |
| void fixable_page_h::increment_log_volume | ( | uint32_t | v | ) |
|
inline |
Is this page really fixed in bufferpool or a psuedo-fix?
| bool fixable_page_h::is_dirty | ( | ) | const |
Return true if this page in the bufferpool is marked dirty. If this page is not a bufferpool-managed page, returns false.
|
inline |
Do we have an associated page?
|
inline |
Do we hold our page's latch in SH or EX mode?
| bool fixable_page_h::is_pinned_for_restore | ( | ) |
| bool fixable_page_h::is_to_be_deleted | ( | ) |
Return flag for if this page to be deleted when bufferpool evicts it.
|
inline |
| int fixable_page_h::max_child_slot | ( | ) | const |
|
inline |
assignment; steals the ownership of the page/latch p and unfixes old associated page if exists and is different
| bf_idx fixable_page_h::pin_for_refix | ( | ) |
Adds an additional pin count for the given page. This is used to re-fix the page later without parent pointer. See fix_direct() why we need this feature. Never forget to call a corresponding unpin_for_refix() for this page. Otherwise, the page will be in the bufferpool forever.
| w_rc_t fixable_page_h::refix_direct | ( | bf_idx | idx, |
| latch_mode_t | mode, | ||
| bool | conditional = false |
||
| ) |
Fixes a page with the already known slot index, assuming the slot has at least one pin count. Used with pin_for_refix() and unpin_for_refix().
Currently returns eNEEDREALLATCH if mode is Q
| void fixable_page_h::reset_log_volume | ( | ) |
| PageID fixable_page_h::root | ( | ) | const |
| void fixable_page_h::set_check_recovery | ( | bool | chk | ) |
| void fixable_page_h::set_img_page_lsn | ( | const lsn_t & | lsn | ) |
Updates lsn field inside generic_page (i.e., in the page image)
|
inline |
| rc_t fixable_page_h::set_to_be_deleted | ( | bool | log_it | ) |
Flag this page to be deleted when bufferpool evicts it.
| void fixable_page_h::setup_for_restore | ( | generic_page * | pp | ) |
Used by restore to perform REDO on a page allocated ouside the buffer pool. Ideally, this would not be necessary, but unfortunately, the log record interface requires a fixable_page_h to perform REDO.
| void fixable_page_h::unfix | ( | bool | evict = false | ) |
Unassociate us with any page; releases latch we may have held on previously associated page.
| void fixable_page_h::unset_to_be_deleted | ( | ) |
Unset the to be deleted flag. This is only used by UNDO, so no logging and no failure possible.
| void fixable_page_h::update_page_lsn | ( | const lsn_t & | lsn | ) | const |
Updates page_lsn field stored in CB of buffered page.
| bool fixable_page_h::upgrade_latch_conditional | ( | latch_mode_t | mode = LATCH_EX | ) |
Attempt to upgrade our latch to at least mode, which must be either LATCH_EX (the default) or LATCH_SH. Returns true iff our latch mode afterwards is >= mode. Our latch mode is unchanged if we return false.
WARNING: this operation can spuriously fail once in a while (e.g., S -> X may fail even without any other latch holders).
|
friend |
|
protected |
is our associated page managed by the buffer pool?
|
protected |
|
protected |
|
static |
1.8.12