Skip to content

Commit

Permalink
add interface on watermark
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <iskyzh@gmail.com>
  • Loading branch information
skyzh committed Jan 29, 2024
1 parent 1795647 commit 3cecf09
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mini-lsm-book/src/week3-04-watermark.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## Task 1: Implement Watermark

## Task 2: Garbage Collection in Compaction
## Task 2: Maintain Watermark in Transactions

## Task 3: Garbage Collection in Compaction


{{#include copyright.md}}
6 changes: 5 additions & 1 deletion mini-lsm-book/src/week3-06-serializable.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

## Test Your Understanding

* If you have some experience with building a relational database, you may think about the following question: assume that we build a database based on Mini-LSM where we store each row in the relation table as a key-value pair and enable serializable verification, does the database system directly get ANSI serializable isolation level capability? Why or why not?
* If you have some experience with building a relational database, you may think about the following question: assume that we build a database based on Mini-LSM where we store each row in the relation table as a key-value pair (key: primary key, value: serialized row) and enable serializable verification, does the database system directly gain ANSI serializable isolation level capability? Why or why not?

We do not provide reference answers to the questions, and feel free to discuss about them in the Discord community.

## Bonus Tasks

* **Read-Only Transactions.**

{{#include copyright.md}}
4 changes: 4 additions & 0 deletions mini-lsm-mvcc/src/mvcc/watermark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ impl Watermark {
}
}

pub fn num_retained_snapshots(&self) -> usize {
self.readers.len()
}

pub fn watermark(&self) -> Option<u64> {
self.readers.first_key_value().map(|(ts, _)| *ts)
}
Expand Down

0 comments on commit 3cecf09

Please sign in to comment.