Repository navigation
Integrity: count chunked annex objects as present - #1651
bruAristimunha wants to merge 1 commit into
Conversation
Datasets uploaded through a chunked special remote (nm000276, chunk=1GiB) hold only '<key>-S<chunksize>-C<n>' objects in S3, never the plain key. isKeyPresentAtDeclaredSize (backend import-integrity.ts and its CLI twin in s3-server-copy.ts) looked up the plain key only, so verifyDatasetVersionS3 reported every such file missing, data_complete stayed 0 and 'nemar dataset status' printed 'incomplete' although every byte was in the bucket; the CLI fleet/recovery tools inherited the same false 'missing'. A key is now also present when every chunk C1..Cn exists at the size chunking gives it (chunk size for 1..n-1, the remainder for the last). A missing or short chunk still counts as absent. The chunk index is built once per listing. Serving chunked objects through the data plane (the 404 part of nemarOrg#1565) is not addressed here.
|
Thank you for this fix and for tracing the chunk key format so carefully. It is merged into the integration branch for epic #1671 as PR #1674, with your commit kept (595b384 on that branch, authored by you). The review added commits on top, so this PR is closed in favor of that one. What the review added: the key logic now lives once in The epic merges into |
Problem
Datasets uploaded through a chunked special remote (nm000276,
chunk=1GiB) hold only<key>-S<chunksize>-C<n>objects in S3, never the plain key.isKeyPresentAtDeclaredSize(backendimport-integrity.tsand its CLI twin ins3-server-copy.ts) looked up the plain key only, soverifyDatasetVersionS3called every such file missing,data_completestayed 0 andnemar dataset statusprinted "incomplete" although every byte is in the bucket. The CLI fleet/recovery checks inherited the same false "missing".Change
C1..Cnexists at the size chunking gives it: chunk size for 1..n−1, the remainder for the last, one chunk for an empty file. A missing or short chunk still counts as absent.-m<mtime>keys are handled.Not in this PR: serving chunked objects through the data plane /
manifest.jsonURLs (data-router.ts), the 404 half of #1565. That needs a decision (stream-concatenate the chunks, or re-upload unchunked), so #1565 stays open. After merge, nm000276'sdata_completeupdates on the next integrity sweep.Part of #1565
Testing
test/chunked-key-availability.unit.test.tsandbackend/test/import-integrity-chunked.test.ts(new, 15 tests across both copies): a key stored only as complete chunks is present; a missing or short chunk makes it absent; an empty file as one empty chunk; a truncated plain object rescued by a complete chunk set (not the reverse); the chunk index following a listing that grows;keysWithoutObjectsandcompareManifestToListingon a fully chunked dataset and one missing a chunk.Files that import the changed modules, on current
dev: CLI 13 files, 236 pass, 4 skip, 0 fail; backend 7 files, 135 pass, 0 fail.bun run typecheck,biome checkon the changed files.CI
api-testandintegration-devfail on this PR because it comes from a fork: both call the dev API with theTEST_*_API_KEYsecrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass.lint,unit-pureande2e-sandboxrun normally.