Repository navigation
Description
Branch Name
main
Commit ID
Other Environment Information
- MatrixOne source image built from current
main - Linux amd64, Docker deployment with 2 CN + TN + LogService + Proxy + MinIO
- One CN's disk-cache path was mounted on a loopback FUSE filesystem that delays every real file
fsyncby 21 seconds; a second CN used the normal ext4 path as the control - Test table: 100,000 rows, 204,800,000 payload bytes, low-compressibility SHA-256 data
Actual Behavior
S3 full-object cache fills call DiskCache.SetFile synchronously. SetFile copies the object to a temporary file and then waits for f.Sync, close, rename, and cache-index publication before the foreground S3FS.Read returns. This path does not honor S3FS.asyncUpdate, even though disk cache is an optional acceleration layer.
With the same empty-cache aggregate scan on both CNs:
- Normal CN: 10.799 seconds.
- CN with 21-second disk-cache
fsync: 43.348 seconds. - The delayed query returned the correct
100000 / 5000050000 / 204800000 / 51032400aggregates, but started five delayed cachefsynccalls and took 32.549 seconds longer (4.0x total latency). - Every injected
fsynccompleted in 21.0-21.96 seconds. Neither CN restarted or OOMed.
The synchronous boundary exists in both buffered and streaming full-object read paths. S3 writes that populate full-file disk cache also call SetFile synchronously.
Expected Behavior
When asynchronous cache updates are enabled, the foreground storage operation may synchronously consume source data needed by the caller, but optional disk-cache durability/publication work (fsync, close, rename, and index update) must not add disk tail latency to SQL/S3 completion.
The implementation should have bounded ownership and shutdown semantics: transfer the open temporary file and per-path update ownership to a bounded cache worker, keep the final path invisible until rename succeeds, clean temporary files and release path ownership on failure/close, and retain a synchronous mode for callers that explicitly disable asynchronous updates.
Steps to Reproduce
- Deploy MatrixOne with 2 CN + MinIO and enable disk cache.
- Create a low-compressibility table large enough to force full-object cache fills.
- Start one CN with an empty disk cache on a filesystem where each file
fsynctakes at least 21 seconds; leave the second CN unchanged with an empty cache. - Directly run the same full-table aggregate scan against each CN.
- Observe that the delayed CN's foreground SQL waits for disk-cache
fsync, while the control CN completes after object read/compute.
Additional information
S3FS.readFullObjectToDiskCacheStreamingcallsdiskCache.SetFileinline and returns only after it finishes.- The buffered full-object read path and S3 write cache-population path also call
SetFileinline. DiskCache.writeFileperformsf.Sync,f.Close,os.Rename, and cache-index publication before returning.- Consequences under degraded local disks include query/write timeouts, blocked I/O-merge waiters, connection and goroutine buildup, retries that amplify object-store load, and a local cache failure cascading into CN-level tail-latency or availability incidents.
Activity
fix(fileservice): harden disk cache async update lifecycle (#27368)
fix(fileservice): harden disk cache async update lifecycle (matrixori…
fix(fileservice): harden disk cache async update lifecycle (matrixori…
fix(fileservice): harden disk cache async update lifecycle (matrixori…