Skip to content

test(fileservice): isolate async ownership from disk sync latency - #29116

Merged
XuPeng-SH merged 2 commits into
mainfrom
codex/ut-disk-cache-cluster-timeouts
Sep 19, 2026
Merged

XuPeng-SH merged 2 commits into
mainfrom
codex/ut-disk-cache-cluster-timeouts

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #28784 (disk-cache lifecycle/finalization UT flakiness).

What this PR does / why we need it:

TestDiskCacheAsyncUpdateReturnsBeforePathAvailable correctly observed asynchronous admission in the Ubuntu race job, but then exhausted its five-second Flush context while finalizing a real disk write. The test was coupling an ordering/ownership contract to real file.Sync latency. The CI artifacts do not establish which syscall consumed the deadline, so this is a test-contract correction, not a claim to have proved a filesystem or production cache defect.

  • Reuse the existing blocked-file-sync hook to explicitly control finalization, without changing production durability behavior or increasing timeouts.
  • Preserve asynchronous return while the path is owned, caller-buffer cloning, callback data, and actual cache read/hit assertions. Also check that the callback has not run while finalization is blocked.
  • Register both release edges immediately so failed assertions cannot strand a test-owned gate before cache cleanup.
  • Remove an unbounded timeout-path channel join and bound the callback wait separately: Flush drains writes, not callbacks.

Validation

Local platform: Darwin arm64, Go 1.26.4, matching freshly built native libraries, matrixone_test tag.

  • Exact modified test: normal and race pass. Adaptive race repetition: 100/100 pass, no skips (single measured test elapsed rounded to 0s; 30-second budget capped at 100).
  • Owning pkg/fileservice package: normal pass, 24.046s; 848 passing test/subtest events, 11 existing skips.
  • Incremental go vet, golangci-lint 2.6.2 (0 issues), gofmt and diff checks pass.
  • Local normal-mode control: original test 0.02s, changed test below output time resolution. This is not a CI speedup estimate.

Scope and remaining risk

The same CI job also failed TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges during CREATE ACCOUNT, before restore assertions, following HAKeeper/Raft timeouts. This PR does not claim to fix that independent failure. The existing, separately authored #29113 addresses embedded-package contention; its scheduling changes are not duplicated here. The unchanged restore case passes local normal mode (22.51s) and race mode (41.53s); isolated execution cannot establish loaded Linux CI stability.

GPT-6 medium design approved the correction; a separate GPT-6 medium overall review accepted the final diff with zero blockers after reconciling all validation evidence. CI will run after publication; no CI pass is claimed and this task does not wait for it.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force review of exact head f2dd6da.

未发现需要 REQUEST_CHANGES 的 material finding,本次提交 COMMENT。

已复查完整 diff,并追踪 async admission/cloning、path ownership、finalization、callback、Flush/Close、loader/restart 和资源清理链路。实例级 fileSync hook 只隔离测试中的真实 fsync latency,同时保留真实写入、发布和读取;两个 gate 都有即时且幂等的 cleanup,buffered result channel 在断言失败时不会阻塞。caller buffer mutation、callback 数据和实际 cache Read 共同验证了可观察语义,不只是内部 flag。

未引入全局 hook、skip、retry 或 timeout 放大;未发现新增 race、死锁、泄漏或重复释放路径。exact-head Ubuntu CI 已确认 pkg/fileservice 纳入 race 测试并成功完成。

边界:该测试证明 lifecycle ordering 和 cache readable data,不证明断电持久性,也未独立重跑作者报告的 normal/race x100/完整包测试;FD 数量、temp-file 清单和 callback budget 没有单独断言,但相关生产清理链已追踪。

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants