[Tarantool-patches] [PATCH 2/2] vinyl: skip invalid upserts during squash

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat May 30 00:47:14 MSK 2020


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?


More information about the Tarantool-patches mailing list