add interface on watermark

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2024-01-29 21:19:18 +08:00
parent 1795647bad
commit 3cecf09d59
3 changed files with 12 additions and 2 deletions

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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)
}