FEAT: streamed upload with checksum in `StorageBackend.put_file`
Maintainer antworten meist innerhalb von 5 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start in src/datajoint/storage.py at StorageBackend.put_file and the companion safe_copy path to see how the file and s3 stores currently copy bytes. The issue leaves the API shape open, so first settle whether checksum returns a digest or takes an expected value, then trace how each backend writes and moves files. Done means a single-read streamed copy with mismatch rejection, no leftover file, and tests covering both the file and s3 backends.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Feature Request
Problem
We keep large raw recordings (often tens of GB) in a <filepath@store> column, at a content-addressed
path sha256/ab/<sha256>. The same code writes to a file store on lab servers and an s3 store
centrally. With StorageBackend.put_file we must read each file twice (hash it, then copy it) and
cannot check that the stored bytes are the ones we hashed: if the source changes between the two reads,
the store holds other bytes under that hash. DataJoint's hash-addressed codecs avoid this only by
holding the whole value in memory (<attach@> reads the full file), which does not work for large files.
Requirements
put_filecan compute a checksum while it copies, reading the source once, and return it, e.g.
digest = backend.put_file(src, dest, checksum="sha256").- It can check an expected checksum and refuse a mismatch without leaving the file in place, e.g.
backend.put_file(src, dest, checksum=("sha256", expected_hex)). fileprotocol: write to a unique temp file and move it into place only when the checksum matches.s3: send the checksum as an S3 additional checksum (x-amz-checksum-sha256) so the server
rejects a mismatch, or upload to a temp key and copy it into place.
Justification
- Large files go into a store once, checked, without reading them twice.
- Content-addressed layouts (any path derived from a hash) become safe with DataJoint's own backend,
instead of each project writing its own copy-and-check code. <attach@>and<hash@>could then stream large files instead of reading them into memory.
Alternative Considerations
Our workaround: hash the file, put_file it, compare the stored size, and audit later by re-reading
the stored copy. This misses a same-size change between the two reads. Writing our own streamed copy
on fsspec works, but duplicates what StorageBackend is for.
Related Errors
None: without the feature, a mismatch goes unnoticed.
Screenshots
n/a
Additional Research and Context
StorageBackend.put_file:src/datajoint/storage.py(v2.3.6 andmaster); no checksum option.- The
filepath goes throughsafe_copy, see the companion issue onsafe_copy/os.replace. - No open issue or PR found for checksums in
put_file. - Would a PR along these lines be welcome, and which API shape do you prefer?
- Vorherrschende Sprache
- Python
- Sterne
- 198
- Forks
- 107
- Ø Merge
- 4 T. 7 Std.
- Gemergte PRs (30 T.)
- 12
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus datajoint/datajoint-python
-
bug triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
datajoint/datajoint-python#1775 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
MySQL: with use_tls=False, 2.3.6 needs the cryptography package to log in to MySQL 8Evtl. vergeben @dimitri-yatsenko hat das vor 5 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
datajoint/datajoint-python#1750 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
datajoint/datajoint-python#1747 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Reject constant defaults on primary-key attributesEvtl. vergeben @godara-alt hat das vor 4 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
datajoint/datajoint-python#1712 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Decoding a <blob> value in an unknown format returns None instead of raising an errorEvtl. vergeben @godara-alt hat das vor 9 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
datajoint/datajoint-python#1703 ·
Maintainer antworten meist innerhalb von 5 Tagen
Alle Issues in datajoint/datajoint-python
Ähnliche Issues
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)Evtl. vergeben @gouyu-hou hat das heute übernommen. Offentriage/confirmed
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
agentscope-ai/agentscope#4397 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
NousResearch/hermes-agent#161712 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[New Check]: postgresql_flexible_server_public_network_access_disabledEvtl. vergeben @pouria-l hat das heute übernommen. Offenfeature-request status/needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
prowler-cloud/prowler#13615 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
SACGF/variantgrid#2941 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
linkedin/Liger-Kernel#1730 ·
Maintainer antworten meist innerhalb von 3 Tagen