Skip to content

Commit

Permalink
commitlog: fix position of 1st entry
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Dec 6, 2016
1 parent 56a588b commit 154ba08
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion commitlog/commitlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestNewCommitLogExisting(t *testing.T) {
})
assert.NoError(t, err)

for i, _ := range msgSets {
for i := range msgSets {
p := make([]byte, maxBytes)
_, err = r.Read(p)
assert.NoError(t, err)
Expand Down
6 changes: 0 additions & 6 deletions commitlog/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,10 @@ func NewSegment(path string, baseOffset int64, maxBytes int64) (*Segment, error)
return nil, errors.Wrap(err, "open file failed")
}

fi, err := log.Stat()
if err != nil {
return nil, errors.Wrap(err, "file stat failed")
}

s := &Segment{
log: log,
writer: log,
reader: log,
Position: fi.Size(),
maxBytes: maxBytes,
BaseOffset: baseOffset,
NextOffset: baseOffset,
Expand Down

0 comments on commit 154ba08

Please sign in to comment.