[tarantool-patches] [PATCH v9 1/1] box: create bigrefs for tuples

Vladimir Davydov vdavydov.dev at gmail.com
Thu Jun 14 15:29:32 MSK 2018


On Thu, Jun 14, 2018 at 02:45:45PM +0300, imeevma at tarantool.org wrote:

> diff --git a/src/box/box.cc b/src/box/box.cc
> index c728a4c..4257861 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -174,20 +174,22 @@ process_rw(struct request *request, struct space *space, struct tuple **result)
>  		txn_rollback_stmt();
>  		return -1;
>  	}
> +	if (result == NULL)
> +		return txn_commit_stmt(txn, request);
> +	*result = tuple;
> +	if (tuple == NULL)
> +		return txn_commit_stmt(txn, request);
>  	/*
>  	 * Pin the tuple locally before the commit,
>  	 * otherwise it may go away during yield in
>  	 * when WAL is written in autocommit mode.
>  	 */
> -	TupleRefNil ref(tuple);
> -	if (txn_commit_stmt(txn, request) != 0)
> -		return -1;
> -	if (result != NULL) {
> -		if (tuple != NULL && tuple_bless(tuple) == NULL)
> -			return -1;
> -		*result = tuple;
> -	}
> -	return 0;
> +	tuple_ref(tuple);
> +	int rc = txn_commit_stmt(txn, request);
> +	if (rc == 0)
> +		tuple_bless(tuple);
> +	tuple_unref(tuple);
> +	return rc;

As I mentioned before, I don't like the way you reworked this function
workflow and squeezed this change into this particular patch, which has
nothing to do with it. I don't really care though. Up to kostja at .

> +/** Destroy big references and free memory that was allocated. */
> +static inline void
> +bigref_list_destroy(void)
> +{
> +	free(bigref_list.refs);
> +	bigref_list_create();

No need to call 'create' on 'destroy' anymore. Please remove.

Other than that, the patch looks good to me.



More information about the Tarantool-patches mailing list