Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Roman Khabibov <roman.habibov@tarantool.org>
Cc: tarantool-patches@freelists.org, v.shpilevoy@tarantool.org
Subject: Re: [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview
Date: Tue, 4 Jun 2019 19:31:59 +0300	[thread overview]
Message-ID: <20190604163159.5lctqc4kaclxo3rh@esperanza> (raw)
In-Reply-To: <5eab44d0494d7622ef5fbb77c45229a09212d9bc.1559219194.git.roman.habibov@tarantool.org>

On Thu, May 30, 2019 at 03:36:02PM +0300, Roman Khabibov wrote:
> diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
> index 89d6e3d52..f2a1be639 100644
> --- a/src/box/lua/upgrade.lua
> +++ b/src/box/lua/upgrade.lua
> @@ -737,6 +737,30 @@ local function upgrade_to_2_1_3()
>      end
>  end
>  
> +local function create_vcollation_space()
> +    local _collation = box.space._collation
> +    local format = _collation:format()
> +    create_sysview(box.schema.COLLATION_ID, box.schema.VCOLLATION_ID)
> +    box.space[box.schema.VCOLLATION_ID]:format(format)
> +end
> +
> +local function upgrade_to_2_1_4()
> +    local _collation = box.space._collation
> +    local _index = box.space._index
> +
> +    -- System space format usually is in order "id, owner, name...".
> +    -- The fields "name", "owner" are swapped in "_collation" format,
> +    -- due to the field "owner" was added after the "_collation" creation.
> +    box.space._index:delete{276, 1}
> +    log.info("update index name on _collation")
> +    box.space._index:insert{_collation.id, 2, 'name', 'tree', {unique = true},
> +                            {{1, 'string'}}}
> +    log.info("create index owner on _collation")
> +    box.space._index:insert{_collation.id, 1, 'owner', 'tree', {unique = false},
> +                            {{2, 'unsigned'}}}

I don't understand this part. Why do you need to create 'owner' index?
Why do you need to update 'name' index?

> +    create_vcollation_space()
> +end
> +
>  local function get_version()
>      local version = box.space._schema:get{'version'}
>      if version == nil then
> @@ -768,6 +792,7 @@ local function upgrade(options)
>          {version = mkversion(2, 1, 1), func = upgrade_to_2_1_1, auto = true},
>          {version = mkversion(2, 1, 2), func = upgrade_to_2_1_2, auto = true},
>          {version = mkversion(2, 1, 3), func = upgrade_to_2_1_3, auto = true},
> +        {version = mkversion(2, 1, 4), func = upgrade_to_2_1_4, auto = true}

Should be in upgrade_to_2_2_1.

>      }
>  
>      for _, handler in ipairs(handlers) do
> diff --git a/src/box/schema_def.h b/src/box/schema_def.h
> index eeeeb950b..77c004690 100644
> --- a/src/box/schema_def.h
> +++ b/src/box/schema_def.h
> @@ -72,6 +72,8 @@ enum {
>  	BOX_SCHEMA_ID = 272,
>  	/** Space id of _collation. */
>  	BOX_COLLATION_ID = 276,
> +	/** Space id of _vcollation. */
> +	BOX_VCOLLATION_ID = 277,
>  	/** Space id of _space. */
>  	BOX_SPACE_ID = 280,
>  	/** Space id of _vspace view. */
> diff --git a/src/box/sysview.c b/src/box/sysview.c
> index 96c5e78ca..0d1259af0 100644
> --- a/src/box/sysview.c
> +++ b/src/box/sysview.c
> @@ -402,6 +402,14 @@ vsequence_filter(struct space *source, struct tuple *tuple)
>  	       ((PRIV_WRDA | PRIV_X) & effective);
>  }
>  
> +static bool
> +	vcollation_filter(struct space *source, struct tuple *tuple)
> +	{
> +		(void) source;
> +		(void) tuple;
> +		return true;
> +	}
> +

Bad indentation.

  reply	other threads:[~2019-06-04 16:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 12:36 [tarantool-patches] [PATCH 0/2] Add _vcollation and fetch in net.box Roman Khabibov
2019-05-30 12:36 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov
2019-06-04 16:31   ` Vladimir Davydov [this message]
2019-06-05 17:08     ` [tarantool-patches] " Roman Khabibov
2019-06-05 17:56       ` Vladimir Davydov
2019-06-06 15:18         ` Roman Khabibov
2019-05-30 12:36 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
2019-06-04 16:36   ` Vladimir Davydov
2019-06-05 17:08     ` [tarantool-patches] " Roman Khabibov
2019-06-05 17:28       ` Vladimir Davydov
2019-06-06 15:22         ` Roman Khabibov
2019-06-06 16:00         ` Roman Khabibov
2019-06-06 17:00           ` Vladimir Davydov
2019-06-03 18:45 ` [tarantool-patches] Re: [PATCH 0/2] Add _vcollation and fetch in net.box Vladislav Shpilevoy
2019-06-04 15:54 ` [tarantool-patches] " Vladimir Davydov
  -- strict thread matches above, loose matches on Subject: below --
2019-05-16 11:24 [tarantool-patches] [PATCH 0/2] Add "_vcollation" sysview and fetch it " Roman Khabibov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190604163159.5lctqc4kaclxo3rh@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox