Skip to content

Commit 103cabe

Browse files
committed
fix(cubestore): Create table failed: Internal: Directory not empty (os error 39) for local dir storage
1 parent 15badfe commit 103cabe

File tree

1 file changed

+13
-2
lines changed
  • rust/cubestore/cubestore/src/remotefs

1 file changed

+13
-2
lines changed

rust/cubestore/cubestore/src/remotefs/mod.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,19 @@ impl LocalDirRemoteFs {
326326
pub async fn remove_empty_paths(root: PathBuf, path: PathBuf) -> Result<(), CubeError> {
327327
if let Some(parent_path) = path.parent() {
328328
let mut dir = fs::read_dir(parent_path).await?;
329-
if !parent_path.starts_with("temp-uploads") && dir.next_entry().await?.is_none() {
330-
fs::remove_dir(parent_path).await?;
329+
if !parent_path
330+
.as_os_str()
331+
.to_string_lossy()
332+
.contains("temp-uploads")
333+
&& dir.next_entry().await?.is_none()
334+
{
335+
fs::remove_dir(parent_path).await.map_err(|e| {
336+
CubeError::internal(format!(
337+
"Error during removal of empty path '{}': {}",
338+
parent_path.as_os_str().to_string_lossy(),
339+
e
340+
))
341+
})?;
331342
}
332343
if root != parent_path.to_path_buf() {
333344
return Ok(Self::remove_empty_paths_boxed(root, parent_path.to_path_buf()).await?);

0 commit comments

Comments
 (0)