when restart, compact all the log entries before snapshot. Avoid wrong startTerm