DESCRIPTION

JCBC-1098 : N1qlQueryExecutor is allocating twice the memory it needs

Motivation
----------
When the netty ByteBuf is not backed by a byte array.
N1qlQueryExecutor#executeQuery is allocating the byte array twice.
the first time in TranscoderUtils#byteBufToByteArray
the second with Arrays#copyOfRange

Modifications
-------------
this patch add a specialized version of
TranscoderUtils#byteBufToByteArray (copyByteBufToByteArray) that only
call Arrays#copyOfRange if the ByteBuf is backed by a byte array.

Result
------
greatly reduce the n1ql memory allocation

Change-Id: I96e22d864fbb527f3d0cf2448d741e9d6965d387
Reviewed-on: http://review.couchbase.org/82004
Tested-by: Natasha Sullivan xxx@xxx.xxx
Reviewed-by: Carmen Buckley xxx@xxx.xxx


COMMENTS

author: Natasha Sullivan
date: 2017-08-09 15:45:02.097000000

Change has been successfully cherry-picked as 6e75290646accbb0c998e47724d2b4aa3c2af53b by Natasha Sullivan

-------------------------------------
