[tarantool-patches] Re: [PATCH 2/5] schema: add new system space for FK constraints
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Mon Aug 6 21:24:58 MSK 2018
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!
More information about the Tarantool-patches
mailing list