]> dgit.raspbian.org Git - dovecot.git/commit
[PATCH 07/12] lib-index: Add keyed xxh64 strmap format v2, gated by config version
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 30 Apr 2026 12:11:57 +0000 (12:11 +0000)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
commit6a450a45f1ca4726d2720fb48db6f83989e002fd
tree678ecd02fdb295e7617ca4d6fb42a81c36e3f713
parenta54d4beb53a1c2e6d907d0054ede146e09b204d8
[PATCH 07/12] lib-index: Add keyed xxh64 strmap format v2, gated by config version

The on-disk hash stored in the strmap file is now optionally a keyed
xxh64_to_32() with a per-file random 64-bit IV stored in the file
header.  This replaces the previous plain crc32_str_nonzero() output
and hardens the strmap against deliberately-collided message-id
hashes.  The v1 (crc32) format remains fully readable and writable
so older configurations keep working without forced rebuilds.

On-disk:
 - v1 header is 8 bytes: version, 3 unused, uid_validity (unchanged).
 - v2 header is 16 bytes: version, compat_flags, 2 unused, uid_validity,
   hash_iv.  The first 8 bytes of v2 align with v1 byte-for-byte, so
   the open path reads 8 bytes, dispatches on version, and reads the
   trailing 8 bytes only for v2.

Runtime:
 - strmap->enable_xxh64 selects the format used when creating a new
   file (or recreating one whose uid_validity has changed).
 - view->format_version follows the on-disk file when one exists; for
   fresh files it follows the strmap-wide preference.
 - Renumber recreate_write() preserves view->format_version, so we
   never silently migrate an existing file across the threshold while
   it is still in use - the migration only happens at open time.
 - When enable_xxh64 is TRUE and the on-disk file is v1, open treats
   it as a version mismatch: the file is unlinked and the next sync's
   recreate_write() produces a v2 file.  Below the threshold v1 stays
   v1 indefinitely.
 - strmap_hash_str() dispatches per-view, so v1 files keep using
   crc32 hashes and v2 files use keyed xxh64 even in mixed setups.

Gbp-Pq: Name 0007-lib-index-Add-keyed-xxh64-strmap-format-v2-gated-by-.patch
src/lib-index/mail-index-strmap.c
src/lib-index/mail-index-strmap.h
src/lib-master/Makefile.am
src/lib-master/storage-version.h [new file with mode: 0644]
src/lib-storage/index/index-thread.c