objectfs: fix data corruption after truncates and run multi-seed fsx #171
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 353 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.351
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #171"
general
weight: 0.35
justinsb
Summary
This PR addresses the intermittent fsx data corruption issues where plain reads returned incorrect/zeroed bytes following truncates and unaligned writes.
Root Causes & Fixes
1. FUSE Client Partial Chunk Handling:
- In
ObjectFS.Write, previously only writes with non-zero chunk offsets (offset % cs != 0) checked if the chunk was present in cache. Writes starting at chunk boundaries with length smaller than chunk size, or writes spanning across chunk boundaries whose end chunk was not fully overwritten, did not load existing data from the controller when the chunk was absent from local cache.WriteAtsubsequently allocated empty zero-filled buffers, erasing existing content outside the written span.- Updated
ObjectFS.Writeto check all chunks spanned by the write and load any non-fully overwritten chunk from the controller if not present inNodeCache.2. FUSE
NodeCacheChunk / Data Discrepancy & Invalidation:- In
NodeCache,GetRangepreviously checkedlen(entry.Data) > 0and returned zeros for offsets beyondlen(entry.Data), bypassing cached chunks inentry.Chunks.- Updated
NodeCachesoentry.Chunksis the single authoritative store for range queries, andPutslices data intoentry.Chunks.- After a successful
TruncateFileRPC inObjectFS.SetAttr, marked the cache entry clean (fs.cache.MarkClean).3. Controller Inode Upload & Chunk Loading Synchronization:
- Replaced WaitGroup-based inode upload tracking in
Volumewith condition-variable reference counted tracking to safely coordinate concurrent writes, truncates, and reads on the same inode without race conditions or premature deletions.- Added upload synchronization to
Volume.WriteFileto ensure blob uploads from earlier writes complete before subsequent writes read or overwrite chunk contents.- Added
ChunksLoadedtracking toCachedInodeto guarantee that allFileChunkrows are loaded from the metadata store before updating chunks inVolume.WriteFile.4. POSIX Gate Multi-Seed fsx & Artifact Collection:
- Updated
dev/ci/presubmits/ap-posixto runfsxacross 5 seeds (42, 1337, 2026, 777, 9999) with 1000 ops each.- Copied failure artifacts (
.fsxops,.fsxgood) to$ARTIFACTS. (Note: whenap generateingke-labs/gke-labs-infrais updated, theap-posixworkflow job can upload$ARTIFACTSas well).Testing
TestFUSETruncateAndUnalignedWriteWithCacheInvalidationinpkg/objectfs/fuse/fuse_test.go.TestTruncateAndWriteOrderingWithDelayedUploadsinpkg/objectfs/controller/service_test.go.pjdfstestinap-posixin Docker; all passed cleanly.ap-lint,ap-build,ap-test,ap-posix) pass.Fixes #170