Skip to content

Commit

Permalink
fix: don't raise an error when manifest directory is not created (Gre…
Browse files Browse the repository at this point in the history
…ptimeTeam#2308)

* fix: don't raise an error when manifest directory is not created

* chore: apply suggestion

Co-authored-by: Lei, HUANG <[email protected]>

---------

Co-authored-by: Lei, HUANG <[email protected]>
  • Loading branch information
2 people authored and paomian committed Oct 19, 2023
1 parent 67f97bf commit 9640581
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/mito2/src/manifest/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,20 @@ impl ManifestObjectStore {

/// Return all `R`s in the root directory that meet the `filter` conditions (that is, the `filter` closure returns `Some(R)`),
/// and discard `R` that does not meet the conditions (that is, the `filter` closure returns `None`)
/// Return an empty vector when directory is not found.
pub async fn get_paths<F, R>(&self, filter: F) -> Result<Vec<R>>
where
F: Fn(Entry) -> Option<R>,
{
let streamer = self
.object_store
.list(&self.path)
.await
.context(OpenDalSnafu)?;
let streamer = match self.object_store.list(&self.path).await {
Ok(streamer) => streamer,
Err(e) if e.kind() == ErrorKind::NotFound => {
debug!("Manifest directory does not exists: {}", self.path);
return Ok(vec![]);
}
Err(e) => Err(e).context(OpenDalSnafu)?,
};

streamer
.try_filter_map(|e| async { Ok(filter(e)) })
.try_collect::<Vec<_>>()
Expand Down

0 comments on commit 9640581

Please sign in to comment.