From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 84EA1469710 for ; Sat, 30 May 2020 00:47:16 +0300 (MSK) References: <670c3876e58a7cfa14d45db1dc074a10dd034759.1586808463.git.korablev@tarantool.org> <30344cf8-3ea1-33c2-2c34-89a2c4c561ec@tarantool.org> <20200527200506.GC17325@tarantool.org> From: Vladislav Shpilevoy Message-ID: <7039aa7a-035a-8499-ff2c-de2b7509b788@tarantool.org> Date: Fri, 29 May 2020 23:47:14 +0200 MIME-Version: 1.0 In-Reply-To: <20200527200506.GC17325@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 2/2] vinyl: skip invalid upserts during squash List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org Thanks for the fixes! >>> diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c >>> index 7a6a20627..4d34d96c8 100644 >>> --- a/src/box/vy_write_iterator.c >>> +++ b/src/box/vy_write_iterator.c >>> @@ -850,10 +850,23 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint, >>> vy_stmt_type(hint) != IPROTO_UPSERT); >>> struct tuple *applied = vy_apply_upsert(h->tuple, hint, >>> stream->cmp_def, stream->format, false); >>> - if (applied == NULL) >>> - return -1; >>> - vy_stmt_unref_if_possible(h->tuple); >>> - h->tuple = applied; >>> + if (applied == NULL) { >>> + /* >>> + * Current upsert can't be applied. >>> + * Let's skip it and log error. >>> + */ >>> + struct error *e = diag_last_error(diag_get()); >>> + assert(e != NULL); >>> + if (e->type != &type_ClientError) >>> + return -1; >>> + say_info("upsert %s is not applied due to the error: %s", >>> + vy_stmt_str(h->tuple), e->errmsg); >>> + vy_stmt_unref_if_possible(h->tuple); >> >> *. Why here we use sometimes say_info() and sometimes error_log()? Why >> not something one? > > Indeed, let's use here say_error(): Now in some places we use diag_log() and in other say_error() + vy_stmt_str(). How is it chosen when what to use?