xl/fs: Bring in ".minio/tmp" directory support. (#1464)

All transactions happen through this directory inside ".minio/temp".
Adding this allows us to remove any temporary files which were not
committed before.

Fixes #1462
Fixes #1444
This commit is contained in:
Harshavardhana
2016-05-03 16:10:24 -07:00
committed by Anand Babu (AB) Periasamy
parent 6f1811ee4d
commit d0e854afb7
7 changed files with 497 additions and 697 deletions

View File

@@ -741,7 +741,7 @@ func (s fsStorage) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) err
log.WithFields(logrus.Fields{
"diskPath": s.diskPath,
"volume": srcVolume,
}).Debugf("getVolumeDir failed with %s", err)
}).Errorf("getVolumeDir failed with %s", err)
return err
}
dstVolumeDir, err := s.getVolumeDir(dstVolume)
@@ -749,12 +749,20 @@ func (s fsStorage) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) err
log.WithFields(logrus.Fields{
"diskPath": s.diskPath,
"volume": dstVolume,
}).Debugf("getVolumeDir failed with %s", err)
}).Errorf("getVolumeDir failed with %s", err)
return err
}
if err = os.MkdirAll(path.Join(dstVolumeDir, path.Dir(dstPath)), 0755); err != nil {
log.Debug("os.MkdirAll failed with %s", err)
log.Errorf("os.MkdirAll failed with %s", err)
return err
}
return os.Rename(path.Join(srcVolumeDir, srcPath), path.Join(dstVolumeDir, dstPath))
err = os.Rename(path.Join(srcVolumeDir, srcPath), path.Join(dstVolumeDir, dstPath))
if err != nil {
if os.IsNotExist(err) {
return errFileNotFound
}
log.Errorf("os.Rename failed with %s", err)
return err
}
return nil
}