Skip to content

Commit

Permalink
fix(ci): recreate segments folder if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed May 17, 2024
1 parent 24dffbe commit c076c5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "lsm-tree"
description = "A K.I.S.S. implementation of log-structured merge trees (LSM-trees/LSMTs)"
license = "MIT OR Apache-2.0"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
rust-version = "1.74.0"
readme = "README.md"
Expand Down
10 changes: 9 additions & 1 deletion src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{
compaction::CompactionStrategy,
config::{Config, PersistedConfig},
descriptor_table::FileDescriptorTable,
file::fsync_directory,
levels::LevelManifest,
memtable::MemTable,
range::{MemtableLockGuard, TreeIter},
Expand Down Expand Up @@ -938,7 +939,14 @@ impl Tree {

let mut segments = vec![];

for dirent in std::fs::read_dir(tree_path.join(SEGMENTS_FOLDER))? {
let segment_base_folder = tree_path.join(SEGMENTS_FOLDER);

if !segment_base_folder.try_exists()? {
std::fs::create_dir_all(&segment_base_folder)?;
fsync_directory(&segment_base_folder)?;
}

for dirent in std::fs::read_dir(&segment_base_folder)? {
let dirent = dirent?;

let file_name = dirent.file_name();
Expand Down

0 comments on commit c076c5d

Please sign in to comment.