Skip to content

Cache upload checksums to skip uploaded files without reading them - #943

Merged
caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:cache-upload-checksums
Oct 30, 2026
Merged

caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:cache-upload-checksums

Conversation

@caglarpir

@caglarpir caglarpir commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

upload looks up the upload history by the checksums of the files, so it read every file in full before it could skip an already uploaded sequence or video. A run that skips 10,000 images, or a long video, read all of it first.

This caches each file's checksum in the upload history folder (checksum_cache), keyed by its path, size and modification time, like rsync's quick check:

  • A file whose key is unchanged is not read again: 10,000 cached files are looked up in about 0.1 s.
  • Entries expire after 30 days, which only bounds the size of the cache.
  • The cache is used only when the upload history is (so not in dry runs, unless history is enabled for them). It is written in one transaction per sequence, using Clear expired upload cache entries in one transaction #941's transactions; a cache that can't be opened or written gives a warning, and upload goes on without it.
  • Checksums given in the description file are used as before.

process still doesn't compute checksums: #725 removed that from it to keep it fast.

Example, upload --dry_run twice with history enabled. The second run skips everything at once, with no checksum bars:

==> Uploading...
UploadedAlready: Skipping sequence_0, already uploaded a second ago (2026-10-28 15:57:50)
UploadedAlready: Skipping sequence_1, already uploaded a second ago (2026-10-28 15:57:50)
UploadedAlready: Skipping sequence_2, already uploaded a second ago (2026-10-28 15:57:51)

Tests: unit tests for KeyValueStore.set_many (one transaction), PersistentCache.get_many/set_many, and _update_md5sums with a cache (unchanged file taken from the cache without reading it; changed size read again). Also checked by hand with images and a GoPro video, process then upload --dry_run twice.

@meta-cla meta-cla Bot added the cla signed label Oct 28, 2026
upload looks up the upload history by the checksums of the files, so
it read every file in full before it could skip an already uploaded
sequence or video: a run that skips 10,000 images or a long video read
all of them first.

Cache the checksum of each file in the upload history folder, keyed by
its path, size and modification time, as rsync's quick check is. A file
whose key is unchanged is not read again: 10,000 cached files are
looked up in about 0.1 s. Entries expire after 30 days, which only
bounds the size of the cache. The cache is used only when the upload
history is, and is written in one transaction per sequence.

process does not compute checksums, as mapillary#725 removed that from it to
keep it fast.
@caglarpir
caglarpir force-pushed the cache-upload-checksums branch from 43b3814 to c3e3813 Compare October 30, 2026 09:20
@caglarpir
caglarpir merged commit a57cac3 into mapillary:main Oct 30, 2026
30 of 31 checks passed
caglarpir added a commit to caglarpir/mapillary_tools that referenced this pull request Oct 30, 2026
- A track assumed to start with a video without GPS is never refused
  for its length, in process or in sampling, and the creation time is
  never used to place it: a MapillaryGPXAlignmentWarning says when the
  track and the video differ in length (mapillary#944). Only
  --interpolation_use_gpx_start_time still refuses a long track.
- A file that a GPX or NMEA track missed fails with the miss when no
  later source geotags it (mapillary#938).
- The process report lists the geotagging warnings (mapillary#945).
- upload caches the checksums of the files, and shows progress while
  computing them (mapillary#942, mapillary#943).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant