From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (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 C5941469719 for ; Tue, 13 Oct 2020 22:00:28 +0300 (MSK) References: <743a25a986ebbe4388d8f6ffc7d1502f20a5efb9.1601729099.git.korablev@tarantool.org> From: Aleksandr Lyapunov Message-ID: <343c3a98-2eec-1d3b-797b-77ed76c304bb@tarantool.org> Date: Tue, 13 Oct 2020 22:00:27 +0300 MIME-Version: 1.0 In-Reply-To: <743a25a986ebbe4388d8f6ffc7d1502f20a5efb9.1601729099.git.korablev@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Tarantool-patches] [PATCH v3 1/2] vinyl: rework upsert operation List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik , tarantool-patches@dev.tarantool.org Cc: v.shpilevoy@tarantool.org Hi, thanks for the patch! Se my 2 comments below: (the second seems to be important) Once they resolved, the whole patch is LGTM! On 10/3/20 4:28 PM, Nikita Pettik wrote: > into insert the upsert's tuple and the tuple stored in index can be > different In our particular case, tuple stored on disk has two fields Dot before `In` is missing. > + /* > + * If it turns out that resulting tuple modifies primary > + * key, then simply ignore this upsert. > + */ > + if (stmt != NULL && > + vy_apply_result_does_cross_pk(stmt, exec_res, > + exec_res + mp_size, cmp_def, > + column_mask)) { I guess in case if `stmt_is_void = true` we must compare with `upsert` tuple, not with `stmt` tuple. > + if (!suppress_error) { > + say_error("upsert operations %s are not applied"\ > + " due to primary key modification", > + mp_str(ups_ops)); > + } > + ups_ops = ups_ops_end; > + continue; > + } > + ups_ops = ups_ops_end; > + /* > + * Result statement must satisfy space's format. Since upsert's > + * tuple correctness is already checked in vy_upsert(), let's > + * use its format to provide result verification. > + */ > + struct tuple_format *format = tuple_format(upsert); > + if (tuple_validate_raw(format, exec_res) != 0) { > + if (! suppress_error) > + diag_log(); > + continue; > + } > + result_mp = exec_res; > + result_mp_end = exec_res + mp_size; > + } > + struct tuple *new_terminal_stmt = vy_stmt_new_replace(format, result_mp, > + result_mp_end); > + region_truncate(region, region_svp); > + if (new_terminal_stmt == NULL) > + return NULL; > + vy_stmt_set_lsn(new_terminal_stmt, vy_stmt_lsn(upsert)); > + return new_terminal_stmt; > +}