mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix(raft/log): truncate file and reset offset correctly
This commit is contained in:
3
third_party/github.com/goraft/raft/log.go
vendored
3
third_party/github.com/goraft/raft/log.go
vendored
@@ -168,9 +168,10 @@ func (l *Log) open(path string) error {
|
|||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
debugln("open.log.append: finish ")
|
debugln("open.log.append: finish ")
|
||||||
} else {
|
} 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)
|
return fmt.Errorf("raft.Log: Unable to recover: %v", err)
|
||||||
}
|
}
|
||||||
|
l.file.Seek(readBytes, os.SEEK_SET)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user