From: Vladimir Davydov <vdavydov.dev@gmail.com> To: tarantool-patches@freelists.org Subject: [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Date: Tue, 2 Apr 2019 20:06:17 +0300 [thread overview] Message-ID: <b074c7c76e7d583827c548ec48edbb9b0537c7c1.1554224741.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <c3a09f52c36afa6644dde87dc4b52fae43b37f7b.1554224739.git.vdavydov.dev@gmail.com> So as not to confuse it with a tuple comparison hint. --- src/box/vy_write_iterator.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c index ee2cb7ae..6818a31c 100644 --- a/src/box/vy_write_iterator.c +++ b/src/box/vy_write_iterator.c @@ -803,7 +803,7 @@ next_lsn: * one statement. * * @param stream Write iterator. - * @param hint The tuple from a previous read view (can be NULL). + * @param prev_tuple Tuple from the previous read view (can be NULL). * @param rv Read view to merge. * @param is_first_insert Set if the oldest statement for the * current key among all sources is an INSERT. @@ -812,7 +812,7 @@ next_lsn: * @retval -1 Memory error. */ static NODISCARD int -vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint, +vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *prev_tuple, struct vy_read_view_stmt *rv, bool is_first_insert) { assert(rv != NULL); @@ -824,7 +824,8 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint, * by a read view if it is preceded by another DELETE for * the same key. */ - if (hint != NULL && vy_stmt_type(hint) == IPROTO_DELETE && + if (prev_tuple != NULL && + vy_stmt_type(prev_tuple) == IPROTO_DELETE && vy_stmt_type(h->tuple) == IPROTO_DELETE) { vy_write_history_destroy(h); rv->history = NULL; @@ -840,11 +841,11 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint, * it, whether is_last_level is true or not. */ if (vy_stmt_type(h->tuple) == IPROTO_UPSERT && - (stream->is_last_level || (hint != NULL && - vy_stmt_type(hint) != IPROTO_UPSERT))) { - assert(!stream->is_last_level || hint == NULL || - vy_stmt_type(hint) != IPROTO_UPSERT); - struct tuple *applied = vy_apply_upsert(h->tuple, hint, + (stream->is_last_level || (prev_tuple != NULL && + vy_stmt_type(prev_tuple) != IPROTO_UPSERT))) { + assert(!stream->is_last_level || prev_tuple == NULL || + vy_stmt_type(prev_tuple) != IPROTO_UPSERT); + struct tuple *applied = vy_apply_upsert(h->tuple, prev_tuple, stream->cmp_def, false); if (applied == NULL) return -1; @@ -893,7 +894,7 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint, } vy_stmt_set_flags(rv->tuple, flags & ~VY_STMT_DEFERRED_DELETE); } - if (hint != NULL) { + if (prev_tuple != NULL) { /* Not the first statement. */ return 0; } @@ -974,11 +975,11 @@ vy_write_iterator_build_read_views(struct vy_write_iterator *stream, int *count) * here > 0. */ assert(rv >= &stream->read_views[0] && rv->history != NULL); - struct tuple *hint = NULL; + struct tuple *prev_tuple = NULL; for (; rv >= &stream->read_views[0]; --rv) { if (rv->history == NULL) continue; - if (vy_read_view_merge(stream, hint, rv, + if (vy_read_view_merge(stream, prev_tuple, rv, is_first_insert) != 0) goto error; assert(rv->history == NULL); @@ -986,7 +987,7 @@ vy_write_iterator_build_read_views(struct vy_write_iterator *stream, int *count) continue; stream->rv_used_count++; ++*count; - hint = rv->tuple; + prev_tuple = rv->tuple; } region_truncate(region, used); return 0; -- 2.11.0
next prev parent reply other threads:[~2019-04-02 17:06 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-02 17:06 [PATCH] space: fix space_group_id return value Vladimir Davydov 2019-04-02 17:06 ` Vladimir Davydov [this message] 2019-04-02 17:09 ` [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple Vladimir Davydov 2019-04-02 17:09 ` [PATCH] space: fix space_group_id return value Vladimir Davydov 2019-04-02 18:05 ` [tarantool-patches] " 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=b074c7c76e7d583827c548ec48edbb9b0537c7c1.1554224741.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH] vinyl: rename vy_read_view_merge argument from hint to prev_tuple' \ /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