|
|
@@ -112,7 +112,7 @@ func Create(dirpath string, metadata []byte) (*WAL, error) {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- if _, err = f.Seek(0, os.SEEK_END); err != nil {
|
|
|
+ if _, err = f.Seek(0, io.SeekEnd); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
if err = fileutil.Preallocate(f.File, SegmentSizeBytes, true); err != nil {
|
|
|
@@ -322,7 +322,7 @@ func (w *WAL) ReadAll() (metadata []byte, state raftpb.HardState, ents []raftpb.
|
|
|
// not all, will cause CRC errors on WAL open. Since the records
|
|
|
// were never fully synced to disk in the first place, it's safe
|
|
|
// to zero them out to avoid any CRC errors from new writes.
|
|
|
- if _, err = w.tail().Seek(w.decoder.lastOffset(), os.SEEK_SET); err != nil {
|
|
|
+ if _, err = w.tail().Seek(w.decoder.lastOffset(), io.SeekStart); err != nil {
|
|
|
return nil, state, nil, err
|
|
|
}
|
|
|
if err = fileutil.ZeroToEnd(w.tail().File); err != nil {
|
|
|
@@ -361,7 +361,7 @@ func (w *WAL) ReadAll() (metadata []byte, state raftpb.HardState, ents []raftpb.
|
|
|
// Then cut atomically rename temp wal file to a wal file.
|
|
|
func (w *WAL) cut() error {
|
|
|
// close old wal file; truncate to avoid wasting space if an early cut
|
|
|
- off, serr := w.tail().Seek(0, os.SEEK_CUR)
|
|
|
+ off, serr := w.tail().Seek(0, io.SeekCurrent)
|
|
|
if serr != nil {
|
|
|
return serr
|
|
|
}
|
|
|
@@ -401,7 +401,7 @@ func (w *WAL) cut() error {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- off, err = w.tail().Seek(0, os.SEEK_CUR)
|
|
|
+ off, err = w.tail().Seek(0, io.SeekCurrent)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
@@ -418,7 +418,7 @@ func (w *WAL) cut() error {
|
|
|
if newTail, err = fileutil.LockFile(fpath, os.O_WRONLY, fileutil.PrivateFileMode); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- if _, err = newTail.Seek(off, os.SEEK_SET); err != nil {
|
|
|
+ if _, err = newTail.Seek(off, io.SeekStart); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
@@ -564,7 +564,7 @@ func (w *WAL) Save(st raftpb.HardState, ents []raftpb.Entry) error {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- curOff, err := w.tail().Seek(0, os.SEEK_CUR)
|
|
|
+ curOff, err := w.tail().Seek(0, io.SeekCurrent)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|