raftLog: enhance check in compact

@xiangli-cmu @bmizerany 
we need to have a better name for this. but we can address this later.