示例#1
0
func (sp *spaxos) doTryCatchUp(msg pb.Message) {
	assert(sp.id == msg.To)
	const catchUpStep = 10

	assert(sp.minIndex <= sp.maxIndex)
	for i := 0; i < catchUpStep; i++ {
		catchIndex := sp.minIndex + uint64(i+1)
		if catchIndex > sp.maxIndex {
			break
		}

		if _, ok := sp.insgroup[catchIndex]; ok {
			continue
		}

		// catchIndex don't have spaxos instance yet
		catchIns := sp.getSpaxosInstance(catchIndex)
		assert(nil != catchIns)
		// => create a new spaxos instance for catchIndex

		msg.Index = catchIndex
		catchIns.step(sp, msg)
	}
}