Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 1/3] vinyl: remove vy_apply_upsert_ops
Date: Sat, 28 Apr 2018 01:36:38 +0300	[thread overview]
Message-ID: <37cca09133f09ebcc50b4dd7432271669471b04b.1524868484.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1524868484.git.v.shpilevoy@tarantool.org>
In-Reply-To: <cover.1524868484.git.v.shpilevoy@tarantool.org>

Function vy_apply_upsert_opts originaly appears in this commit:
5627e53bf020bf83b8f74d3d04b93047bdf221b4, where it is a
refactored version of a sophia upsertion. But when a vy_stmt was
introduced, vinyl_apply_upsert_ops works just like ordinary
tuple_upsert_execute. Remove this useless wrapper.
---
 src/box/vy_upsert.c | 43 +++++--------------------------------------
 1 file changed, 5 insertions(+), 38 deletions(-)

diff --git a/src/box/vy_upsert.c b/src/box/vy_upsert.c
index 67f9ef09f..7af58d967 100644
--- a/src/box/vy_upsert.c
+++ b/src/box/vy_upsert.c
@@ -49,42 +49,6 @@ vy_update_alloc(void *arg, size_t size)
 	return data;
 }
 
-/**
- * vinyl wrapper of tuple_upsert_execute.
- * vibyl upsert opts are slightly different from tarantool ops,
- *  so they need some preparation before tuple_upsert_execute call.
- *  The function does this preparation.
- * On successfull upsert the result is placed into stmt and stmt_end args.
- * On fail the stmt and stmt_end args are not changed.
- * Possibly allocates new stmt via fiber region alloc,
- * so call fiber_gc() after usage
- */
-static void
-vy_apply_upsert_ops(struct region *region, const char **stmt,
-		    const char **stmt_end, const char *ops, const char *ops_end,
-		    bool suppress_error, uint64_t *column_mask)
-{
-	if (ops == ops_end)
-		return;
-
-#ifndef NDEBUG
-	const char *serie_end_must_be = ops;
-	mp_next(&serie_end_must_be);
-	assert(ops_end == serie_end_must_be);
-#endif
-	const char *result;
-	uint32_t size;
-	result = tuple_upsert_execute(vy_update_alloc, region,
-				      ops, ops_end,
-				      *stmt, *stmt_end,
-				      &size, 0, suppress_error, column_mask);
-	if (result != NULL) {
-		/* if failed, just skip it and leave stmt the same */
-		*stmt = result;
-		*stmt_end = result + size;
-	}
-}
-
 /**
  * Try to squash two upsert series (msgspacked index_base + ops)
  * Try to create a tuple with squahed operations
@@ -165,8 +129,11 @@ vy_apply_upsert(const struct tuple *new_stmt, const struct tuple *old_stmt,
 	size_t region_svp = region_used(region);
 	uint8_t old_type = vy_stmt_type(old_stmt);
 	uint64_t column_mask = COLUMN_MASK_FULL;
-	vy_apply_upsert_ops(region, &result_mp, &result_mp_end, new_ops,
-			    new_ops_end, suppress_error, &column_mask);
+	result_mp = tuple_upsert_execute(vy_update_alloc, region, new_ops,
+					 new_ops_end, result_mp, result_mp_end,
+					 &mp_size, 0, suppress_error,
+					 &column_mask);
+	result_mp_end = result_mp + mp_size;
 	if (old_type != IPROTO_UPSERT) {
 		assert(old_type == IPROTO_INSERT ||
 		       old_type == IPROTO_REPLACE);
-- 
2.15.1 (Apple Git-101)

  reply	other threads:[~2018-04-27 22:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 22:36 [tarantool-patches] [PATCH 0/3] Optimize and simplify some tuple_update things Vladislav Shpilevoy
2018-04-27 22:36 ` Vladislav Shpilevoy [this message]
2018-05-08 20:18   ` [tarantool-patches] Re: [PATCH 1/3] vinyl: remove vy_apply_upsert_ops Konstantin Osipov
2018-04-27 22:36 ` [tarantool-patches] [PATCH 2/3] tuple_update: remove alloc and alloc_ctx args Vladislav Shpilevoy
2018-05-08 20:18   ` [tarantool-patches] " Konstantin Osipov
2018-04-27 22:36 ` [tarantool-patches] [PATCH 3/3] rope: make rope library be C template using macros Vladislav Shpilevoy
2018-05-08 20:22   ` [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=37cca09133f09ebcc50b4dd7432271669471b04b.1524868484.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/3] vinyl: remove vy_apply_upsert_ops' \
    /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