morningman opened a new pull request, #66195:
URL: https://github.com/apache/doris/pull/66195

   ### What problem does this PR solve?
   
   Every test class deriving from `TestWithFeService` spends about **12 
seconds** in `createDorisCluster()`, and roughly **10 of those seconds are pure 
idle waiting**.
   
   `Daemon.run()` runs one cycle *before* sleeping, so `HeartbeatMgr`'s first 
cycle completes while `createDorisCluster()` has not registered any backend 
yet. `checkBEHeartbeat()` then has to wait for the second cycle, which is 
`heartbeat_interval_second` (default **10**) away.
   
   This is not a niche cost: **304 test classes in fe-core start an FE**, and 
**215 of them (71%) live under `nereids`** — which is why `nereids` dominates 
FE UT wall time.
   
   Evidence that this is a timer rather than real work: six synthetic classes 
that only start the FE and assert once took 11.95 / 12.07 / 12.06 / 11.93 / 
12.08 / 12.08 s — a spread of ±0.08s.
   
   ### What is changed?
   
   - Set `heartbeat_interval_second = 1` at the start of `beforeAll()`.
     - Placed **before** `beforeCreatingConnectContext()` so subclasses that 
set the interval explicitly (`DecommissionBackendTest`, 
`BeDownCancelCloneTest`) still override it.
     - Placed **before** the `Env` singleton is created, so `HeartbeatMgr` 
picks up the new interval.
     - Deliberately **not** put into `MockedFrontend.MIN_FE_CONF`: 
`DorisFE.start()` would load it from `fe.conf` and silently override those 
subclasses.
   - Make `checkBEHeartbeatStatus()` check before sleeping, and poll at 20ms 
instead of sleeping a fixed 1s before each check. The overall timeout budget is 
unchanged.
   
   ### Measurements
   
   20 `nereids.trees.plans.commands` test classes, 43 tests, all passing before 
and after:
   
   | config | wall clock | reported test time |
   |---|---|---|
   | before, `fork=1` | 399s | 283s |
   | after, `fork=1` | **211s** | **95s** |
   | after, `fork=4` | **67s** | — |
   
   A synthetic class that only starts the FE and asserts once: **12.0s -> 
2.83s**.
   
   Also verified separately: `DecommissionBackendTest` (overrides the interval 
to 5) and `TabletHealthTest` (exercises `checkBELostHeartbeat`) pass.
   
   ### Release note
   
   None
   
   ### Check List
   
   - [x] Test
     - [x] Regression test — not applicable, this only changes the FE unit test 
harness
     - [x] Unit Test — verified on a 26-class sample; **this PR is a draft 
precisely to get a full CI run**, since the change touches the base class of 
304 test classes and the risk to validate is timing-sensitive flakiness
   - [x] Behavior changed: No (test-only)
   - [x] Does this need documentation? No
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to