From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 13 Mar 2019 15:25:59 +0300 From: Konstantin Osipov Subject: Re: [PATCH v2 11/14] vinyl: do not fill secondary tuples with nulls when decoded Message-ID: <20190313122559.GK25066@chai> References: <00072f9869878409ebefa45232b5015a8441a655.1552464666.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00072f9869878409ebefa45232b5015a8441a655.1552464666.git.vdavydov.dev@gmail.com> To: Vladimir Davydov Cc: tarantool-patches@freelists.org List-ID: * Vladimir Davydov [19/03/13 11:58]: > +struct key_def * > +key_def_extract(const struct key_def *cmp_def, const struct key_def *pk_def, > + struct region *region) The name is not very telling :( It also looks like a standalone function, not a key_def method. So we could name it build_pk_def_for_cmp_def or find_primary_key_parts() or something like it. > if (lsm == NULL) { > free(index); > return NULL; > @@ -1301,13 +1300,34 @@ vy_get_by_secondary_tuple(struct vy_lsm *lsm, struct vy_tx *tx, > const struct vy_read_view **rv, > struct tuple *tuple, struct tuple **result) > { > + int rc = 0; > assert(lsm->index_id > 0); > > - if (vy_point_lookup(lsm->pk, tx, rv, tuple, result) != 0) > - return -1; > + /* > + * Lookup the full tuple by a secondary statement. > + * There are two cases: the secondary statement may be > + * a key, in which case we need to extract the primary Please explain: may be a key, if we got this tuple from disk ... or may be a full tuple if we got this tuple from the tuple cache or level 0, > + * key parts from it; or it may be a full tuple, which > + * we may pass it immediately to the iterator. > + */ > + struct tuple *key; > + /* > + * To save disk space, we do not store full tuples > + * in secondary index runs. Instead we only store > + * extended keys (i.e. keys consisting of secondary > + * and primary index parts). This is enough to look > + * up a full tuple in the primary index. > + */ > + lsm->disk_format = lsm_env->key_format; Nice. > + > + lsm->pk_in_cmp_def = key_def_extract(lsm->cmp_def, pk->key_def, Oh. Shall we call the function find_pk_in_cmp_def()? > + if (is_primary) > + stmt = vy_stmt_new_surrogate_from_key(request.key, Shouldn't this be renamed? > + IPROTO_DELETE, > key_def, format); -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov