From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 25 Feb 2019 14:59:12 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH] Feature request for a new collation Message-ID: <20190225115912.winhxfbiprjrmtbl@esperanza> References: <20190222114939.21764-1-szudin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190222114939.21764-1-szudin@tarantool.org> To: Stanislav Zudin Cc: tarantool-patches@freelists.org, kostja@tarantool.org List-ID: On Fri, Feb 22, 2019 at 02:49:39PM +0300, Stanislav Zudin wrote: > Adds a new default collation 'unicode_s2' to support the difference > between Cyrillic letters 'Е' and 'Ё'. The standard case insensitive > collation ('unicode_ci') doesn't distinguish these letters. > > Closes #4007 > --- > Branch: https://github.com/tarantool/tarantool/tree/stanztt/gh-4007-new-default-collation > Issue: https://github.com/tarantool/tarantool/issues/4007 > > src/box/bootstrap.snap | Bin 1527 -> 1561 bytes > src/box/lua/upgrade.lua | 6 ++ > test/box/collation.result | 160 ++++++++++++++++++++++++++++++++++++ > test/box/collation.test.lua | 49 +++++++++++ > 4 files changed, 215 insertions(+) > create mode 100644 test/box/collation.result > create mode 100644 test/box/collation.test.lua Tests don't pass on Travis CI, please fix. > diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua > index ab705e978..a28b93ada 100644 > --- a/src/box/lua/upgrade.lua > +++ b/src/box/lua/upgrade.lua > @@ -998,9 +998,15 @@ local function create_vinyl_deferred_delete_space() > 'blackhole', 0, {group_id = 1}, format} > end > > +local function create_default_collation_s2() > + log.info("create predefined collation") > + box.space._collation:replace{3, "unicode_s2", ADMIN, "ICU", "ru_RU", {strength='secondary'}} > +end > + > local function upgrade_to_1_10_2() > upgrade_priv_to_1_10_2() > create_vinyl_deferred_delete_space() > + create_default_collation_s2() We push only to branch 2.1 and then backport to 1.10. Please implement this patch for 2.1 first. The committer will try to backport it to 1.10 by himself. If he fails, he'll ask you for assistance. Anyway, 1.10.2, as well as 2.1.1, has already been released. You must use version 1.10.3 / 2.1.2. > end > > local function get_version() > diff --git a/test/box/collation.result b/test/box/collation.result > new file mode 100644 > index 000000000..2dbb43c31 > --- /dev/null > +++ b/test/box/collation.result > @@ -0,0 +1,160 @@ > +env = require('test_run') > +--- > +... > +test_run = env.new() > +--- > +... > +-- > +-- gh-4007 Feature request for a new collation > +-- > +-- Ensure all default collations exist > +box.space._collation.index.name:get{'unicode'}; Please don't use semicolon (;) in Lua - it's not required. > +--- > +- [1, 'unicode', 1, 'ICU', '', {}] > +... > +box.space._collation.index.name:get{'unicode_ci'}; > +--- > +- [2, 'unicode_ci', 1, 'ICU', '', {'strength': 'primary'}] > +... > +box.space._collation.index.name:get{'unicode_s2'}; > +--- > +- [3, 'unicode_s2', 1, 'ICU', 'ru_RU', {'strength': 'secondary'}] > +... > +-- Default unicode collation deals with russian letters > +s = box.schema.space.create('t1'); > +--- > +... > +s:format({{name='s1', type='string', collation = 'unicode'}}); > +--- > +... > +s:create_index('pk', {unique = true, type='tree', parts={{'s1', collation = 'unicode'}}}); > +--- > +- unique: true > + parts: > + - type: string > + is_nullable: false > + collation: unicode > + fieldno: 1 > + id: 0 > + space_id: 512 Please don't print space_id in tests - it can change if you run the test in a different order.