recover compaction in the last position (#7490)