lhotari opened a new pull request, #25680:
URL: https://github.com/apache/pulsar/pull/25680

   ### Motivation
   
   When CI runs `BacklogQuotaManagerTest`, two cases fail together as a cascade:
   
   1. `BacklogQuotaManagerTest.clearNamespaces` (the `@AfterMethod`) fails with 
`org.awaitility.core.ConditionTimeoutException: Condition ... was not fulfilled 
within 10 seconds.` while force-deleting `prop/ns-quota`.
   2. The next test method's `@BeforeMethod` `createNamespaces` then fails with 
`PulsarAdminException$ConflictException: Namespace already exists` (HTTP 409), 
because the prior cleanup never finished — and the same 409 keeps cascading for 
every subsequent test.
   
   Example: 
https://github.com/apache/pulsar/actions/runs/25387367872/job/74455105884 (PR 
#25676 attempt 1; the failure is unrelated to that PR's change).
   
   Root cause: PR #25624 added 
`testConsumerBacklogEvictionSizeQuotaCleansPendingAcks` and 
`testConsumerBacklogEvictionTimeQuotaNotPreciseCleansPendingAcks`, which leave 
Key_Shared consumers with unacked messages on `prop/ns-quota` and an active 
backlog-quota check loop running every 2s. Force-deleting that state can exceed 
the 10s default `Awaitility` budget used by 
`MockedPulsarServiceBaseTest.deleteNamespaceWithRetry`. The afterMethod times 
out, leftover metadata remains, and the next beforeMethod hits 409.
   
   ### Modifications
   
   In `BacklogQuotaManagerTest`:
   
   1. **Local `deleteNamespaceWithRetry(String, boolean)`** is rewritten with 
an inline `Awaitility` retry that uses `atMost(60, SECONDS)` instead of the 10s 
default. Sized for the heaviest cleanups in this class. The unused `(String, 
boolean, PulsarAdmin)` overload is removed.
   2. **`createNamespaces`** is split: a new `createNamespaceForTest(String)` 
helper catches `PulsarAdminException.ConflictException` and recovers by 
force-deleting the leftover and recreating, so a slow prior cleanup cannot 
cascade as a 409 here.
   
   The change is local to this test class and does not touch the shared 
`MockedPulsarServiceBaseTest.deleteNamespaceWithRetry` static helper — blast 
radius limited to the test class that triggers the issue.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   This change is already covered by existing tests, such as 
`BacklogQuotaManagerTest.testConsumerBacklogEvictionSizeQuotaCleansPendingAcks` 
and 
`BacklogQuotaManagerTest.testConsumerBacklogEvictionTimeQuotaNotPreciseCleansPendingAcks`
 (the two heavy tests that exposed the cascade). Verified locally with 
`@Test(invocationCount = 10)` on both: 20/20 passes, all `clearNamespaces` 
cycles within the new 60s budget.
   
   ### Does this pull request potentially affect one of the following parts:
   
   - [ ] 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


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