Skip to content

Commit

Permalink
fix commit fix should handle log start
Browse files Browse the repository at this point in the history
  • Loading branch information
absolute8511 committed Jun 26, 2018
1 parent f66b9d2 commit 9fa3b6c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions consistence/commitlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ func (tcl *TopicCommitLogMgr) loadCommitLogMeta(fixMode bool) error {
coordLog.Errorf("%v invalid last log data: %v, file: %v, %v, %v", tcl.path, l, fsize, num, roundOffset)
for i := 0; i < int(num)-1; i++ {
roundOffset := int64(i) * int64(GetLogDataSize())
if tcl.currentStart == tcl.logStartInfo.SegmentStartIndex &&
roundOffset < tcl.logStartInfo.SegmentStartOffset {
continue
}
firstLog, err := tcl.GetCommitLogFromOffsetV2(tcl.currentStart, roundOffset)
if err != nil || firstLog.LastMsgLogID < firstLog.LogID {
coordLog.Errorf("%v first invalid log data %v: %v, %v, offset:%v",
Expand Down Expand Up @@ -388,6 +392,10 @@ func (tcl *TopicCommitLogMgr) loadCommitLogMeta(fixMode bool) error {
var lastLog *CommitLogData
for i := 0; i < int(num)-1; i++ {
roundOffset := int64(i) * int64(GetLogDataSize())
if tcl.currentStart == tcl.logStartInfo.SegmentStartIndex &&
roundOffset < tcl.logStartInfo.SegmentStartOffset {
continue
}
firstLog, err := tcl.GetCommitLogFromOffsetV2(tcl.currentStart, roundOffset)
if err != nil {
coordLog.Errorf("%v first invalid log data %v: %v, at offset:%v",
Expand Down

0 comments on commit 9fa3b6c

Please sign in to comment.