File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -575,7 +575,6 @@ func (vlog *valueLog) open(db *DB) error {
575575 lf , ok := vlog .filesMap [fid ]
576576 y .AssertTrue (ok )
577577
578- // Just open in RDWR mode. This should not create a new log file.
579578 lf .opt = vlog .opt
580579 flags := os .O_RDWR
581580 if vlog .opt .ReadOnly {
@@ -586,7 +585,7 @@ func (vlog *valueLog) open(db *DB) error {
586585 return y .Wrapf (err , "Open existing file: %q" , lf .path )
587586 }
588587 // We shouldn't delete the maxFid file.
589- if lf .size .Load () == vlogHeaderSize && fid != vlog .maxFid {
588+ if lf .size .Load () == vlogHeaderSize && fid != vlog .maxFid && ! vlog . opt . ReadOnly {
590589 vlog .opt .Infof ("Deleting empty file: %s" , lf .path )
591590 if err := lf .Delete (); err != nil {
592591 return y .Wrapf (err , "while trying to delete empty file: %s" , lf .path )
You can’t perform that action at this time.
0 commit comments