Skip to main content

decompress_remote_write_body

Function decompress_remote_write_body 

Source
pub(crate) async fn decompress_remote_write_body(
    is_zstd: bool,
    body: &[u8],
    limiter: &ServerMemoryLimiter,
) -> Result<ChargedBuffer>
Expand description

Decompresses a remote-write body with the codec selected by is_zstd, bounded by the hard decoded-size cap and charged to the aggregate request-memory limiter.

Due to vmagent’s limitation there is a chance that vmagent sends the content-encoding header wrong, so decoding falls back to the other codec when the first attempt fails on malformed input. Size-limit and quota errors are final: the body either expanded beyond the cap under the declared codec, or it could not be admitted, and the other codec cannot produce a different outcome.

see https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5301 see https://github.com/GreptimeTeam/greptimedb/issues/3929