From 96405819aa3de3ae1dba50d60befb6298ad52bd5 Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Sun, 3 Sep 2023 01:53:43 -0500 Subject: [PATCH] fix: don't raise an error when manifest directory is not created (#2308) * fix: don't raise an error when manifest directory is not created * chore: apply suggestion Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com> --------- Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com> --- src/mito2/src/manifest/storage.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mito2/src/manifest/storage.rs b/src/mito2/src/manifest/storage.rs index b136faac3862..483ec6e1cac9 100644 --- a/src/mito2/src/manifest/storage.rs +++ b/src/mito2/src/manifest/storage.rs @@ -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(&self, filter: F) -> Result> where F: Fn(Entry) -> Option, { - 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::>()