Xuanwo opened a new pull request, #8933: URL: https://github.com/apache/opendal/pull/8933
# Which issue does this PR close? N/A. # Rationale for this change Four cold-read race unit tests in `opendal-service-foyer` (`cancelled_cold_read_releases_its_pin`, `in_flight_disk_read_is_not_resurrected`, `in_flight_disk_read_does_not_overwrite_a_newer_insert`, and `in_flight_disk_read_does_not_promote_over_an_evicted_newer_insert`) assumed that polling a cold `FoyerCore::get` once (`poll_once(&mut read).await`) always returns `Poll::Pending`. Foyer's `PsyncIoEngine::read` dispatches the disk read via `spawn_blocking`. Under heavy CPU contention (such as workspace `cargo nextest` runs in Core CI), the blocking read can finish between submitting the job and polling its `JoinHandle`, causing the first poll to return `Poll::Ready(Ok(Some(...)))` and fail the `is_pending()` assertion. # What changes are included in this PR? - Add a `#[cfg(test)]` `LoadGate` to `FoyerCore` in `core/services/foyer/src/core.rs` that parks `FoyerCore::load_from_disk` right after `cache.storage().load(&foyer_key).await` and before `DeletedKeys::finish_read` when held by a test, with zero runtime or layout overhead in non-test builds. - Update the four cold-read race tests to park deterministically on `LoadGate` via `spawn_parked_read` before racing deletes, overwrites, evictions, or cancellation against the loaded bytes. - Add the explicit `sync` feature to the `tokio` dev-dependency in `core/services/foyer/Cargo.toml` for `tokio::sync::Semaphore`. # Are there any user-facing changes? None. # Breaking changes # AI Usage Statement - Harness: pi - Model: Gemini 4 Neon - Effort: high - Role: Implemented the test-only `LoadGate` synchronization in `core/services/foyer/src/core.rs`, updated the four cold-read race tests and `core/services/foyer/Cargo.toml`, and verified formatting, clippy, rustdoc, and repeated test runs. No assumptions or unknowns affect production behavior; all runtime changes are gated behind `#[cfg(test)]`. -- 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]
