mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
speed up startup sequence for all operations (#14148)
This speed-up is intended for faster startup times for almost all MinIO operations. Changes here are - Drives are not re-read for 'format.json' on a regular basis once read during init is remembered and refreshed at 5 second intervals. - Do not do O_DIRECT tests on drives with existing 'format.json' only fresh setups need this check. - Parallelize initializing erasureSets for multiple sets. - Avoid re-reading format.json when migrating 'format.json' from really old V1->V2->V3 - Keep a copy of local drives for any given server in memory for a quick lookup.
This commit is contained in:
@@ -238,10 +238,7 @@ func SameFile(fi1, fi2 os.FileInfo) bool {
|
||||
if fi1.Mode() != fi2.Mode() {
|
||||
return false
|
||||
}
|
||||
if fi1.Size() != fi2.Size() {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return fi1.Size() == fi2.Size()
|
||||
}
|
||||
|
||||
// DirectioAlignSize - DirectIO alignment needs to be 4K. Defined here as
|
||||
|
||||
@@ -19,11 +19,33 @@ package ioutil
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
|
||||
"github.com/minio/minio/internal/disk"
|
||||
)
|
||||
|
||||
// ReadFileWithFileInfo reads the named file and returns the contents.
|
||||
// A successful call returns err == nil, not err == EOF.
|
||||
// Because ReadFile reads the whole file, it does not treat an EOF from Read
|
||||
// as an error to be reported, additionall returns os.FileInfo
|
||||
func ReadFileWithFileInfo(name string) ([]byte, fs.FileInfo, error) {
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
st, err := f.Stat()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
dst := make([]byte, st.Size())
|
||||
_, err = io.ReadFull(f, dst)
|
||||
return dst, st, err
|
||||
}
|
||||
|
||||
// ReadFile reads the named file and returns the contents.
|
||||
// A successful call returns err == nil, not err == EOF.
|
||||
// Because ReadFile reads the whole file, it does not treat an EOF from Read
|
||||
|
||||
Reference in New Issue
Block a user