From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 923FA23B8F for ; Fri, 27 Apr 2018 18:36:44 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bRcp21JMy8oZ for ; Fri, 27 Apr 2018 18:36:44 -0400 (EDT) Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id F41A023B1A for ; Fri, 27 Apr 2018 18:36:43 -0400 (EDT) From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/3] vinyl: remove vy_apply_upsert_ops Date: Sat, 28 Apr 2018 01:36:38 +0300 Message-Id: <37cca09133f09ebcc50b4dd7432271669471b04b.1524868484.git.v.shpilevoy@tarantool.org> In-Reply-To: References: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: kostja@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)