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

  • From: Vladislav Shpilevoy <v.shpilevoy@xxxxxxxxxxxxx>
  • To: Imeev Mergen <imeevma@xxxxxxxxxxxxx>, tarantool-patches@xxxxxxxxxxxxx
  • Date: Fri, 12 Oct 2018 03:05:00 +0300

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.

+        end
+    end
+end
+
+local function upgrade_to_2_1_1()
+    update_collation_strength_field()
+end
+
+

Other related posts: