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 779952E931 for ; Sat, 11 May 2019 08:15:46 -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 R5mfi8o8J-io for ; Sat, 11 May 2019 08:15:46 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 34D922E92E for ; Sat, 11 May 2019 08:15:46 -0400 (EDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_56A059C8-A926-415E-BE7C-E8E3B4BB76A6" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [tarantool-patches] Re: [PATCH v3 2/3] box: run check constraint tests on space alter From: "n.pettik" In-Reply-To: <1557251257.268416019@f459.i.mail.ru> Date: Sat, 11 May 2019 15:15:43 +0300 Message-Id: References: <4f44a278-a591-4fbf-b2fa-8cb50200d4b0@tarantool.org> <20190507163948.GC10365@atlas> <1557251257.268416019@f459.i.mail.ru> 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: Kirill Shcherbatov , Konstantin Osipov --Apple-Mail=_56A059C8-A926-415E-BE7C-E8E3B4BB76A6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 7 May 2019, at 20:47, Kirill Shcherbatov = wrote: >=20 > ; > > + if (sql_bind_decode(&bind, i + 1, &new_tuple) !=3D 0 || > > + sql_bind_column(ck_constraint->stmt, &bind, i + 1) !=3D 0) { > > + diag_set(ClientError, ER_CK_CONSTRAINT_FAILED, > > + ck_constraint->def->name, > > + ck_constraint->def->expr_str); > > + return -1; > >This looks like a pessimization to me. Depending on the >code flow, > >some of the tuple fields may not be accessed at all. Is it >really > >necessary to decode them so agressibvely here?=20 > >Especially since > >you encode *all* space fields. >=20 > I'll try to walk though the AST tree and prepare the map of fields = that are involved in expression (on check compile operation); > Here there would be binding of **used** fields. >=20 > What do you think? >=20 To be honest, I don=E2=80=99t get what Konstantin really meant in his = next letter. I=E2=80=99m ok with your approach. --Apple-Mail=_56A059C8-A926-415E-BE7C-E8E3B4BB76A6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 7 May 2019, at 20:47, Kirill Shcherbatov <kshcherbatov@tarantool.org> wrote:

;
> + if (sql_bind_decode(&bind, i + 1, &new_tuple) !=3D= 0 ||
> +     = sql_bind_column(ck_constraint->stmt, &bind, i + 1) !=3D 0) {
> + diag_set(ClientError, = ER_CK_CONSTRAINT_FAILED,
> + ck_constraint->def->name,
> + ck_constraint->def->expr_str);
> + return -1;
>This looks like a pessimization to me. Depending on the >code = flow,
>some of the tuple fields may not be accessed at all. Is it = >really
>necessary to decode them so agressibvely here?
>Especially since
>you encode *all* space fields.

I'll try = to walk though the AST tree and prepare the map of fields that are = involved in expression (on check compile operation);
Here there would be binding of **used** fields.

What do you think?

To be = honest, I don=E2=80=99t get what Konstantin really meant in his next = letter.
I=E2=80=99m ok with your approach.

= --Apple-Mail=_56A059C8-A926-415E-BE7C-E8E3B4BB76A6--