Skip to content
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
8 changes: 4 additions & 4 deletions crates/commitlog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl<T> Commitlog<T> {
/// free-standing functions in this module for how to traverse a read-only
/// commitlog.
pub fn open(root: CommitLogDir, opts: Options) -> io::Result<Self> {
let inner = commitlog::Generic::open(repo::Fs::new(root), opts)?;
let inner = commitlog::Generic::open(repo::Fs::new(root)?, opts)?;

Ok(Self {
inner: RwLock::new(inner),
Expand Down Expand Up @@ -444,7 +444,7 @@ pub fn commits_from(
root: CommitLogDir,
offset: u64,
) -> io::Result<impl Iterator<Item = Result<StoredCommit, error::Traversal>>> {
commitlog::commits_from(repo::Fs::new(root), DEFAULT_LOG_FORMAT_VERSION, offset)
commitlog::commits_from(repo::Fs::new(root)?, DEFAULT_LOG_FORMAT_VERSION, offset)
}

/// Obtain an iterator which traverses the commitlog located at the `root`
Expand Down Expand Up @@ -479,7 +479,7 @@ where
D::Error: From<error::Traversal>,
T: 'a,
{
commitlog::transactions_from(repo::Fs::new(root), DEFAULT_LOG_FORMAT_VERSION, offset, de)
commitlog::transactions_from(repo::Fs::new(root)?, DEFAULT_LOG_FORMAT_VERSION, offset, de)
}

/// Traverse the commitlog located at the `root` directory from the start and
Expand All @@ -505,5 +505,5 @@ where
D: Decoder,
D::Error: From<error::Traversal> + From<io::Error>,
{
commitlog::fold_transactions_from(repo::Fs::new(root), DEFAULT_LOG_FORMAT_VERSION, offset, de)
commitlog::fold_transactions_from(repo::Fs::new(root)?, DEFAULT_LOG_FORMAT_VERSION, offset, de)
}
5 changes: 3 additions & 2 deletions crates/commitlog/src/repo/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ impl Fs {
/// Create a commitlog repository which stores segments in the directory `root`.
///
/// `root` must name an extant, accessible, writeable directory.
pub fn new(root: CommitLogDir) -> Self {
Self { root }
pub fn new(root: CommitLogDir) -> io::Result<Self> {
root.create()?;
Ok(Self { root })
}

/// Get the filename for a segment starting with `offset` within this
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/db/relational_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,6 @@ pub type LocalDurability = Arc<durability::Local<ProductValue>>;
/// Note that this operation can be expensive, as it needs to traverse a suffix
/// of the commitlog.
pub async fn local_durability(commitlog_dir: CommitLogDir) -> io::Result<(LocalDurability, DiskSizeFn)> {
tokio::fs::create_dir_all(&commitlog_dir).await?;
let rt = tokio::runtime::Handle::current();
// TODO: Should this better be spawn_blocking?
let local = spawn_rayon(move || {
Expand Down
Loading