AlinsRan opened a new pull request, #13709:
URL: https://github.com/apache/apisix/pull/13709

   ### Description
   
   `t/plugin/kafka-logger.t` TEST 18 is flaky in CI, e.g. 
https://github.com/apache/apisix/actions/runs/29567552409/job/88251295446 (on 
an unrelated PR):
   
   ```
   #   Failed test 't/plugin/kafka-logger.t TEST 18: report log to kafka by 
different partitions - pattern "(?^:partition_id: 1)" should match a line in 
error.log (req 0)'
   #   Failed test 't/plugin/kafka-logger.t TEST 18: report log to kafka by 
different partitions - pattern "(?^:partition_id: 2)" should match a line in 
error.log (req 0)'
   ```
   
   The test sends exactly three requests to the three-partition topic `test3` 
and requires partition ids 0, 1 and 2 to all appear in the error log.
   
   lua-resty-kafka's default partitioner is `correlation_id % partition_num` 
when no key is configured, and `correlation_id` is bumped once per *produce 
request*, not once per message. On the happy path each `send()` issues one 
produce request, so three consecutive sends rotate neatly over 0/1/2. As soon 
as a produce request fails and `_batch_send` retries, the correlation id 
advances by more than one and two messages land on the same partition — one of 
the expected `partition_id:` lines then never shows up. The plugin config used 
`"timeout": 1`, which makes exactly that retry likely on a loaded runner.
   
   Fix: send six requests instead of three, so a transient retry no longer 
drops a partition from the run, and drop the tight 1s timeout that provoked the 
retries. Verified locally against a 3-partition `test3` topic — all six 
messages spread evenly (2 per partition).
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to