public void truncateFullyAndReloadSnapshots() throws IOException {
        log.info("Reloading the producer state snapshots");
        truncateFullyAndStartAt(0L);
        snapshots = loadSnapshots();
    }
This method checks whether there is a late transaction in a thread safe manner.
storage/src/main/java/org/apache/kafka/storage/internals/log/ProducerStateManager.java