Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH 12/12] vinyl: allow to modify key definition if it does not require rebuild
Date: Thu, 5 Apr 2018 17:45:03 +0300	[thread overview]
Message-ID: <20180405144503.GA17397@atlas> (raw)
In-Reply-To: <20180402084649.dxtykpka5tylrgn2@esperanza>

* Vladimir Davydov <vdavydov.dev@gmail.com> [18/04/02 11:49]:

> +--
> +-- Modify key definition without index rebuild.
> +--

One more thing, please, we need more functional tests.

Let's create a test plan which we will then reuse for non-empty
spaces as well:

Modify:
 - unique -> non unique, non-unique -> unique, or no change
 - nullable -> not-nullable, not-nullable -> nullable, or no
   change
 - a wider type is altered to a more narrow type, or vice versa,
   or the type types are incompatible, or no change,
 - key part added, removed, or all key parts changed, or no key
   parts changed.

Each line above creates a testing dimension, so in the end we
should have at least 3*4*4*4  = 192 different test cases.
Let's construct a test case in a way allowing us to add different
dimensions to it in the future.

> +s = box.schema.create_space('test', {engine = engine})
> +---
> +...
> +i1 = s:create_index('i1', {unique = true,  parts = {1, 'unsigned'}})
> +---
> +...
> +i2 = s:create_index('i2', {unique = false, parts = {2, 'unsigned'}})
> +---
> +...
> +i3 = s:create_index('i3', {unique = true,  parts = {3, 'unsigned'}})
> +---
> +...
> +_ = s:insert{1, 2, 3}
> +---
> +...
> +box.snapshot()
> +---
> +- ok
> +...
> +_ = s:insert{3, 2, 1}
> +---
> +...
> +i1:alter{parts = {1, 'integer'}}
> +---
> +...
> +_ = s:insert{-1, 2, 2}
> +---
> +...
> +i1:select()
> +---
> +- - [-1, 2, 2]
> +  - [1, 2, 3]
> +  - [3, 2, 1]
> +...
> +i2:select()
> +---
> +- - [-1, 2, 2]
> +  - [1, 2, 3]
> +  - [3, 2, 1]
> +...
> +i3:select()
> +---
> +- - [3, 2, 1]
> +  - [-1, 2, 2]
> +  - [1, 2, 3]
> +...
> +i2:alter{parts = {2, 'integer'}}
> +---
> +...
> +i3:alter{parts = {3, 'integer'}}
> +---
> +...
> +_ = s:replace{-1, -1, -1}
> +---
> +...
> +i1:select()
> +---
> +- - [-1, -1, -1]
> +  - [1, 2, 3]
> +  - [3, 2, 1]
> +...
> +i2:select()
> +---
> +- - [-1, -1, -1]
> +  - [1, 2, 3]
> +  - [3, 2, 1]
> +...
> +i3:select()
> +---
> +- - [-1, -1, -1]
> +  - [3, 2, 1]
> +  - [1, 2, 3]
> +...
> +box.snapshot()
> +---
> +- ok
> +...
> +_ = s:replace{-1, -2, -3}
> +---
> +...
> +_ = s:replace{-3, -2, -1}
> +---
> +...
> +i1:select()
> +---
> +- - [-3, -2, -1]
> +  - [-1, -2, -3]
> +  - [1, 2, 3]
> +  - [3, 2, 1]
> +...
> +i2:select()
> +---
> +- - [-3, -2, -1]
> +  - [-1, -2, -3]
> +  - [1, 2, 3]
> +  - [3, 2, 1]
> +...
> +i3:select()
> +---
> +- - [-1, -2, -3]
> +  - [-3, -2, -1]
> +  - [3, 2, 1]
> +  - [1, 2, 3]
> +...
> +s:drop()
> +---
> +...

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

  parent reply	other threads:[~2018-04-05 14:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  9:05 [PATCH 00/12] vinyl: allow to extend key def of non-empty index Vladimir Davydov
2018-04-01  9:05 ` [PATCH 01/12] index: add commit_modify virtual method Vladimir Davydov
2018-04-01  9:05 ` [PATCH 02/12] alter: require rebuild of all secondary vinyl indexes if pk changes Vladimir Davydov
2018-04-01  9:05 ` [PATCH 03/12] alter: do not rebuild secondary indexes on compatible " Vladimir Davydov
2018-04-05 12:30   ` Konstantin Osipov
2018-04-01  9:05 ` [PATCH 04/12] space: make space_swap_index method virtual Vladimir Davydov
2018-04-01  9:05 ` [PATCH 05/12] vinyl: do not reallocate tuple formats on alter Vladimir Davydov
2018-04-01 11:12   ` [tarantool-patches] " v.shpilevoy
2018-04-01 11:24     ` Vladimir Davydov
2018-04-01  9:05 ` [PATCH 06/12] vinyl: zap vy_lsm_validate_formats Vladimir Davydov
2018-04-01  9:05 ` [PATCH 07/12] vinyl: zap vy_mem_update_formats Vladimir Davydov
2018-04-01  9:05 ` [PATCH 08/12] vinyl: remove pointless is_nullable initialization for disk_format Vladimir Davydov
2018-04-01  9:05 ` [PATCH 09/12] vinyl: use source tuple format when copying field map Vladimir Davydov
2018-04-01  9:05 ` [PATCH 10/12] vinyl: rename vy_log_record::commit_lsn to create_lsn Vladimir Davydov
2018-04-01  9:05 ` [PATCH 11/12] vinyl: do not write VY_LOG_DUMP_LSM record to snapshot Vladimir Davydov
2018-04-01  9:05 ` [PATCH 12/12] vinyl: allow to modify key definition if it does not require rebuild Vladimir Davydov
2018-04-02  8:46   ` Vladimir Davydov
2018-04-05 14:32     ` Konstantin Osipov
2018-04-05 14:45     ` Konstantin Osipov [this message]
2018-04-05 14:48       ` Konstantin Osipov

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=20180405144503.GA17397@atlas \
    --to=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH 12/12] vinyl: allow to modify key definition if it does not require rebuild' \
    /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