[PATCH] Fix CTDB protocol marshalling

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Aug 28 11:32:37 UTC 2017


On Mon, Aug 28, 2017 at 06:10:02PM +1000, Amitay Isaacs via samba-technical wrote:
> Hi,
> 
> The CTDB protocol (client-server over unix domain socket & server-server
> over TCP socket) has been structs on wire.  This has few drawbacks:
> 
> - The sizes of the structures vary between 32-bit and 64-bit
> - The protocol is not endian-neutral
> 
> Both are not such a big issues nowadays with majority of platforms are
> little-endian 64-bit.  Still there is still a concern over sending
> uninitialized (padding) bytes over wire.
> 
> The new CTDB code (mostly client and little bit of server code) uses
> protocol abstraction layer (ctdb/protocol/*.[ch]).  This gives an
> opportunity to fix (and improve) protocol marshalling without affecting the
> rest of the code.  The protocol marshalling code so far has been writing
> structs on wire.  It had following API for ctdb data types:
> 
>   size_t TYPE_len(TYPE *in);
>   void TYPE_push(TYPE *in, uint8_t *buf);
>   int TYPE_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx, TYPE
> **out);

Can we get the option to pull with callbacks without using talloc? If
there's one performance tarpit, it's malloc.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de



More information about the samba-technical mailing list