[tarantool-patches] Re: [tarantool-patches] Re: [PATCH v2 1/1] box: update collation strength option.

Мерген Имеев imeevma at tarantool.org
Fri Oct 12 21:07:56 MSK 2018


Hello! Thank you for review! My answer below.
On 10/12/2018 03:05 AM, Vladislav
      Shpilevoy wrote:
>Thanks
      for the fixes! See 1 comment below. 
>>diff --git a/src/box/lua/upgrade.lua
        b/src/box/lua/upgrade.lua 
>>        index d9c2ae4..66dcef4 100644 
>>        --- a/src/box/lua/upgrade.lua 
>>        +++ b/src/box/lua/upgrade.lua 
>>        @@ -578,6 +578,27 @@ local function upgrade_to_2_1_0() 
>>              box.space._schema:format(format) 
>>          end 
>>+--------------------------------------------------------------------------------
        
>>        +-- Tarantool 2.1.1 
>>+--------------------------------------------------------------------------------
        
>>        + 
>>        +function update_collation_strength_field() 
>>        +    local _collation = box.space[box.schema.COLLATION_ID] 
>>        +    for _, collation in ipairs(_collation:select()) do 
>>        +        if (collation.opts.strength == nil) then 
>>        +            local new_collation =
        _collation:get{collation.id}:totable() 
>>        +            new_collation[6].strength = 'identical' 
>>        +            _collation:delete{collation.id} 
>>        +            _collation:insert(new_collation) 
>      Why did you remove replace from my diff and replaced it with 
>      delete + insert? collation.id is a primary index and it is the 
>      same in the new and old collation. It makes no sense to do delete
      + 
>      insert, when you can do one replace. 
    Replace couldn't be used in space box.space._collation:
    tarantool> function update_collation_strength_field()
             >     local _collation =
    box.space[box.schema.COLLATION_ID]
             >     for _, collation in ipairs(_collation:select()) do
             >         if (collation.opts.strength == nil) then
             >             local new_collation =
    _collation:get{collation.id}:totable()
             >             new_collation[6].strength = 'identical'
             >             _collation:replace(new_collation)
             >         end
             >     end
             > end
    ---
    ...
    tarantool> update_collation_strength_field()
    ---
    - error: collation does not support alter
    ...
>>+        end 
>>        +    end 
>>        +end 
>>        + 
>>        +local function upgrade_to_2_1_1() 
>>        +    update_collation_strength_field() 
>>        +end 
>>        + 
>>        + 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20181012/93cfb4d5/attachment.html>


More information about the Tarantool-patches mailing list