Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in clean prefix detection #761

Merged
merged 1 commit into from
Feb 20, 2025
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
4 changes: 0 additions & 4 deletions icechunk/src/storage/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ impl Storage for LoggingStorage {
self.backend.get_snapshot_last_modified(settings, snapshot).await
}

async fn root_is_clean(&self) -> StorageResult<bool> {
self.backend.root_is_clean().await
}

async fn get_object_range_buf(
&self,
key: &str,
Expand Down
4 changes: 3 additions & 1 deletion icechunk/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ pub trait Storage: fmt::Debug + private::Sealed + Sync + Send {
snapshot: &SnapshotId,
) -> StorageResult<DateTime<Utc>>;

async fn root_is_clean(&self) -> StorageResult<bool>;
async fn root_is_clean(&self) -> StorageResult<bool> {
Ok(self.list_objects(&Settings::default(), "").await?.next().await.is_none())
}

async fn list_chunks(
&self,
Expand Down
11 changes: 0 additions & 11 deletions icechunk/src/storage/object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,17 +583,6 @@ impl Storage for ObjectStorage {
Ok(res.last_modified)
}

#[instrument(skip(self))]
async fn root_is_clean(&self) -> StorageResult<bool> {
Ok(self
.get_client()
.await
.list(Some(&ObjectPath::from(self.backend.prefix())))
.next()
.await
.is_none())
}

#[instrument(skip(self))]
async fn get_object_range_buf(
&self,
Expand Down
14 changes: 0 additions & 14 deletions icechunk/src/storage/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,20 +639,6 @@ impl Storage for S3Storage {
Ok(res)
}

#[instrument(skip(self))]
async fn root_is_clean(&self) -> StorageResult<bool> {
let res = self
.get_client()
.await
.list_objects_v2()
.bucket(self.bucket.clone())
.prefix(self.prefix.clone())
.max_keys(1)
.send()
.await?;
Ok(res.contents.map(|v| v.is_empty()).unwrap_or(true))
}

#[instrument(skip(self))]
async fn get_object_range_buf(
&self,
Expand Down