From: Vladimir Davydov <vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org Subject: [PATCH 03/12] alter: do not rebuild secondary indexes on compatible pk changes Date: Sun, 1 Apr 2018 12:05:30 +0300 [thread overview] Message-ID: <18ea755bc3c1a97a90573b35daeac85ecc65a0c5.1522572160.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1522572160.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1522572160.git.vdavydov.dev@gmail.com> If the new cmp_def of a secondary index is compatible with the old one after the primary key parts have changed, we don't need to rebuild it, we just need to update its definition. --- src/box/alter.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/box/alter.cc b/src/box/alter.cc index 7f130297..174d53fa 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -1432,7 +1432,13 @@ alter_space_move_indexes(struct alter_space *alter, uint32_t begin, old_def->key_def, alter->pk_def); index_def_update_optionality(new_def, min_field_count); auto guard = make_scoped_guard([=] { index_def_delete(new_def); }); - (void) new RebuildIndex(alter, new_def, old_def); + if (key_part_check_compatibility(old_def->cmp_def->parts, + old_def->cmp_def->part_count, + new_def->cmp_def->parts, + new_def->cmp_def->part_count)) + (void) new ModifyIndex(alter, new_def, old_def); + else + (void) new RebuildIndex(alter, new_def, old_def); guard.is_active = false; } } -- 2.11.0
next prev parent reply other threads:[~2018-04-01 9:05 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 ` Vladimir Davydov [this message] 2018-04-05 12:30 ` [PATCH 03/12] alter: do not rebuild secondary indexes on compatible " 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 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=18ea755bc3c1a97a90573b35daeac85ecc65a0c5.1522572160.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH 03/12] alter: do not rebuild secondary indexes on compatible pk changes' \ /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