Skip to content

Commit

Permalink
Fix regression in chunk deletion for openstack provider (#703)
Browse files Browse the repository at this point in the history
* Fix bug in chunk deletion for openstack

* Remove backward compatibility tests for GC, other minor fixes in snapshotter_test.go

* Fix unit tests

* Address review comments from @ishan16696

* Address review comments from @anveshreddy18
  • Loading branch information
shreyas-s-rao authored Jan 9, 2024
1 parent dd859a1 commit 727e957
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 250 deletions.
21 changes: 17 additions & 4 deletions pkg/snapshot/snapshotter/garbagecollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,23 @@ func (ssr *Snapshotter) RunGarbageCollector(stopCh <-chan struct{}) {
continue
}

// chunksDeleted stores the no of chunks deleted in the current iteration of GC
var chunksDeleted int
chunksDeleted, snapList = ssr.GarbageCollectChunks(snapList)
ssr.logger.Infof("GC: Total number garbage collected chunks: %d", chunksDeleted)
// Skip chunk deletion for openstack swift provider, since the manifest object is a virtual
// representation of the object, and the actual data is stored in the segment objects, aka chunks
// Chunk deletion for this provider is handled in regular snapshot deletion
if ssr.snapstoreConfig.Provider == brtypes.SnapstoreProviderSwift {
var filteredSnapList brtypes.SnapList
for _, snap := range snapList {
if !snap.IsChunk {
filteredSnapList = append(filteredSnapList, snap)
}
}
snapList = filteredSnapList
} else {
// chunksDeleted stores the no of chunks deleted in the current iteration of GC.
var chunksDeleted int
chunksDeleted, snapList = ssr.GarbageCollectChunks(snapList)
ssr.logger.Infof("GC: Total number garbage collected chunks: %d", chunksDeleted)
}

snapStreamIndexList := getSnapStreamIndexList(snapList)

Expand Down
Loading

0 comments on commit 727e957

Please sign in to comment.