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 04B4E2219E for ; Mon, 6 Aug 2018 14:25:01 -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 SUr3xhvoEamI for ; Mon, 6 Aug 2018 14:25:00 -0400 (EDT) Received: from smtp2.mail.ru (smtp2.mail.ru [94.100.179.91]) (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 B1B972759B for ; Mon, 6 Aug 2018 14:25:00 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 2/5] schema: add new system space for FK constraints References: <83369e84-6fba-adbf-8751-2141a3e256b1@tarantool.org> <24bb9776-b33d-a68f-8738-3967ffd013ea@tarantool.org> <30b2a1cc-3e6d-e5f6-bca5-6a5e5396bc14@tarantool.org> <0DFF30FE-9BAF-4149-910A-A552D2740080@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Mon, 6 Aug 2018 21:24:58 +0300 MIME-Version: 1.0 In-Reply-To: <0DFF30FE-9BAF-4149-910A-A552D2740080@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit 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: "n.pettik" , tarantool-patches@freelists.org Hi! On 06/08/2018 03:28, n.pettik wrote: > Firstly, I don’t understand some of your fixes: > > @@ -3855,11 +3853,9 @@ on_replace_dd_fk_constraint(struct trigger * /* trigger*/, void *event) > memset(fkey, 0, sizeof(*fkey)); > fkey->def = fk_def; > fkey->index_id = fk_index->def->iid; > + rlist_add_entry(&child_space->child_fkey, fkey, child_link); > + rlist_add_entry(&parent_space->parent_fkey, fkey, parent_link); > if (old_tuple == NULL) { > - rlist_add_entry(&child_space->child_fkey, fkey, > - child_link); > - rlist_add_entry(&parent_space->parent_fkey, fkey, > - parent_link); > struct trigger *on_rollback = > txn_alter_trigger_new(on_create_fkey_rollback, > fkey); > @@ -3868,10 +3864,6 @@ on_replace_dd_fk_constraint(struct trigger * /* trigger*/, void *event) > struct fkey *old_fk = > fkey_grab_by_name(&child_space->child_fkey, > fk_def->name); > - rlist_add_entry(&child_space->child_fkey, fkey, > - child_link); > - rlist_add_entry(&parent_space->parent_fkey, fkey, > - parent_link); > > In case of replace we must firstly remove entry and only then insert new one. > It is easy to check that the way you suggest doesn’t work (just modify test you provided): Yes, your are right. This was a buggy hunk. Thanks for the fix!