david-streamlio opened a new pull request, #84:
URL: https://github.com/apache/pulsar-connectors/pull/84

   Fixes #83
   
   ### Motivation
   
   `PulsarSchemaHistoryTest` intermittently fails in `setup()`:
   
   ```
   PulsarSchemaHistoryTest > setup FAILED
       org.apache.pulsar.client.admin.PulsarAdminException$NotFoundException: 
Tenant does not exist
           javax.ws.rs.NotFoundException: HTTP 404 {"reason":"Tenant does not 
exist"}
   ```
   
   It struck an unrelated PR today — #79, a DynamoDB client-construction fix, 
whose own tests all passed: [run 
29055562433](https://github.com/apache/pulsar-connectors/actions/runs/29055562433).
 Because `setup()` is a `@BeforeMethod`, one lost race takes down every test in 
the class and fails a PR that never touched this code.
   
   ### Root cause
   
   `setup()` creates the namespace as soon as the container reports ready:
   
   ```java
   pulsarContainer.start();
   ...
   admin.namespaces().createNamespace("public/my-ns");   // may race
   ```
   
   The broker creates the `public` tenant **asynchronously** during bootstrap. 
`PulsarContainer`'s wait strategy returns once the port and startup log are up, 
which can precede tenant creation.
   
   ### Modifications
   
   Poll for the `public` tenant before creating the namespace, with 
`ignoreExceptions()` so admin calls made while the broker is still warming do 
not fail the wait.
   
   ### Verifying this change
   
   `./gradlew :debezium:pulsar-io-debezium-core:test` — `BUILD SUCCESSFUL in 1m 
12s`, all 6 tests pass.
   
   **An honest caveat on that evidence:** this flake does not reproduce 
locally, so a green local run is weak proof. I probed it directly — calling 
`admin.tenants().getTenants()` immediately after `start()` returns `[public, 
pulsar]` every time on a warm machine, meaning the wait is a no-op locally and 
the race window only opens on CI's slower, contended runners. What the change 
does guarantee is that the 404 window is closed wherever it exists: the wait 
returns as soon as the tenant is visible, and adds nothing when it already is.
   
   ### Note
   
   This is the third timing-flake of the same shape found in this repo today, 
after the file connector's queue hand-off races (#12 / #41) and the InfluxDB 
sink's fixed-`Thread.sleep` assertion (#53 / #73). Each assumed an asynchronous 
step had completed because a synchronous one had.


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