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 4CA6022972 for ; Wed, 18 Jul 2018 04:04:42 -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 PHamqtOMrlWX for ; Wed, 18 Jul 2018 04:04:42 -0400 (EDT) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (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 068932294B for ; Wed, 18 Jul 2018 04:04:41 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 4/4] sql: get rid of Column structure References: <4f4e7934d0eac2f295adadb1e5572f8ff4dbf752.1531743627.git.kshcherbatov@tarantool.org> <69de35d4-3e7d-6f9f-8181-05b06c577e6b@tarantool.org> <9b1796b0-744a-4cc2-1011-9e6a091a6e90@tarantool.org> <5a90417c-f742-7a07-dc3d-a3a0646ec05f@tarantool.org> <5c05ec08-b32b-0ddb-f87e-25d86145ea9f@tarantool.org> <64852e2e-a07a-e86c-ad93-c17c6f55a0aa@tarantool.org> <55a87410-6db0-f51f-722a-6e9cb8795341@tarantool.org> From: Vladislav Shpilevoy Message-ID: <9660d72c-ff5d-a39e-de95-aebe7007f0e7@tarantool.org> Date: Wed, 18 Jul 2018 11:04:37 +0300 MIME-Version: 1.0 In-Reply-To: <55a87410-6db0-f51f-722a-6e9cb8795341@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Kirill Shcherbatov , tarantool-patches@freelists.org, Nikita Pettik LGTM. Nikita, please, review. On 18/07/2018 10:25, Kirill Shcherbatov wrote: >> 1. Please, rebase on the latest 2.0 and use pk->def + key_def_find. > - if (index_has_column(pk, pNew->def->field_count - 1)) { > + assert(pk != NULL); > + struct key_def *pk_key_def = pk->def->key_def; > + if (key_def_find(pk_key_def, pNew->def->field_count - 1) != NULL) { > >> 2. As I said verbally, you should not add this redundant scan of primary >> index columns. You already have the primary index scan in >> convertToWithoutRowidTable, that is called few lines above. >> >> When you merge this scan into convertToWithoutRowidTable, you can >> inline the rest of the function into EndTable and remove it together >> with index_has_column. > I can't understand your suggestion. > convertToWithoutRowidTable iterates by index field; > but this check is a about field with ON CONFLICT REPLACE could be only a part > of index. We iterate over all fields. > > I've get rid off index_has_column. > > if (field->nullable_action == ON_CONFLICT_ACTION_REPLACE && > - !index_has_column(pk, i)) > + (pk == NULL || key_def_find(pk->def->key_def, i) == NULL)) > > > -bool > -index_has_column(struct Index *index, uint32_t column_idx) > etc. >