mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
do not recreate deprecated delete-journal.bin, only read it (#15185)
simplify deprecated code, re-enable hot-swap replace disks
This commit is contained in:
parent
ab9544c0d3
commit
c2ddcb3b40
@ -71,18 +71,9 @@ func initTierDeletionJournal(ctx context.Context) (*tierJournal, error) {
|
|||||||
tierMemJournal: newTierMemJoural(1000),
|
tierMemJournal: newTierMemJoural(1000),
|
||||||
tierDiskJournal: newTierDiskJournal(),
|
tierDiskJournal: newTierDiskJournal(),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, diskPath := range globalEndpoints.LocalDisksPaths() {
|
for _, diskPath := range globalEndpoints.LocalDisksPaths() {
|
||||||
j.diskPath = diskPath
|
j.diskPath = diskPath
|
||||||
if err := os.MkdirAll(filepath.Dir(j.JournalPath()), os.FileMode(0o700)); err != nil {
|
|
||||||
logger.LogIf(ctx, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
err := j.Open()
|
|
||||||
if err != nil {
|
|
||||||
logger.LogIf(ctx, err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
go j.deletePending(ctx) // for existing journal entries from previous MinIO versions
|
go j.deletePending(ctx) // for existing journal entries from previous MinIO versions
|
||||||
go j.processEntries(ctx) // for newer journal entries circa free-versions
|
go j.processEntries(ctx) // for newer journal entries circa free-versions
|
||||||
@ -100,10 +91,8 @@ func (jd *tierDiskJournal) rotate() error {
|
|||||||
if _, err := os.Stat(jd.ReadOnlyPath()); err == nil {
|
if _, err := os.Stat(jd.ReadOnlyPath()); err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Close the active journal if present.
|
// Close the active journal if present and delete it.
|
||||||
jd.Close()
|
return jd.Close()
|
||||||
// Open a new active journal for subsequent journalling.
|
|
||||||
return jd.Open()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type walkFn func(ctx context.Context, objName, rvID, tierName string) error
|
type walkFn func(ctx context.Context, objName, rvID, tierName string) error
|
||||||
@ -117,8 +106,7 @@ func (jd *tierDiskJournal) JournalPath() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (jd *tierDiskJournal) WalkEntries(ctx context.Context, fn walkFn) {
|
func (jd *tierDiskJournal) WalkEntries(ctx context.Context, fn walkFn) {
|
||||||
err := jd.rotate()
|
if err := jd.rotate(); err != nil {
|
||||||
if err != nil {
|
|
||||||
logger.LogIf(ctx, fmt.Errorf("tier-journal: failed to rotate pending deletes journal %s", err))
|
logger.LogIf(ctx, fmt.Errorf("tier-journal: failed to rotate pending deletes journal %s", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -226,21 +214,17 @@ func (jd *tierDiskJournal) Close() error {
|
|||||||
if fi, err = f.Stat(); err != nil {
|
if fi, err = f.Stat(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
f.Close() // close before rename()
|
||||||
|
|
||||||
// Skip renaming active journal if empty.
|
// Skip renaming active journal if empty.
|
||||||
if fi.Size() == tierJournalHdrLen {
|
if fi.Size() == tierJournalHdrLen {
|
||||||
return nil
|
return os.Remove(jd.JournalPath())
|
||||||
}
|
}
|
||||||
|
|
||||||
jPath := jd.JournalPath()
|
jPath := jd.JournalPath()
|
||||||
jroPath := jd.ReadOnlyPath()
|
jroPath := jd.ReadOnlyPath()
|
||||||
// Rotate active journal to perform pending deletes.
|
// Rotate active journal to perform pending deletes.
|
||||||
err = os.Rename(jPath, jroPath)
|
return os.Rename(jPath, jroPath)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open opens a new active journal. Note: calling Open on an opened journal is a
|
// Open opens a new active journal. Note: calling Open on an opened journal is a
|
||||||
|
Loading…
Reference in New Issue
Block a user