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

   ### Background
   
   The BE unit tests check profiling counters for prefetch, segment read-ahead, 
and file cache writeback. File cache tests also exercise admission under disk 
pressure, and Python UDF tests force child-exit timeouts to verify handoff to a 
background reaper.
   
   ### What problem does this PR solve?
   
   Issue Number: #71314
   Related PR: #71315 (integration branch), #71322 (macOS Python memory test 
fix), #71328 (file-reader cache capacity fix)
   PR Type: Test
   
   Problem Summary:
   
   On macOS, small copies and planning steps can finish within one clock tick 
and report zero elapsed time. The host's disk usage can push cache tests into 
disk-pressure mode, and a background reaper can consume a timeout a Python UDF 
test reserved for its own child. Scoped callbacks make the timed work 
measurable, the BE test binary supplies simulated disk usage, and each thread 
owns its forced child-exit timeouts.
   
   ### Details
   
   - **Change map:** Six commits add 126 lines and remove 12 lines under 
`be/src`. The tests add 135 lines and remove four.
   
     | Commit | Purpose |
     | --- | --- |
     | JSON prefetch | Count an injected pause in the buffered-copy timer. |
     | Column read-ahead | Count pauses in both window discard and 
current-batch planning. |
     | Partial block writeback | Count an injected pause in the merged-fragment 
copy trace. |
     | File cache disk usage | Supply 50% space and inode usage in the test 
binary and scope explicit pressure levels to the tests that need them. |
     | Python UDF child waits | Give the forcing thread its own countdown and 
test it while the reaper handles another child. |
     | Write-limiter fixtures | Wait for a new cache to finish opening before 
writing blocks so the loader sees an empty directory. |
   
   - **Failure:** On the integration branch, the original JSON `CopyTime` 
assertion failed in 402 of 600 runs. In 200 runs each, the read-ahead discard 
and planning assertions failed 180 and 86 times, respectively, and the partial 
writeback copy assertion failed 157 times. The full-disk condition failed 10 of 
13 TTL cache tests. The Python reaper regression failed in all three runs with 
a shared countdown.
   - **Cause:** Doris's macOS timer has 1 µs resolution. File cache admission 
uses space and inode usage from the filesystem. The reaper and the test thread 
previously drew from the same timeout countdown.
   - **Stability evidence:** The integration branch passed all 1,000 timing 
checks after the injected pauses. Simulating 95% usage reproduced the same 10 
TTL failures and the 50% default let all 13 tests pass. The Python regression 
passed three times with a thread-local countdown and failed three times after 
reverting to a shared countdown.
   
   ### Testing
   
   - Registration order on standalone macOS arm64 ASAN ran 331 tests from nine 
suites. All tests changed here passed. There were 326 passes, three existing 
skips and two macOS failures. 
`PythonServerTest.ReadProcessMemoryCurrentProcessSucceeds` reads Linux `/proc` 
and is addressed in #71322. 
`PythonUDFRuntimeTest.WaitChildExitReturnsAlreadyReapedForReapedChild` invokes 
`/bin/true` and is assigned to the later test isolation PR in #71314.
   - Shuffle seed 48256 ran the same 331 tests. There were 324 passes, the same 
three skips and four failures. The two additional failures were 
`BlockFileCacheTest.fd_cache_remove` and `BlockFileCacheTest.fd_cache_evict`. 
Their assertions saw file readers retained from prior tests. The cache capacity 
fix is in #71328, and clearing the cache between tests is assigned to the later 
test isolation PR.
   - The timing, disk usage, Python timeout and fixture-startup checks passed 
in both orders, including all 12 TTL cases.
   
   ### Notes for Reviewers
   
   - The timer assertions require at least 1 ms of the injected 2 ms pause to 
show up in the specific counter. This leaves room for differences between the 
clock used to sleep and the clock used to measure.
   - The disk override applies to both admission and proactive eviction. 
`statfs()` still detects invalid paths, and the existing disk usage sync point 
can override the simulated value. Default builds compile out the new sync 
points and both simulation hooks.
   - The standalone run exposed a fixture race. A cache loader can see 
test-written blocks before it has recorded the cache version and recursively 
count inodes on the host volume. The three write-limiter fixtures now wait for 
the loader before writing the blocks their assertions use.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: Linux CI pending. The 
standalone macOS runs report existing failures addressed by companion changes.
   
   ### AI Disclosure
   
   - Tool: Claude Code (Claude Opus 5.5) and OpenAI Codex (GPT-6)
   - Generated: Claude wrote the original hooks and tests. Codex prepared the 
split, fixed the write-limiter fixtures, ran standalone verification, and 
drafted the description.
   - Human review: not stated
   


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