1 #ifndef __ZERO_PAGE_EVICTIONER_OTHER_HPP 2 #define __ZERO_PAGE_EVICTIONER_OTHER_HPP 23 template<
bool on_page_unfix>
35 _clocks(bufferPool->getBlockCount()),
36 _b1(bufferPool->getBlockCount() - 1),
37 _b2(bufferPool->getBlockCount() - 1),
39 _c(bufferPool->getBlockCount() - 1),
58 bool evictedPage =
false;
62 while (!evictedPage) {
68 smlevel_0::bf->getPageCleaner()->wakeup(
false);
69 DBG3(<<
"Run Page_Cleaner ...");
72 uint32_t iterations = (blockedT1 + blockedT2) /
_c;
73 if ((blockedT1 + blockedT2) %
_c == 0 && (blockedT1 + blockedT2) > 0) {
74 DBG1(<<
"Iterated " << iterations <<
"-times in CAR's pick_victim().");
89 PageID evictedPID = smlevel_0::bf->getControlBlock(t1HeadIndex)._pid;
94 DBG5(<<
"Removed from T_1: " << t1HeadIndex <<
"; New size: " <<
_clocks.
sizeOf<
T_1>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
106 DBG5(<<
"Removed from T_1: " << t1HeadIndex <<
"; New size: " <<
_clocks.
sizeOf<
T_1>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
107 DBG5(<<
"Added to T_2: " << t1HeadIndex <<
"; New size: " <<
_clocks.
sizeOf<
T_2>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
118 evictedPage =
evictOne(t2HeadIndex);
119 PageID evictedPID = smlevel_0::bf->getControlBlock(t2HeadIndex)._pid;
124 DBG5(<<
"Removed from T_2: " << t2HeadIndex <<
"; New size: " <<
_clocks.
sizeOf<
T_2>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
155 if constexpr (!on_page_unfix) {
168 if constexpr (on_page_unfix) {
192 DBG5(<<
"Added to T_1: " << idx <<
"; New size: " <<
_clocks.
sizeOf<
T_1>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
198 DBG5(<<
"Added to T_2: " << idx <<
"; New size: " <<
_clocks.
sizeOf<
T_2>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
204 DBG5(<<
"Added to T_2: " << idx <<
"; New size: " <<
_clocks.
sizeOf<
T_2>() <<
"; Free frames: " << smlevel_0::bf->getFreeList()->getCount());
360 #endif // __ZERO_PAGE_EVICTIONER_OTHER_HPP clock_index
Clock names.
Definition: page_evictioner_other.hpp:354
PageEvictionerCAR(const BufferPool *bufferPool)
Constructor for a CAR page evictioner.
Definition: page_evictioner_other.hpp:33
void moveHead()
Move the clock hand forward.
Definition: multi_clock.hpp:156
#define w_assert1(x)
Level 1 should not add significant extra time.
Definition: w_base.h:198
hashtable_deque::HashtableDeque< PageID, 1|0x80000000 > _b1
LRU-list .
Definition: page_evictioner_other.hpp:310
Definition: buffer_pool.hpp:34
hashtable_deque::HashtableDeque< PageID, 1|0x80000000 > _b2
LRU-list .
Definition: page_evictioner_other.hpp:317
#define DBG3(a)
Definition: w_debug.h:253
void updateOnPageExplicitlyUnbuffered(bf_idx idx) noexcept final
Updates the eviction statistics on explicit eviction.
Definition: page_evictioner_other.hpp:261
~PageEvictionerCAR() final
Destructor for a CAR page evictioner.
Definition: page_evictioner_other.hpp:45
void updateOnPageUnfix(bf_idx idx) noexcept final
Updates the eviction statistics on page unfix.
Definition: page_evictioner_other.hpp:167
void updateOnPointerSwizzling(bf_idx idx) noexcept final
Updates the eviction statistics of pages when its pointer got swizzled in its parent page...
Definition: page_evictioner_other.hpp:275
void updateOnPageMiss(bf_idx idx, PageID pid) noexcept final
Updates the eviction statistics on page miss.
Definition: page_evictioner_other.hpp:183
uint32_t bf_idx
Definition: basics.h:56
bool evictOne(bf_idx &victim)
Evicts a page from the buffer pool.
Definition: page_evictioner.cpp:24
Page evictioner for the buffer pool.
Definition: page_evictioner.hpp:24
u_int32_t _p
Parameter .
Definition: page_evictioner_other.hpp:323
multi_clock::MultiHandedClock< bf_idx, bool, 2, 0 > _clocks
Clocks and .
Definition: page_evictioner_other.hpp:303
bool contains(const key_type &k) const noexcept
Entry with given key contained.
Definition: hashtable_deque.hpp:69
virtual void releaseInternalLatches() noexcept final
Releases the internal latches of this page evictioner.
Definition: page_evictioner_other.hpp:288
std::mutex _latch
Latch of _clocks, _b1 and _b2.
Definition: page_evictioner_other.hpp:347
void remove(const key_type &index)
Remove the specified entry from any clock.
Definition: multi_clock.hpp:437
uint32_t PageID
Definition: basics.h:45
void switchHeadToTail(key_type &movedIndex)
Moves an entry from the head of one clock to the tail of another one.
Definition: multi_clock.hpp:484
void popFromFront()
Removes the next key from this deque.
Definition: hashtable_deque.hpp:143
#define DBG1(a)
Definition: w_debug.h:251
void updateOnPageFixed(bf_idx idx) noexcept final
Updates the eviction statistics of used pages during eviction.
Definition: page_evictioner_other.hpp:223
void getHeadIndex(key_type &headIndex) const
Get the index of the entry where the clock hand of the specified clock points to. ...
Definition: multi_clock.hpp:133
uint64_t length() const noexcept
Number of entries in this deque.
Definition: hashtable_deque.hpp:805
Definition: page_evictioner_other.hpp:355
void getHead(value_type &head) const
Get the value of the entry where the clock hand of the specified clock points to. ...
Definition: multi_clock.hpp:91
Definition: page_evictioner_other.hpp:356
bf_idx pickVictim() noexcept final
Selects a page to be evicted from the buffer pool.
Definition: page_evictioner_other.hpp:57
void remove(const key_type &k)
Removes a specific key from this deque.
Definition: hashtable_deque.hpp:343
void updateOnPageSwizzled(bf_idx idx) noexcept final
Updates the eviction statistics of pages containing swizzled pointers during eviction.
Definition: page_evictioner_other.hpp:252
A buffer manager that exploits the tree structure of indexes.
Definition: buffer_pool.hpp:40
void updateOnPageHit(bf_idx idx) noexcept final
Updates the eviction statistics on page hit.
Definition: page_evictioner_other.hpp:154
void updateOnPageBlocked(bf_idx idx) noexcept final
Updates the eviction statistics of pages that cannot be evicted at all.
Definition: page_evictioner_other.hpp:241
void updateOnPageDirty(bf_idx idx) noexcept final
Updates the eviction statistics of dirty pages during eviction.
Definition: page_evictioner_other.hpp:232
void addTail(const key_type &index)
Make the specified index the__ZERO_MULTICLOCK_HPP tail of the specified clock.
Definition: multi_clock.hpp:182
Page Eviction Algorithm CAR.
Definition: page_evictioner_other.hpp:24
void pushToBack(const key_type &k)
Add the key to the back of this deque.
Definition: hashtable_deque.hpp:80
void set(const key_type &index, const value_type &newValue) noexcept
Sets the value that corresponds to the specified index.
Definition: multi_clock.hpp:580
void setHead(const value_type newValue)
Set the value of the entry where the clock hand of the specified clock points to. ...
Definition: multi_clock.hpp:113
const T min(const T x, const T y)
Definition: w_minmax.h:52
#define DBG5(a)
Definition: w_debug.h:254
key_type sizeOf() const noexcept
Returns the number of entries in the specified clock.
Definition: multi_clock.hpp:503
A generic RAII guard class.
Definition: guard.h:94
Exception thrown when a key is not already contained in a MultiHandedClock.
Definition: multi_clock_exceptions.hpp:246
void removeHead(key_type &removedIndex)
Remove the head entry from the specified clock.
Definition: multi_clock.hpp:412
bf_idx _handMovement
Clock hand movements in current circulation.
Definition: page_evictioner_other.hpp:336
u_int32_t _c
Parameter .
Definition: page_evictioner_other.hpp:329
bool should_exit() const
Definition: worker_thread.h:63