wal/repair.go
func openLast(lg *zap.Logger, dirpath string) (*fileutil.LockedFile, error) {
	names, err := readWALNames(lg, dirpath)
	if err != nil {
		return nil, err
	}
	last := filepath.Join(dirpath, names[len(names)-1])
	return fileutil.LockFile(last, os.O_RDWR, fileutil.PrivateFileMode)
}
func openLast(lg *zap.Logger, dirpath string) (*fileutil.LockedFile, error) {
	names, err := readWALNames(lg, dirpath)
	if err != nil {
		return nil, err
	}
	last := filepath.Join(dirpath, names[len(names)-1])
	return fileutil.LockFile(last, os.O_RDWR, fileutil.PrivateFileMode)
}
func openLast ( lg * zap . Logger , dirpath string ) ( * fileutil . LockedFile , error ) { names , err := readWALNames ( lg , dirpath ) if err != nil { return nil , err } last := filepath . Join ( dirpath , names [ len ( names ) - 1 ] ) return fileutil . LockFile ( last , os . O_RDWR , fileutil . PrivateFileMode ) }
// openLast opens the last wal file for read and write.
openLast opens the last wal file for read and write .