Skip to content

Commit

Permalink
a lot of questions
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <[email protected]>
  • Loading branch information
skyzh committed Jan 20, 2024
1 parent 80797d5 commit 5ab4d2a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mini-lsm-book/src/week1-01-memtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ Now that you have multiple memtables, you may modify your read path `get` functi
* Is it possible to use other data structures as the memtable in LSM? What are the pros/cons of using the skiplist?
* Why do we need a combination of `state` and `state_lock`? Can we only use `state.read()` and `state.write()`?
* Why does the order to store and to probe the memtables matter?
* Is the memory layout of the memtable efficient / does it have good data locality? (Think of how `Byte` is implemented...) What are the possible optimizations to make the memtable more efficient?
* Is the memory layout of the memtable efficient / does it have good data locality? (Think of how `Byte` is implemented and stored in the skiplist...) What are the possible optimizations to make the memtable more efficient?
* So we are using `parking_lot` locks in this tutorial. Is its read-write lock a fair lock? What might happen to the readers trying to acquire the lock if there is one writer waiting for existing readers to stop?
* After freezing the memtable, is it possible that some threads still hold the old LSM state and wrote into these immutable memtables? How does your solution prevent it from happening?
* There are several places that you might first acquire a read lock on state, then drop it and acquire a write lock (these two operations might be in different functions but they happened sequentially due to one function calls the other). How does it differ from directly upgrading the read lock to a write lock? Is it necessary to upgrade instead of acquiring and dropping and what is the cost of doing the upgrade?

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

Expand Down
7 changes: 7 additions & 0 deletions mini-lsm-book/src/week1-03-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@ In this chapter, you will:

## Task 2: Block Iterator

## Test Your Understanding

* So `Block` is simply a vector of raw data and a vector of offsets. Can we change them to `Byte` and `Arc<[u16]>`, and change all the iterator interfaces to return `Byte` instead of `&[u8]`? What are the pros/cons?
* What is the endian of the numbers written into the blocks in your implementation?
* Is your implementation prune to a maliciously-built block? Will there be invalid memory access, or OOMs, if a user deliberately construct an invalid block?
* Do you love bubble tea? Why or why not?

{{#include copyright.md}}
6 changes: 5 additions & 1 deletion mini-lsm-book/src/week1-04-sst.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ In this chapter, you will:

## Task 3: Block Cache

## Test Your Understanding

* An SST is usually large (i.e., 256MB). In this case, the cost of copying/expanding the `Vec` would be significant. Does your implementation allocate enough space for your SST builder in advance? How did you implement it?
* Looking at the `moka` block cache, why does it return `Arc<Error>` instead of the original `Error`?

{{#include copyright.md}}
``
4 changes: 4 additions & 0 deletions mini-lsm-book/src/week2-02-simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ In this chapter, you will:
* Implement a simple leveled compaction strategy and simulate it on the compaction simulator.
* Start compaction as a background task and implement a compaction trigger in the system.

## Test Your Understanding

* What is your favorite boba shop in your city? (If you answered yes in week 1 day 3...)

{{#include copyright.md}}

0 comments on commit 5ab4d2a

Please sign in to comment.