From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id E40A627C2E for ; Thu, 19 Jul 2018 23:20:49 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o-eUs40w5MyH for ; Thu, 19 Jul 2018 23:20:49 -0400 (EDT) Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 27D3427C05 for ; Thu, 19 Jul 2018 23:20:49 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH] sql: xfer optimization issue From: "n.pettik" In-Reply-To: Date: Fri, 20 Jul 2018 06:20:41 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <5BB99B27-5F86-4664-AAD5-57A22ECED854@tarantool.org> <93E4DAEA-EF90-479D-9F62-3D1CEB3CBE3F@tarantool.org> <20180628101839.fhnijezdpwviohop@tkn_work_nb> <20180709155006.fwrikbznqk23ger5@tkn_work_nb> <79D03E96-0BD0-418D-9DB2-45318C734628@tarantool.org> <8B8D5501-075D-4BEB-B282-35B0B81CD555@tarantool.org> <605B15EF-BD1C-4B03-8A9F-6E6225076812@tarantool.org> <12B62C73-9BEC-49FA-B3FD-590C445CF25B@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: "N. Tatunov" Several minor remarks. > @@ -1885,12 +1881,11 @@ xferOptimization(Parse * pParse, /* = Parser context */ > =20 > /* > * Xfer optimization is unable to correctly insert data > - * in case there's a conflict action other than *_ABORT. > - * This is the reason we want to only run it if the > - * destination table is initially empty. > + * in case there's a conflict action other than > + * explicit *_ABORT. This is the reason we want to only > + * run it if the destination table is initially empty. > * That block generates code to make that determination. > */ > - > if (!(onError =3D=3D ON_CONFLICT_ACTION_ABORT && > is_err_action_default =3D=3D false)) { AFAIK we don=E2=80=99t use =3D=3D false comparison. Instead simply use ! = is_rr_action_default. > addr1 =3D sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0); > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > index 5f9bc13..bc169d9 100644 > --- a/src/box/sql/vdbe.c > +++ b/src/box/sql/vdbe.c > @@ -4009,7 +4009,7 @@ case OP_RowData: { > u32 n; > =20 > #ifdef SQLITE_TEST > - if (pOp->p5 =3D=3D 1) { > + if (pOp->p5 =3D=3D OPFLAG_XFER_OPT) { Flags are usually tested with & operation: if (pOp->p5 & OPFLAG_XFER_OPT !=3D 0) > pOp->p5 =3D 0; > sql_xfer_count++; > } > diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua = b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua > index 34f603f..29f0efe 100755 > --- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua > +++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua > @@ -1,9 +1,29 @@ > =20 > +local function do_xfer_test(test_number, return_code) > + test_name =3D string.format("xfer-optimization-1.%d", = test_number) > + test:do_test( > + test_name, > + function() > + if (aftr - bfr =3D=3D 1) then > + return {1} > + end > + if (aftr =3D=3D bfr) then > + return {0} > + end You can simplify it to: return aftr - bfr; :) Also >+ /* The Vdbe we're building*/ >+ Vdbe *v =3D sqlite3GetVdbe(pParse); Use =E2=80=99struct=E2=80=99 modifier for complex types. And put dot at the end of comment.