| 780 | } |
| 781 | |
| 782 | func (vlog *valueLog) deleteLogFile(lf *logFile) error { |
| 783 | if lf == nil { |
| 784 | return nil |
| 785 | } |
| 786 | lf.lock.Lock() |
| 787 | defer lf.lock.Unlock() |
| 788 | |
| 789 | path := vlog.fpath(lf.fid) |
| 790 | if err := lf.munmap(); err != nil { |
| 791 | _ = lf.fd.Close() |
| 792 | return err |
| 793 | } |
| 794 | lf.fmap = nil |
| 795 | if err := lf.fd.Close(); err != nil { |
| 796 | return err |
| 797 | } |
| 798 | return os.Remove(path) |
| 799 | } |
| 800 | |
| 801 | func (vlog *valueLog) dropAll() (int, error) { |
| 802 | // If db is opened in InMemory mode, we don't need to do anything since there are no vlog files. |