Skip to content

Commit

Permalink
segment message set offset on write
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Nov 19, 2016
1 parent 309c097 commit 70f7d43
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commitlog/commitlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ func (l *CommitLog) Append(ms MessageSet) error {
}
}
position := l.activeSegment().Position
offset := l.activeSegment().NextOffset
ms.PutOffset(offset)
if _, err := l.activeSegment().Write(ms); err != nil {
return err
}
e := Entry{
Offset: ms.Offset(),
Offset: offset,
Position: position,
}
if err := l.activeSegment().Index.WriteEntry(e); err != nil {
Expand Down

0 comments on commit 70f7d43

Please sign in to comment.