raft/log.go
func (l *raftLog) findConflict(ents []pb.Entry) uint64 {
	for _, ne := range ents {
		if !l.matchTerm(ne.Index, ne.Term) {
			if ne.Index <= l.lastIndex() {
				l.logger.Infof("found conflict at index %d [existing term: %d, conflicting term: %d]",
					ne.Index, l.zeroTermOnErrCompacted(l.term(ne.Index)), ne.Term)
			}
			return ne.Index
		}
	}
	return 0
}
func (l *raftLog) findConflict(ents []pb.Entry) uint64 {
	for _, ne := range ents {
		if !l.matchTerm(ne.Index, ne.Term) {
			if ne.Index <= l.lastIndex() {
				l.logger.Infof("found conflict at index %d [existing term: %d, conflicting term: %d]",
					ne.Index, l.zeroTermOnErrCompacted(l.term(ne.Index)), ne.Term)
			}
			return ne.Index
		}
	}
	return 0
}
func ( l * raftLog ) findConflict ( ents [ ] pb . Entry ) uint64 { for _ , ne := range ents { if ! l . matchTerm ( ne . Index , ne . Term ) { if ne . Index <= l . lastIndex ( ) { l . logger . Infof ( " " , ne . Index , l . zeroTermOnErrCompacted ( l . term ( ne . Index ) ) , ne . Term ) } return ne . Index } } return 0 }
// findConflict finds the index of the conflict.
// It returns the first pair of conflicting entries between the existing
// entries and the given entries, if there are any.
// If there is no conflicting entries, and the existing entries contains
// all the given entries, zero will be returned.
// If there is no conflicting entries, but the given entries contains new
// entries, the index of the first new entry will be returned.
// An entry is considered to be conflicting if it has the same index but
// a different term.
// The first entry MUST have an index equal to the argument 'from'.
// The index of the given entries MUST be continuously increasing.
findConflict finds the index of the conflict . It returns the first pair of conflicting entries between the existing entries and the given entries if there are any . If there is no conflicting entries and the existing entries contains all the given entries zero will be returned . If there is no conflicting entries but the given entries contains new entries the index of the first new entry will be returned . An entry is considered to be conflicting if it has the same index but a different term . The first entry MUST have an index equal to the argument from . The index of the given entries MUST be continuously increasing .