Tarantool development patches archive
 help / color / mirror / Atom feed
From: Aleksandr Lyapunov <alyapunov@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Cc: v.shpilevoy@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 1/2] vinyl: rework upsert operation
Date: Tue, 13 Oct 2020 22:00:27 +0300	[thread overview]
Message-ID: <343c3a98-2eec-1d3b-797b-77ed76c304bb@tarantool.org> (raw)
In-Reply-To: <743a25a986ebbe4388d8f6ffc7d1502f20a5efb9.1601729099.git.korablev@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;
> +}

  parent reply	other threads:[~2020-10-13 19:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 13:28 [Tarantool-patches] [PATCH v3 0/2] " Nikita Pettik
2020-10-03 13:28 ` [Tarantool-patches] [PATCH v3 1/2] " Nikita Pettik
2020-10-06 22:12   ` Vladislav Shpilevoy
2020-10-09 15:06     ` Nikita Pettik
2020-10-13 19:00   ` Aleksandr Lyapunov [this message]
2020-10-14  0:15     ` Nikita Pettik
2020-10-14  8:58       ` Aleksandr Lyapunov
2020-10-14 10:42         ` Nikita Pettik
2020-10-14 11:47           ` Aleksandr Lyapunov
2020-10-15  0:36             ` Nikita Pettik
2020-10-03 13:28 ` [Tarantool-patches] [PATCH v3 2/2] vinyl: remove squash procedures from source code Nikita Pettik
2020-10-03 13:52 ` [Tarantool-patches] [PATCH v3 0/2] vinyl: rework upsert operation Nikita Pettik
2020-10-06 22:12 ` Vladislav Shpilevoy
2020-10-09 15:10   ` Nikita Pettik
2020-10-11 15:35     ` Vladislav Shpilevoy
2020-10-11 15:35 ` Vladislav Shpilevoy
2020-10-13 10:18   ` Nikita Pettik
2020-10-14 23:44     ` Vladislav Shpilevoy
2020-10-15  1:42       ` Nikita Pettik

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=343c3a98-2eec-1d3b-797b-77ed76c304bb@tarantool.org \
    --to=alyapunov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 1/2] vinyl: rework upsert operation' \
    /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