← Back to Pull requests

Publish S3 dataset cache files atomically #745

Closed
unknown closed this pull request without merging on Oct 12, 2026 05:38 UTC
View on GitHub
unknown unknown commented on Oct 10, 2026 22:13 UTC
Author

Summary

Fix a shared-cache race in the benchmark dataset loader's S3 download path.

Currently, S3 downloads write directly to the final cache filename. ensureFileAvailable accepts an existing path as a cache hit, so another process can use a partially downloaded file. A killed process can leave that partial file at the cache name. Failed attempts also delete the shared destination, potentially removing another process's completed download.

Each S3 attempt now downloads to a unique temporary file in the destination directory. After completion and the existing content-length check, it atomically renames that file to the cache path. Failures delete only their own temporary file. HTTP already uses atomic publication and is unchanged.

This is based on current main 056d93c2. It changes the examples dataset loader only.

Validation

  • Added deterministic tests with controlled S3 transport, exercising the real cache, retry, validation and publication code without an external service.

  • On unmodified main, the partial-file visibility and concurrent-cache-hit tests fail.

  • With this fix, tests verify that partial files remain unpublished, a failed concurrent attempt cannot delete a successful publication, and invalid-length retries clean up their private files.

  • Maven loader suite: 75 tests passed (72 existing + 3 new).
  • mvn -Pjdk20 -pl jvector-examples -am \
      -Dtest=DataSetLoaderSimpleMFDTest,TestDatasetDownloadPublication \
      -Dsurefire.failIfNoSpecifiedTests=false test
    

    Limits

    Concurrent callers may still download the same object independently; publication is atomic rather than serialized by a new locking mechanism. Hard termination may leave an ignored temporary file. Existing cached files are not retroactively validated, so previously interrupted downloads should be removed before reuse.

    A bug-fix release note is included.

    Diff: 239 lines (+179 / -60) across 2 files Reviewer: MarkWolters Review duration: 1885m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 239 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.328
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #745"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.7% · Safe to merge
    14.7%