[PATCH] Fix CTDB protocol marshalling

Amitay Isaacs amitay at gmail.com
Mon Aug 28 13:22:21 UTC 2017


On Mon, Aug 28, 2017 at 9:32 PM, Volker Lendecke <Volker.Lendecke at sernet.de>
wrote:

> 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.
>

If required, yes, we can.  Question is whether it's needed now, or it can
wait.

I would very much like to focus my energy on splitting the main daemon to
get rid of the (single process single thread) performance bottleneck.

Amitay.


More information about the samba-technical mailing list