Skip to content

Upload: verify every annexed file reached S3 and stop re-reading annexed content on save - #1647

Closed
bruAristimunha wants to merge 1 commit into
nemarOrg:feature/issue-1671-epic-bru-upload-fixesfrom
bruAristimunha:fix/issue-1642-upload-copy-verify-save
Closed

bruAristimunha wants to merge 1 commit into
nemarOrg:feature/issue-1671-epic-bru-upload-fixesfrom
bruAristimunha:fix/issue-1642-upload-copy-verify-save

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#1642: on nm000358 (165 data files, 1.6 TB, 0.10.13) a resumed upload printed "Uploaded 0 data files to S3" although git-annex recorded all 165 keys at nemar-s3 during that copy, and then spent hours in "Saving dataset changes".

  • copyToAnnexRemote counted copy … ok lines in git-annex's human-readable output.
  • The post-copy check only looked at this run's addTargets that happened to be annexed, so a data file git-annex did not annex, or an annexed file left from an earlier run, passed without being checked.
  • git annex add stages unlocked files with zero stat data (git ls-files --debug shows ctime: 0:0), so the following git add -A streams every annexed file through git-annex filter-process. That is the save-step stall in the 2026-09-18 comment on Bound git-annex add concurrency during dataset upload #1455; on nm000358 it re-read about 1.6 TB.

Change

  • copyToAnnexRemote / copyPathsToAnnexRemote run git annex copy --json --json-error-messages and count success records; per-file failure messages come from the JSON.
  • The S3 step copies exactly the annexed paths the location log says are not yet at nemar-s3, and afterwards requires every annexed file in the dataset to be recorded there; otherwise the upload fails and lists them.
  • A data file above 100 KB that git-annex did not annex (policy overridden, e.g. by an inherited .gitattributes) fails the upload before anything is copied. Smaller ones (for example X.EDF, which the CLI matches case-insensitively and git-annex does not) are reported only.
  • saveDataset(…, { skipContentCheckPaths }) marks the annexed paths assume-unchanged around git add -A / status / commit and clears the flag afterwards. Deleted paths are not masked, so their removal is still staged.
  • The success line states totals: "Uploaded N …; M already there; all T verified at the remote", or "All T data files were already on S3".

Behavior to know about

  • Save time on Ceph, small files. In one benchmark on a Ceph filesystem (600 × 120 KB annexed .edf + 600 JSON, git 2.53, git-annex 10.20260717) the save step took 33.5 s with this change vs 6.6 s without. Locally with 2000 × 120 KB it was faster (1.47 s vs 2.4 s, two repeats each), and for large files it removes the re-read entirely (metered test below; nm000358 re-read ~1.6 TB at ~177 MB/s). The Ceph number is a single run made while another job was writing to the same filesystem, so I treat it as unexplained, but it should be re-measured on a ~15k-small-file tree before merge. If it holds, the obvious adjustment is to apply skipContentCheckPaths only to annexed files above a size threshold (re-reading a 120 KB file is cheap; re-reading TBs is the problem). Happy to make that change if you prefer it up front.
  • The CLI still cannot recover by itself when main gained unrelated commits (the adjusted branch is not rebased, clone-push.ts:155). On nm000358 that came from the availability-report sweep; that is Availability report: the sweep creates main as a root commit on a dataset that was never pushed #1643, fixed separately.

Closes #1642
Part of #1455 (the save step; the tracking step is in a separate PR)

Testing

  • test/upload-copy-verify.unit.test.ts (new, 12 tests): real git-annex with a directory special remote. JSON copy counting; a file already at the remote is not re-sent and is counted as present; an annexed file from an earlier run missing at the remote fails the upload; a large non-annexed data file fails before copy; a small one is reported only; the save step through a tee'd filter-process reads 4+ MiB without the change and under 64 KiB with it, and the commit is identical in both cases.

  • Related suites (upload, transfer, finalize, clone-push, export surface): 225 pass, 0 fail across 15 files that import the changed modules (on this branch rebased on current dev).

  • bun run typecheck, biome check on the changed files.

  • Full bun test on this branch plus the STS PR stacked on it (before rebasing on current dev): 10275 pass / 21 fail; the failing tests are the same set that fails on main on the same machine (macOS bash 3.2 completion tests, timing bounds, two auth login signal tests, two admin users render tests), plus one worktree-only node_modules resolution error in a backend file this branch does not touch.

  • Not run against real S3; the remote in the tests is a directory special remote.

  • Save-step timing on a 15k-file Ceph tree (see above).

  • CI api-test and integration-dev fail on this PR because it comes from a fork: both call the dev API with the TEST_*_API_KEY secrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass. lint, unit-pure and e2e-sandbox run normally.

- git annex copy is driven with --json --json-error-messages; filesCopied
  counts success records instead of scraping 'copy ... ok' lines (nm000358
  logged 'Uploaded 0 data files' while all 165 keys were recorded at
  nemar-s3 during that copy).
- The copy set is taken from the location log (annexed paths not yet at
  nemar-s3), and the post-copy check now requires EVERY annexed file to be
  recorded at the remote, not only this run's targets.
- A data file larger than the annex size threshold that git-annex did not
  annex (policy overridden, e.g. an inherited .gitattributes) now fails the
  upload instead of being committed to git silently.
- saveDataset takes skipContentCheckPaths; the upload's save step marks the
  annexed paths assume-unchanged around git add -A/status/commit so git does
  not stream every freshly annexed unlocked file through git-annex
  filter-process (zero-stat index entries after git annex add). Refs nemarOrg#1455.
- The success line states sent / already-present / verified totals.
@neuromechanist

Copy link
Copy Markdown
Contributor

This original source PR is superseded by replacement PR #1677 in epic #1671. The full integration into dev is tracked by epic PR #1702. Closing the original PR so the merged replacement remains the single landing path.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants