Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Mar 27, 2023
1 parent 57934bd commit 58265f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:

benchmark:
name: benchmark
needs: [ gcc-build-test, clang-build-test ]
needs: [gcc-build-test, clang-build-test]
runs-on: kuzu-self-hosted-benchmarking
steps:
- uses: actions/checkout@v3
Expand Down
25 changes: 14 additions & 11 deletions src/include/storage/buffer_manager/buffer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ class logger;
namespace kuzu {
namespace storage {

// This class keeps state info for pages potentially can be evicted. Candidates are organized in the
// evictionQueue.
// The page state of a candidate is set to MARKED when it is first enqueued. After enqueued, if the
// candidate was recently accessed, it is no longer immediately evictable.
// Possible actions are:
// 1) When the page was pinned and unpinned, the page state is set to UNLOCKED, and its version had
// been incremented. Remove the candidate from the queue.
// 2) When the page was optimistically read, the page state is also set to UNLOCKED. We call this
// candidate second chance evictable. Set the candidate to MARKED, and put it back to the end of the
// queue, so it can be evicted later.
// 3) When the page was pinned, but not unpinned yet, the page state is set to LOCKED. Remove the
// candidate from the queue.
struct EvictionCandidate {
// If the candidate was recently accessed, it is no longer evictable.
// The page state of a candidate is set to MARKED when it is first enqueued.
// Possible actions to the page, which makes it un-evictable:
// 1) When the page was pinned and unpinned, the page state is set to UNLOCKED, and its version
// had been incremented. Remove the candidate from the queue.
// 2) When the page was optimistically read, the page state is also set to UNLOCKED. We call
// this candidate second chance evictable. Set the candidate to MARKED, and put it back to the
// end of the queue, so it can be evicted later.
// 3) When the page was pinned, but not unpinned yet, the page state is set to LOCKED. Remove
// the candidate from the queue. Thus, if the page state is not MARKED, or the page version is
// not the same as the one kept inside the candidate, the candidate is no longer evictable.
// If the candidate is Marked and its version is the same as the one kept inside the candidate,
// it is evictable.
inline bool isEvictable(uint64_t currPageStateAndVersion) const {
return PageState::getState(currPageStateAndVersion) == PageState::MARKED &&
PageState::getVersion(currPageStateAndVersion) == pageVersion;
Expand Down

0 comments on commit 58265f9

Please sign in to comment.