Implement log compaction (snapshots)