From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id DB0C36EC5D; Fri, 9 Apr 2021 22:52:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DB0C36EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617997958; bh=1viDEjPbcSpe6XjgXwQpHdngNMD6ahOUp7hpvoblzss=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RveqY2KUHYPK0JR9lNm267/5yqbhanPwnvTYxS0wt9adrRs3y5b/SKx0d640PXsTx NjHQ3W71f2g8HNtZa5FlYqCRYsUMTfWaRnjp0BMl4yQVzlXaKPGnOiGXd6vzcBCr9I Swia+21zRQUR8daI2iTrIXssG3QQAJkJbwNslgHo= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 30B596EC5D for ; Fri, 9 Apr 2021 22:52:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 30B596EC5D Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lUxBF-0000xb-9Z; Fri, 09 Apr 2021 22:52:37 +0300 Date: Fri, 9 Apr 2021 22:52:36 +0300 To: Vladislav Shpilevoy Message-ID: <20210409195236.GA223068@tarantool.org> References: <97cd1f47-ad52-e480-b2ff-4cf10cdc8d68@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <97cd1f47-ad52-e480-b2ff-4cf10cdc8d68@tarantool.org> X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480B1C8842CE613979723F2FB4628545A35182A05F53808504036756A4943692279DFCB0D6B3591CA92957229D26FEF663E8D72ADF84B26323D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B9FBA884A7C9B8BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371B0187663A04449C8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2EA529E6FF71022FD4ABCCE93CCB0AFB2C5BC91295CC49E52D2E47CDBA5A96583C09775C1D3CA48CFCA5A41EBD8A3A0199FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C317B107DEF921CE79117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BDC0F6C5B2EEF3D0C75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C9783151A046827958570068DC494EC0BC7860 X-C1DE0DAB: 0D63561A33F958A53E7C34962DB1187E364329E18CFCF2586E14820F0E1B0375D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C53592357E805773CB769B096D96AE27FA76A145E3583646D235A3C0E411E2A2F2CA906A24F2DC971D7E09C32AA3244CD6AC8D60C0D97A9A48EF6A5D92DAEDAF63871F383B54D9B3FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojyO2lHpuZu4QL8bLlipOoPQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822FC2742A108D537B6D6FC024912703C0E83D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 33/53] sql: introduce mem_append_to_binary() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thank you for the review! My answers below. On Tue, Mar 30, 2021 at 01:05:44AM +0200, Vladislav Shpilevoy wrote: > Thanks for the patch! > > > diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c > > index 86da1449c..2e8669138 100644 > > --- a/src/box/sql/vdbeaux.c > > +++ b/src/box/sql/vdbeaux.c > > @@ -1305,19 +1305,26 @@ sqlVdbeList(Vdbe * p) > > * has not already been seen. > > */ > > if (pOp->p4type == P4_SUBPROGRAM) { > > - int nByte = (nSub + 1) * sizeof(SubProgram *); > > int j; > > for (j = 0; j < nSub; j++) { > > if (apSub[j] == pOp->p4.pProgram) > > break; > > } > > - if (j == nSub && > > - sqlVdbeMemGrow(pSub, nByte, > > - nSub != 0) == 0) { > > - apSub = (SubProgram **) pSub->z; > > - apSub[nSub++] = pOp->p4.pProgram; > > - pSub->flags |= MEM_Blob; > > - pSub->n = nSub * sizeof(SubProgram *); > > + if (j == nSub) { > > + uint32_t size = sizeof(SubProgram *); > > + char *value = (char *)&pOp->p4.pProgram; > > + if (nSub == 0) { > > + if (mem_copy_binary(pSub, value, > > + size) != 0) > > + return -1; > > + } else { > > + assert(0); > > What is this assert? And why does not the append work on empty > binaries? > Thank you. This assert did't appear in tests because there is no two or more triggers executed one after another in tests. I used it for debugging and forgot to remove it. Fixed. Also, I reworked this part - instead of adding of a new function (mem_append_to_binary()) I used mem_concat() here. It can be seen in patch "sql: introduce mem_copy_bin()". > > + if (mem_append_to_binary(pSub, > > + value, > > + size) != 0) > > + return -1; > > + } > > + ++nSub; > > } > > } > > } > >