raftLog: enhance check in compact

compact MUST happen on entries that have been committed, or
it may screw up the log.