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

Propagate errors #241

Merged
merged 3 commits into from
Jul 29, 2024
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: 0 additions & 2 deletions admin/src/bench/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ pub struct Args {
pub append: bool,
pub no_check: bool,
pub compress: bool,
pub ordered: bool,
pub uniform: bool,
pub writer_commits_per_sleep: u64,
pub writer_sleep_time: u64,
Expand All @@ -125,7 +124,6 @@ impl Stress {
archive: self.archive,
no_check: self.no_check,
compress: self.compress,
ordered: self.ordered,
uniform: self.uniform,
writer_commits_per_sleep: self.writer_commits_per_sleep.unwrap_or(100),
writer_sleep_time: self.writer_sleep_time.unwrap_or(0),
Expand Down
2 changes: 1 addition & 1 deletion src/btree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl BTreeTable {
return Ok(None)
}
let record_id = 0; // lifetime of Btree is the query, so no invalidate.
// keeping log locked when parsing tree.
// keeping log locked when parsing tree.
let tree = BTree::new(Some(btree_header.root), btree_header.depth, record_id);
tree.get(key, values, log)
}
Expand Down
11 changes: 7 additions & 4 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn madvise_random(_map: &mut memmap2::MmapMut) {}
fn mmap(file: &std::fs::File, len: usize) -> Result<memmap2::MmapMut> {
#[cfg(not(test))]
const RESERVE_ADDRESS_SPACE: usize = 1024 * 1024 * 1024; // 1 Gb
// Use a different value for tests to work around docker limits on the test machine.
// Use a different value for tests to work around docker limits on the test machine.
#[cfg(test)]
const RESERVE_ADDRESS_SPACE: usize = 64 * 1024 * 1024; // 64 Mb

Expand Down Expand Up @@ -96,7 +96,12 @@ pub struct TableFile {
impl TableFile {
pub fn open(filepath: std::path::PathBuf, entry_size: u16, id: TableId) -> Result<Self> {
let mut capacity = 0u64;
let map = if std::fs::metadata(&filepath).is_ok() {
let map = if let Err(error) = std::fs::metadata(&filepath) {
match error.kind() {
std::io::ErrorKind::NotFound => None,
_ => return try_io!(Err(error)),
}
} else {
let file = try_io!(std::fs::OpenOptions::new()
.read(true)
.write(true)
Expand All @@ -113,8 +118,6 @@ impl TableFile {
}
let map = mmap(&file, len as usize)?;
Some((map, file))
} else {
None
};
Ok(TableFile {
path: filepath,
Expand Down
Loading