Skip to content

Commit

Permalink
Merge pull request #8376 from dantengsky/fix-concurrenty-gc
Browse files Browse the repository at this point in the history
fix: should ignore `StorageNotFound` errors in concurrent GC
  • Loading branch information
dantengsky authored Oct 21, 2022
2 parents f5bb626 + fcfbdea commit 8970988
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/query/storages/fuse/src/io/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl SnapshotsIO {
let results = self.read_snapshots(chunks).await?;
info!("Finish to read_snapshots, chunk:[{}]", idx);

for snapshot in results.into_iter().collect::<Result<Vec<_>>>()? {
for snapshot in results.into_iter().flatten() {
if snapshot.timestamp > min_snapshot_timestamp {
continue;
}
Expand Down
17 changes: 15 additions & 2 deletions src/query/storages/fuse/src/operations/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,21 @@ impl FuseTable {

let mut blocks_need_to_delete = HashSet::new();
let mut blooms_need_to_delete = HashSet::new();
for segment in segments {
let segment = segment?;

for segment_opt in segments {
let segment = match segment_opt {
Ok(v) => v,
Err(e) => {
if e.code() == ErrorCode::storage_not_found_code() {
warn! {
"concurrent gc detected, segment has been removed "
};
continue;
} else {
return Err(e);
}
}
};

for block_meta in &segment.blocks {
let loc = block_meta.location.0.as_str();
Expand Down

1 comment on commit 8970988

@vercel
Copy link

@vercel vercel bot commented on 8970988 Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend-databend.vercel.app
databend.vercel.app
databend.rs
databend-git-main-databend.vercel.app

Please sign in to comment.