From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <korablev@tarantool.org>
Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 by dev.tarantool.org (Postfix) with ESMTPS id 16678440F3C
 for <tarantool-patches@dev.tarantool.org>;
 Tue, 12 Nov 2019 16:24:38 +0300 (MSK)
Date: Tue, 12 Nov 2019 16:24:37 +0300
From: Nikita Pettik <korablev@tarantool.org>
Message-ID: <20191112132437.GB96411@tarantool.org>
References: <20191111135246.79818-1-korablev@tarantool.org>
 <fbd2a38b-d7cd-2cee-d89a-4fbf38139667@tarantool.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <fbd2a38b-d7cd-2cee-d89a-4fbf38139667@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH] box: don't allow referenced
 collation to be dropped
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org

On 11 Nov 23:38, Vladislav Shpilevoy wrote:
> 
> 3. Collations are referenced not only by indexes and spaces.

Oh, that's pretty sad. AFAIU there's no way to get list of all
existing key defs, so it seems that we have to use reference counters.
I'm going to rework patch and send v2.
 
> tarantool> key_def = require('key_def')
> ---
> ...
> 
> tarantool> kd = key_def.new({{fieldno = 1, collation = 'unicode', type = 'string'}})
> ---
> ...
> 
> tarantool> box.space._collation:delete(1)
> ---
> - [1, 'unicode', 1, 'ICU', '', {'strength': 'tertiary'}]
> ...
> 
> tarantool> kd
> Assertion failed: (coll_id != NULL), function luaT_push_key_def, file /Users/gerold/Work/Repositories/tarantool/src/box/lua/key_def.c, line 67.
> Process 50999 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
>     frame #0: 0x00007fff688be2c6 libsystem_kernel.dylib`__pthread_kill + 10
> libsystem_kernel.dylib`__pthread_kill:
> ->  0x7fff688be2c6 <+10>: jae    0x7fff688be2d0            ; <+20>
>     0x7fff688be2c8 <+12>: movq   %rax, %rdi
>     0x7fff688be2cb <+15>: jmp    0x7fff688b8457            ; cerror_nocancel
>     0x7fff688be2d0 <+20>: retq   
> Target 0: (tarantool) stopped.