Alignment in the binary protocol
Aaron Stone
aaron at serendipity.cx
Tue Mar 18 18:10:02 UTC 2008
On Mar 18, 2008, at 10:30 AM, Dustin Sallings wrote:
>
> On Mar 18, 2008, at 4:59, Trond Norbye wrote:
>
>> Hi,
>>
>> I have been testing the binary protocol the last few days and I
>> would like to suggest that we swap the order some fields to solve
>> some alignment problems.
>>
>> The cas-id is a 64-bit datatype and will require 8-byte alignment
>> on some hardware, but it is placed on a 4-byte alignment in the
>> get response. The current get-response contains a 16 byte header
>> followed by the 4 byte flags-field causing the wrong alignment for
>> the cas id. If we swap the order on the two fields the cas-id will
>> get proper alignment, and we can access the field directly as an
>> uint64_t...
>>
>> To be consistent I suggest that we move the cas-id to the front in
>> the set/add/replace command as well. The attached patch implements
>> this.
>
>
> Hey, could I get you to merge this with the current binary tree?
> I did some cleanup work and it doesn't apply cleanly. Since there
> are changes to how things work, I really want to make sure I
> preserve your intentions before doing client work.
>
> As I put no effort into considering 64-bit alignment, I don't have
> any issue with this. Does anyone else?
I'm really glad someone is checking it over for alignment! Let's
definitely make the changes we need to make. Please let me know what
needs to move around, and I'll help with the documentation changes to
the protocol diagrams.
Aaron
More information about the memcached
mailing list