Alignment in the binary protocol
Brian Aker
brian at tangent.org
Tue Mar 18 13:54:24 UTC 2008
Hi!
So I have not looked at the code yet concerning this bit.... Is the
code safe from byte alignment problems between different endian hosts/
clients?
Cheers,
-Brian
On Mar 18, 2008, at 4:59 AM, 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.
>
> Trond
>
> <alignment.patch.gz>
--
_______________________________________________________
Brian "Krow" Aker, brian at tangent.org
Seattle, Washington
http://krow.net/ <-- Me
http://tangent.org/ <-- Software
_______________________________________________________
You can't grep a dead tree.
More information about the memcached
mailing list