Skip to content
Open
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
14 changes: 7 additions & 7 deletions frac/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ func (f *Remote) IsIntersecting(from, to seq.MID) bool {
}

func (f *Remote) Suicide() {
// FIXME(dkharms): We need to rename `.remote` file to `._remote` to commit deletion intent.
// Now, we might have fraction leaks in S3 storage since [Suicide] is not atomic.
util.MustRemoveFileByPath(f.BaseFileName + consts.RemoteFractionSuffix)

f.docsCache.Release()
f.indexCache.Release()

files := []string{
filepath.Base(f.BaseFileName) + consts.DocsFileSuffix,
filepath.Base(f.BaseFileName) + consts.SdocsFileSuffix,
Expand All @@ -246,6 +239,13 @@ func (f *Remote) Suicide() {
}

f.skipMaskProvider.RemoveFrac(f.info.Name())

// FIXME(dkharms): We need to rename `.remote` file to `._remote` to commit deletion intent.
// Now, we might have fraction leaks in S3 storage since [Suicide] is not atomic.
util.MustRemoveFileByPath(f.BaseFileName + consts.RemoteFractionSuffix)

f.docsCache.Release()
f.indexCache.Release()
}

func (f *Remote) String() string {
Expand Down
19 changes: 17 additions & 2 deletions fracmanager/lifecycle_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,18 @@ func (lc *lifecycleManager) offloadLocal(ctx context.Context, sizeLimit uint64,

if remote == nil {
lc.infoCache.Remove(frac.Info().Name())
} else {
logger.Info("offload local fraction",
zap.String("name", remote.Info().Name()),
zap.Time("created", time.UnixMilli(int64(remote.Info().CreationTime))))
}

// free up local resources
frac.Destroy()
maintenanceTruncateTotal.Add(1)
logger.Info("remove local fraction",
zap.String("name", frac.Info().Name()),
zap.Time("created", time.UnixMilli(int64(frac.Info().CreationTime))))
})
if err != nil {
panic(err) // we do not expect error here
Expand Down Expand Up @@ -186,8 +193,12 @@ func (lc *lifecycleManager) cleanRemote(retention time.Duration, wg *sync.WaitGr
for _, remote := range toDelete {
go func() {
defer wg.Done()
lc.infoCache.Remove(remote.Info().Name())
info := remote.Info()
lc.infoCache.Remove(info.Name())
remote.Destroy()
logger.Info("remove remote fraction",
zap.String("name", info.Name()),
zap.Time("created", time.UnixMilli(int64(info.CreationTime))))
}()
}
}
Expand All @@ -209,9 +220,13 @@ func (lc *lifecycleManager) cleanLocal(sizeLimit uint64, wg *sync.WaitGroup) {
for _, frac := range toDelete {
go func() {
defer wg.Done()
lc.infoCache.Remove(frac.Info().Name())
info := frac.Info()
lc.infoCache.Remove(info.Name())
frac.Destroy()
maintenanceTruncateTotal.Add(1)
logger.Info("remove local fraction",
zap.String("name", info.Name()),
zap.Time("created", time.UnixMilli(int64(info.CreationTime))))
}()
}
}
Expand Down
Loading