Removing the old replica log from the disk itself is simple. What we need to make sure is that all potential outstanding operations on the deleted log are handled properly. In particular, we don't want any potential IOException due to the missing log causes the broker to halt.
1. All read operations are ok since we already handle unexpected exceptions in KafkaApi.
2. Writing to the log by the producer request, the replica fetcher or the log flusher: We need to make sure that after the log is deleted, no more writes/flushes will be attempted on the log. This can be achieved by:
2.1 For producer requests, the delete partition operation will synchronize on the leaderAndIsrUpdate lock.
2.2 For replica fetcher, this is already handled since the fetcher is removed before the log is deleted.
2.3 For log flusher, the flush and the delete will now synchronize on a delete lock.