oneby-wang opened a new pull request, #25125:
URL: https://github.com/apache/pulsar/pull/25125

   ### Motivation
   
   Fix 
`AdminApiTransactionTest.testAnalyzeSubscriptionBacklogWithTransactionMarker()` 
flaky test.
   
   Example failure:
   
   ```
     Error:  
org.apache.pulsar.broker.admin.v3.AdminApiTransactionTest.testAnalyzeSubscriptionBacklogWithTransactionMarker
     [INFO]   Run 1: PASS
     Error:    Run 2: 
AdminApiTransactionTest.testAnalyzeSubscriptionBacklogWithTransactionMarker:1098
 expected [20] but found [19]
   ```
   
   
https://github.com/oneby-wang/pulsar/actions/runs/20709883704/job/59448327174?pr=22
   
   ### Modifications
   
    Wait for `txn.abort()` to complete to avoid flaky test.
    
   I checked two other test methods for `topics.peekMessages()` that do not use 
`txn.abort().get()`; I ran these tests a lot of times locally and found them 
are not flaky. 
   
   
https://github.com/apache/pulsar/blob/bf98773a2d3f6ecf73560fe4e682ce058dcfde61/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/v3/AdminApiTransactionTest.java#L970-L979
   
   
https://github.com/apache/pulsar/blob/bf98773a2d3f6ecf73560fe4e682ce058dcfde61/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/v3/AdminApiTransactionTest.java#L1019-L1027
   
   I read the source code and found that `topics.peekMessages()` returns only 
when the specified `numMessages` have been retrieved.
   
   
https://github.com/apache/pulsar/blob/bf98773a2d3f6ecf73560fe4e682ce058dcfde61/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java#L921-L927
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: https://github.com/oneby-wang/pulsar/pull/23


-- 
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