From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 25 Jul 2019 11:46:42 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH 2/3] vinyl: move unique check optimization setup to the space level Message-ID: <20190725084642.GE24631@esperanza> References: <64b85c269c8153167e2aee302fecfab79ef58d43.1563895921.git.vdavydov.dev@gmail.com> <20190724223141.GB13150@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724223141.GB13150@atlas> To: Konstantin Osipov Cc: tarantool-patches@freelists.org List-ID: On Thu, Jul 25, 2019 at 01:31:41AM +0300, Konstantin Osipov wrote: > > +/** A trivial wrapper around space_build_index(). */ > > +static void > > +alter_space_build_index(struct space *src_space, struct space *new_space, > > + struct index *new_index) > > +{ > > + bool check_unique = space_needs_check_unique(new_space, > > + new_index->def->iid); > > check_unique is not proper English, please use > check_unique_constraint or check_unique_ck. Yeah, sure, will rename to check_unique_constraint. > > > + space_build_index_xc(src_space, new_index, new_space->format, > > + check_unique); > > Why can't you move testing check_unique property inside space_build_index > or even the engine specific implementation of space_build_index? Then I would need to pass the old space to the function, which I'd like to avoid, because this would make the function proto less obvious. > > > + space->unique_index_bitmap = calloc(bitmap_size(index_id_max + 1), 1); > > Let's use check_unique_constraint_map Okay. > > +/** > > + * Return true if the unique constraint must be checked for > > + * the index with the given id before inserting a tuple into > > + * the space. > > + */ > > +static inline bool > > +space_needs_check_unique(struct space *space, uint32_t index_id) > > space_needs_unique_constraint_check Okay.