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

Removes skip_check_lock option #136

Merged
merged 1 commit into from
Sep 29, 2022
Merged
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
21 changes: 5 additions & 16 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ impl DbInner {
.read(true)
.write(true)
.open(lock_path.as_path()));
if !inner_options.skip_check_lock {
lock_file.try_lock_exclusive().map_err(Error::Locked)?;
}
lock_file.try_lock_exclusive().map_err(Error::Locked)?;

let metadata = options.load_and_validate_metadata(inner_options.create)?;
let mut columns = Vec::with_capacity(metadata.columns.len());
Expand Down Expand Up @@ -1341,7 +1339,6 @@ struct InternalOptions {
create: bool,
read_only: bool,
commit_stages: EnableCommitPipelineStages,
skip_check_lock: bool,
}

// This is used in tests to disable certain commit stages.
Expand Down Expand Up @@ -1563,12 +1560,8 @@ mod tests {
std::thread::sleep(std::time::Duration::from_millis(100));

let db_test = EnableCommitPipelineStages::CommitOverlay;
let inner_options = InternalOptions {
create: false,
commit_stages: db_test,
skip_check_lock: true,
..Default::default()
};
let inner_options =
InternalOptions { create: false, commit_stages: db_test, ..Default::default() };
let db = Db::open_inner(&options, &inner_options).unwrap();
assert_eq!(db.get(col_nb, key1.as_slice()).unwrap(), Some(b"value1".to_vec()));
assert_eq!(db.get(col_nb, key2.as_slice()).unwrap(), Some(b"value2".to_vec()));
Expand Down Expand Up @@ -1706,12 +1699,8 @@ mod tests {
// issue with some file reopening when no delay
std::thread::sleep(std::time::Duration::from_millis(100));

let inner_options = InternalOptions {
create: false,
commit_stages: db_test,
skip_check_lock: true,
..Default::default()
};
let inner_options =
InternalOptions { create: false, commit_stages: db_test, ..Default::default() };
let db = Db::open_inner(&options, &inner_options).unwrap();

let mut iter = db.iter(col_nb).unwrap();
Expand Down