Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce background gc into SwonDisk #41

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8c88e1e
feat: define ChunkAllocTable for GC
Fischer0522 Sep 6, 2024
1d9076d
feat: implement GcWorker draft
Fischer0522 Sep 8, 2024
04ba0ed
refactor: refactor victim policy
Fischer0522 Sep 9, 2024
599d9fb
refactor: AllocTable and ChunkInfo share the same BitMap
Fischer0522 Sep 13, 2024
e98794e
chore: add ut
Fischer0522 Sep 13, 2024
3f0c29d
feat: implement index remapping
Fischer0522 Sep 15, 2024
554857e
feat: implemented stop-the-world GcWorker integrated with compaction …
Fischer0522 Sep 17, 2024
731836c
chore: remove logger
Fischer0522 Sep 17, 2024
821e393
chore: add some comment
Fischer0522 Sep 18, 2024
9b246e1
feat: implemented batch migration
Fischer0522 Sep 19, 2024
824393d
chore: fix ut
Fischer0522 Sep 19, 2024
549a257
feat: avoid double deallocation in compaction
Fischer0522 Sep 20, 2024
16bc7c0
chore: rename chunk to segment
Fischer0522 Sep 23, 2024
a2e47a7
feat: use tx to migrate data
Fischer0522 Sep 23, 2024
f5252f0
refactor: use tx to migrate data and update meta
Fischer0522 Sep 24, 2024
6f8e129
fix: record lba in dealloc_table to avoid double free
Fischer0522 Sep 24, 2024
be0ed86
feat: persist segment table in tx_log
Fischer0522 Sep 26, 2024
d0c9319
fix: align_up seg_buf
Fischer0522 Sep 26, 2024
21928c8
feat: support column_family for TxLsmTree
Fischer0522 Oct 2, 2024
93b3741
chore: add ut
Fischer0522 Oct 2, 2024
4b1b42f
feat: recover column_family from wal
Fischer0522 Oct 5, 2024
38defea
refactor: defined ColumnFamilyManager to manage memtable,sst and comp…
Fischer0522 Oct 6, 2024
4257503
feat: supported cross plantform sleep
Fischer0522 Oct 8, 2024
ce14728
fix: init log_id
Fischer0522 Oct 8, 2024
bad7271
chore: add ReserseKey
Fischer0522 Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ doctest = false

[dev-dependencies]
libc = "=0.2.147"
env_logger = "0.11.5"

[[bench]]
name = "bench"
Expand Down
12 changes: 11 additions & 1 deletion core/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::sync::Arc;
use std::time::Instant;

fn main() {
util::init_logger();
let total_bytes = 512 * MiB;
// Specify all benchmarks
let benches = vec![
Expand Down Expand Up @@ -79,7 +80,7 @@ fn run_benches(benches: Vec<Box<dyn Bench>>) {
let mut failed_count = 0;
for b in benches {
print!("bench {} ... ", &b);
b.prepare();
let _ = b.prepare();

let start = Instant::now();
let res = b.run();
Expand Down Expand Up @@ -250,6 +251,8 @@ mod benches {
),
AeadKey::default(),
None,
true,
None,
)?),

DiskType::EncDisk => Arc::new(EncDisk::create(
Expand Down Expand Up @@ -664,6 +667,13 @@ mod util {
use std::fmt::{self};
use std::time::Duration;

pub fn init_logger() {
env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.try_init()
.unwrap();
}

/// Display the amount of data in the unit of GiB, MiB, KiB, or bytes.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct DisplayData(usize);
Expand Down
5 changes: 3 additions & 2 deletions core/src/layers/4-lsm/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use super::mem_table::ValueEx;
use super::sstable::SSTable;
use super::tx_lsm_tree::SSTABLE_CAPACITY;
use super::{LsmLevel, RecordKey, RecordValue, SyncId, TxEventListener};
use super::{ColumnFamily, LsmLevel, RecordKey, RecordValue, SyncId, TxEventListener};
use crate::layers::bio::BlockSet;
use crate::layers::log::TxLogStore;
use crate::os::{JoinHandle, Mutex};
Expand Down Expand Up @@ -54,6 +54,7 @@ impl<K: RecordKey<K>, V: RecordValue> Compactor<K, V> {
event_listener: &Arc<dyn TxEventListener<K, V>>,
to_level: LsmLevel,
sync_id: SyncId,
column_family: Option<ColumnFamily>,
) -> Result<Vec<SSTable<K, V>>> {
let mut created_ssts = Vec::new();
let mut upper_iter = upper_records.peekable();
Expand Down Expand Up @@ -93,7 +94,7 @@ impl<K: RecordKey<K>, V: RecordValue> Compactor<K, V> {
break;
}

let new_log = tx_log_store.create_log(to_level.bucket())?;
let new_log = tx_log_store.create_log(to_level.bucket(column_family))?;
let new_sst = SSTable::build(records_iter, sync_id, &new_log, None)?;

created_ssts.push(new_sst);
Expand Down
2 changes: 1 addition & 1 deletion core/src/layers/4-lsm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ mod wal;

pub use self::range_query_ctx::RangeQueryCtx;
pub use self::tx_lsm_tree::{
AsKV, LsmLevel, RecordKey, RecordValue, SyncId, SyncIdStore, TxEventListener,
AsKV, ColumnFamily, LsmLevel, RecordKey, RecordValue, SyncId, SyncIdStore, TxEventListener,
TxEventListenerFactory, TxLsmTree, TxType,
};
Loading
Loading