Skip to content

Commit

Permalink
evict (job) to cleanup defunct objects
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Nov 8, 2024
1 parent 6592a2e commit bdf670e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions ais/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,13 @@ func (t *target) delobj(lom *core.LOM, evict bool) (int, error, bool) {
err := lom.Load(false /*cache it*/, true /*locked*/)
if err != nil {
if !cos.IsNotExist(err, 0) {
if cmn.IsErrObjNought(err) {
// cleanup in place
if errNested := lom.RemoveMain(); errNested != nil {
nlog.Errorln(t.String(), "failed to cleanup in place", errNested)
}
return http.StatusNotFound, nil, false
}
return 0, err, false
}
if !delFromBackend {
Expand Down
8 changes: 2 additions & 6 deletions core/lfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ func (*LOM) AppendWork(wfqn string) (fh cos.LomWriter, err error) {
// remove
//

func (lom *LOM) RemoveMain() (err error) {
err = cos.RemoveFile(lom.FQN)
if os.IsNotExist(err) {
err = nil
}
return err
func (lom *LOM) RemoveMain() error {
return cos.RemoveFile(lom.FQN)
}

func (lom *LOM) RemoveObj(force ...bool) (err error) {
Expand Down

0 comments on commit bdf670e

Please sign in to comment.