raft: append entries only if necessary

It is an optimization to handle out-of-ordered msgApp better.