From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 03/12] alter: do not rebuild secondary indexes on compatible pk changes Date: Sun, 1 Apr 2018 12:05:30 +0300 Message-Id: <18ea755bc3c1a97a90573b35daeac85ecc65a0c5.1522572160.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: 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