In the documention of kafka about retries, it says:
Allowing retries without setting max.in.flight.requests.per.connection to 1 will potentially change the ordering of records because if two batches are sent to a single partition, and the first fails and is retried but the second succeeds, then the records in the second batch may appear first.
According the paragraph,if two batches are send to the same partition, kafka can commit the second batch while fail the first batch.
But this seems contradic to kafka's guarantee about ordering in same partition. Because usually if one batch failed, all subsequent batches should fail,otherwise how could it guarantee ordering? Besides,how does kafka guarantee that the order of batches send by producer is the same as the order reveiced by broker.
So my question is: how does kafka guarantee the ordering of different batch (of same partition) or it just does not guarantee.