perf(protocol): pack metadata into one frame (PROTOCOL 2.20.0)

This commit is contained in:
2026-09-13 04:08:36 +02:00
parent ddc71a7df5
commit 317d5d081a
8 changed files with 210 additions and 168 deletions
+18 -2
View File
@@ -642,8 +642,24 @@ typedef struct Config {
* anything else) is what keeps a 2.19 client and a 2.18 server from ever
* reaching that state. SECURITY: a 2.19 store holds a salted PBKDF2 verifier
* and cannot verify (and refuses to load) a legacy unsalted-SHA-256 store line,
* so an old bearer digest can never be replayed against a 2.19 daemon. */
#define PROTOCOL_VERSION "2.19.0"
* so an old bearer digest can never be replayed against a 2.19 daemon.
*
* Packed Metadata Wave: 2.19.0 -> 2.20.0.
*
* WHY the bump, grounded in the wire: metadata_send()/metadata_receive() no
* longer emit/consume the metadata as up to 12 separate per-field framed
* writes. A file's metadata now crosses the wire as ONE packed frame: a
* single int32 present flag (0 = absent, 1 = present) followed, when present,
* by the fixed FILE_METADATA_WIRE_SIZE-byte (68-byte) field record produced by
* metadata_to_buf(). A 2.19 peer would desynchronize on the removed frames
* (it would read the packed record's bytes as a stream of separate field
* frames), so the strict same-version handshake (config_receive rejects a
* mismatched version before parsing anything else) is what keeps a 2.20 client
* and a 2.19 server from ever reaching that state. The encoded field layout
* itself is unchanged (only its framing collapses), so the chunk codec, which
* already used the packed metadata_to_buf()/metadata_from_buf() codec, is
* byte-identical to before. */
#define PROTOCOL_VERSION "2.20.0"
#define DEFAULT_CHUNK_SIZE (10 * 1024 * 1024)
/* Upper bound on total basis-dir entries (rsync caps --link-dest at 20). */
#define MAX_BASIS_DIRS 64