What happens to the batch of records when send fails?

I have set the following config for producer:
enable.idempotence = true
max.in.flight.requests.per.connection = 1

Query:

  1. is the batch removed from the buffer memory when it is sent to the broker or it is removed after the send is successful? what happens to the batch of records in the producer buffer memory if the send request to broker fails. will the same batch gets sent again?

is my question not clear?