public void resetProducerState(ProducerIdAndEpoch producerIdAndEpoch, int baseSequence) {
        log.info("Resetting sequence number of batch with current sequence {} for partition {} to {}",
                this.baseSequence(), this.topicPartition, baseSequence);
        reopened = true;
        recordsBuilder.reopenAndRewriteProducerState(producerIdAndEpoch.producerId, producerIdAndEpoch.epoch, baseSequence, isTransactional());
    }
Returns if the batch is been retried for sending to kafka
clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java