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

make aol read write path independent of common locks #179

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cli/src/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Analyzer {
.with_file_extension("clog".to_string());

// Open the commit log
let mut destination_commit_log =
let destination_commit_log =
Aol::open(&destination_clog_subdir, &copts).map_err(Error::from)?;

// Write latest versions to new location
Expand Down
16 changes: 8 additions & 8 deletions src/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Store {
let oracle_lock = oracle.write_lock.lock();

// Rotate the commit log and get the new segment ID
let mut clog = self.core.clog.as_ref().unwrap().write();
let clog = self.core.clog.as_ref().unwrap().write();
let new_segment_id = clog.rotate()?;
let last_updated_segment_id = new_segment_id - 1;
drop(clog); // Explicitly drop the lock
Expand All @@ -75,7 +75,7 @@ impl Store {
fs::create_dir_all(&tmp_merge_dir)?;

// Initialize a new manifest in the temporary directory
let mut manifest = Core::initialize_manifest(&tmp_merge_dir)?;
let manifest = Core::initialize_manifest(&tmp_merge_dir)?;
// Add the last updated segment ID to the manifest
let changeset = Manifest::with_compacted_up_to_segment(last_updated_segment_id);
manifest.append(&changeset.serialize()?)?;
Expand All @@ -86,7 +86,7 @@ impl Store {
let tm_opts = LogOptions::default()
.with_max_file_size(self.core.opts.max_compaction_segment_size)
.with_file_extension("clog".to_string());
let mut temp_writer = Aol::open(&temp_clog_dir, &tm_opts)?;
let temp_writer = Aol::open(&temp_clog_dir, &tm_opts)?;

// TODO: Check later to add a new way for compaction by reading from the files first and then
// check in files for the keys that are not found in memory to handle deletion
Expand All @@ -101,11 +101,11 @@ impl Store {
// Do compaction and write

// Define a closure for writing entries to the temporary commit log
let mut write_entry = |key: &[u8],
value: Vec<u8>,
version: u64,
ts: u64,
metadata: Option<Metadata>|
let write_entry = |key: &[u8],
value: Vec<u8>,
version: u64,
ts: u64,
metadata: Option<Metadata>|
-> Result<()> {
let mut entry = Entry::new(key, &value);
entry.set_ts(ts);
Expand Down
Loading
Loading