mirror of https://github.com/apache/kafka.git
KAFKA-10861; Fix race condition in flaky test `testFencingOnSendOffsets` (#9762)
I wasn't able to reproduce the failure locally, but it looks like there is a race condition with the sending of the records in the first producer. The test case assumes that these records have been completed before the call to `sendOffsetsToTransaction`, but they very well might not be. It is even possible for the writes from the second producer to arrive first which would then result in the test failure that we are seeing. The solution is to force the send with `flush()`. Reviewers: Guozhang Wang <guozhang@apache.org>, Boyang Chen <boyang@confluent.io>
This commit is contained in:
parent
f4272fd5d3
commit
4089c36b33
|
@ -356,6 +356,7 @@ class TransactionsTest extends KafkaServerTestHarness {
|
|||
producer1.beginTransaction()
|
||||
producer1.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic1, null, "1", "1", willBeCommitted = false))
|
||||
producer1.send(TestUtils.producerRecordWithExpectedTransactionStatus(topic2, null, "3", "3", willBeCommitted = false))
|
||||
producer1.flush()
|
||||
|
||||
producer2.initTransactions() // ok, will abort the open transaction.
|
||||
producer2.beginTransaction()
|
||||
|
|
Loading…
Reference in New Issue