fix(raft/log): truncate file and reset offset correctly

release-0.4
Yicheng Qin 2014-06-05 12:09:25 -07:00
parent a974bbfe4f
commit 2cd367e9d9
1 changed files with 2 additions and 1 deletions

View File

@ -168,9 +168,10 @@ func (l *Log) open(path string) error {
if err == io.EOF {
debugln("open.log.append: finish ")
} else {
if err = os.Truncate(path, readBytes); err != nil {
if err = l.file.Truncate(readBytes); err != nil {
return fmt.Errorf("raft.Log: Unable to recover: %v", err)
}
l.file.Seek(readBytes, os.SEEK_SET)
}
break
}