Skip to content

Commit

Permalink
Merge pull request #830 from unihorn/98
Browse files Browse the repository at this point in the history
fix(raft/log): truncate file and reset offset correctly
  • Loading branch information
yichengq committed Jun 5, 2014
2 parents a974bbf + 2cd367e commit 757bb3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion third_party/github.com/goraft/raft/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 757bb3a

Please sign in to comment.