Skip to content

Commit

Permalink
Merge pull request #241 from MattHalpinParity/propagate_errors
Browse files Browse the repository at this point in the history
Propagate errors
  • Loading branch information
MattHalpinParity authored Jul 29, 2024
2 parents 2b6820e + cd3b0ff commit a54e6cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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

0 comments on commit a54e6cf

Please sign in to comment.