maria-developers team mailing list archive
Mailing list archive
Re: custom storage backend rnd_next() implementation and caching questions
On Feb 03, Andras Szabo wrote:
> Since the plugin is returning blob fields which can be large, for
> performance considerations we’ve chosen to use mmap to obtain the blob
> values. However it seems that the Field_blob::store(…) is using a
> malloc/memcopy to store the field value. In my understanding this is
> not required for the blob fields (data is represented as a ptr +
> size). Is there a method where i could bypass the copying?
I don't think so.
It copies the blob to transfer the ownership, the buffer where the
caller put the blob data can be overwritten or freed by the caller.
Which cannot happen in your case, but generally Field_blob::store
doesn't know that.
> If i can bypass the copying of course i need to keep the mmap active
> until mysql has no need for the data. Is it right that rnd_end() is
> the earliest point where i can release the mmap?
Would you really want to keep all your blobs mmapped until the end of
the table scan?
I know there were attempts to do something similar, but I haven't heard
of any successfull ones :( This is something that must be done in the
server and it isn't done yet.
But what you can do - pay attention to table->read_set and don't read
blobs at all, unless the server explicitly asks you to.