Files
0a6cb3b4cf [Raw payloads]: read payload as stored bytes in retrieve_raw (#10040)
* segment: read payload as stored in retrieve_raw

`retrieve_raw` already hands back vectors as stored; let the caller ask for the
payload the same way, so a reader that only relocates a point parses nothing.
`RawPayloadFormat` states what the caller wants — no payload, parsed, or as
stored — and replaces the `WithPayload` argument, which could express a key
selection that a raw read cannot serve anyway.

[`MaybeRawPayload`] states what came back, which can differ from the request in
one direction only: a payload storage that keeps payloads parsed cannot answer
`Raw` with a blob, and now says so instead of encoding a payload for a reader
that would parse it straight back.

The raw path reaches the blobstore through `read_payloads_maybe_raw`, mirroring
`read_payloads` down the payload storage and payload index traits, so it keeps
the batched read.

Every caller asks for `Parsed`, so this changes no behaviour: the copy-on-write
move and the sync comparison need the parsed payload anyway, and the shard
transfer switches over with the feature flag that ships the blob to another
node.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* segment: always hand out the stored payload blob from retrieve_raw

Review follow-up: instead of telling `retrieve_raw` in which form to
return the payload, it always returns it as stored and a caller that
needs the parsed form decodes it itself.

- Drop `RawPayloadFormat` and the payload parameter it replaced: no
  production caller ever asked for anything but the whole payload, and
  a selector cannot be applied to an opaque blob anyway.
- Drop `MaybeRawPayload` / `MaybeRawPayloadRef`: only
  `InMemoryPayloadStorage` could produce the parsed variant, and no
  segment can be built with that storage (`PayloadStorageType` is
  `Mmap` or `InRamMmap`, both blobstore-backed). `SegmentRecordRaw`
  carries a plain `Option<RawPayload>`.
- `PayloadStorageRead::read_payloads_maybe_raw` becomes
  `read_payloads_raw` and hands out `Option<&[u8]>`. The in-memory
  storage keeps payloads parsed, so it encodes on read, producing the
  bytes an on-disk storage would have written.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* api: decode a received raw payload with the shared decoder

`decode_payload` at the gRPC boundary matched on the encoding and parsed
the blob itself, duplicating `RawPayload::decode`. Add the inbound
conversion from the wire type and let the one decoder do the reading, so
another encoding has a single place to be taught.

The conversion also rejects an encoding number no variant maps to, which
prost would otherwise hand out as the default encoding — a blob from a
node that writes payloads some other way must not be read as JSON.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* simplification

---------

Co-authored-by: Ivan Pleshkov <ivan.pleshkov@qdrant.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 16:26:52 +02:00
..
2026-08-03 11:20:34 +02:00