On 19/05/2025 18:49, Vlad Khorsun wrote:
> 19.05.2025 10:37, 'Mark Rotteveel' via firebird-devel:
>> On a related note, I also find it odd that the get segment response
>> even includes segment lengths, it makes reading blobs more complicated
>> client side than should be needed.
>
> It is absolutely necessary for segmented blobs if you don't want to
> get each
> segment within separate roundtrip. Current implementation receives
> buffer of up
> to 64KB of blob data that could contain many blob segments. Yes, it
> makes things
> a bit more complex, but for a good reason.
I still don't see the reason for this. The server needs to stuff the
segments into a single buffer with segment lengths anyway, so it can
just as well do the same thing _without_ including those segment lengths.
In other words, the fact that you receive multiple segments is not a
reason why the response needs to include the segment lengths. And
contrary to your claim, leaving out the segment lengths would not
necessitate only sending a single segment.
And given the server already chops up segments if needed, it doesn't
even (always) preserve the same boundaries as used on write, so getting
something a lot bigger is perfectly fine.
>> Basically the p_resp_data of a get segment response is now
[..]
>> You'd save N*2 bytes, and not require a client to extract segments
>> from the buffer.
>
> This is possible for stream blobs only and will break backward
> compatibility, as
> all existing fbclient's expects to get data buffer with segment length
> inside.
Which is why I said "while - in a new protocol or maybe a new operation
code - it could just as well be [...]"
Mark
--
Mark Rotteveel