implement mvcc compaction + snapshot
Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use tempfile::tempdir;
|
||||
|
||||
use crate::{
|
||||
@@ -51,8 +53,9 @@ fn test_task1_memtable_overwrite() {
|
||||
#[test]
|
||||
fn test_task2_storage_integration() {
|
||||
let dir = tempdir().unwrap();
|
||||
let storage =
|
||||
LsmStorageInner::open(dir.path(), LsmStorageOptions::default_for_week1_test()).unwrap();
|
||||
let storage = Arc::new(
|
||||
LsmStorageInner::open(dir.path(), LsmStorageOptions::default_for_week1_test()).unwrap(),
|
||||
);
|
||||
assert_eq!(&storage.get(b"0").unwrap(), &None);
|
||||
storage.put(b"1", b"233").unwrap();
|
||||
storage.put(b"2", b"2333").unwrap();
|
||||
@@ -99,7 +102,7 @@ fn test_task3_freeze_on_capacity() {
|
||||
let mut options = LsmStorageOptions::default_for_week1_test();
|
||||
options.target_sst_size = 1024;
|
||||
options.num_memtable_limit = 1000;
|
||||
let storage = LsmStorageInner::open(dir.path(), options).unwrap();
|
||||
let storage = Arc::new(LsmStorageInner::open(dir.path(), options).unwrap());
|
||||
for _ in 0..1000 {
|
||||
storage.put(b"1", b"2333").unwrap();
|
||||
}
|
||||
@@ -117,8 +120,9 @@ fn test_task3_freeze_on_capacity() {
|
||||
#[test]
|
||||
fn test_task4_storage_integration() {
|
||||
let dir = tempdir().unwrap();
|
||||
let storage =
|
||||
LsmStorageInner::open(dir.path(), LsmStorageOptions::default_for_week1_test()).unwrap();
|
||||
let storage = Arc::new(
|
||||
LsmStorageInner::open(dir.path(), LsmStorageOptions::default_for_week1_test()).unwrap(),
|
||||
);
|
||||
assert_eq!(&storage.get(b"0").unwrap(), &None);
|
||||
storage.put(b"1", b"233").unwrap();
|
||||
storage.put(b"2", b"2333").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user