* Yuriy Vostrikov <[email protected]> [10/11/24 16:03]:
> ---

Generally, it's a good idea to state in the changeset
comment what the problem was and why the patch solves the problem.

A link to a launchpad bug or blueprint would also be nice ;-)

>  mod/silverbox/box.c |   14 ++++++++++----
>  1 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/mod/silverbox/box.c b/mod/silverbox/box.c
> index 8c7243a..daf3298 100644
> --- a/mod/silverbox/box.c
> +++ b/mod/silverbox/box.c
> @@ -931,12 +931,18 @@ prepare_update_fields(struct box_txn *txn, struct tbuf 
> *data, bool old_format)
>  static void
>  tuple_add_iov(struct box_txn *txn, struct box_tuple *tuple)
>  {
> -     tuple_txn_ref(txn, tuple);
> +     size_t len;
>  
> -     add_iov(&tuple->bsize,
> -             tuple->bsize +
> +     len = tuple->bsize +
>               field_sizeof(struct box_tuple, bsize) +
> -             field_sizeof(struct box_tuple, cardinality));
> +             field_sizeof(struct box_tuple, cardinality);
> +
> +     if (len > 8192) {

Let's create a constant for the value, something like
BOX_TUPLE_IO_SIZE_THRESHOLD, document the purpose of the constant,
and use it instead of a hard-coded value.

> +             tuple_txn_ref(txn, tuple);
> +             add_iov(&tuple->bsize, len);
> +     } else {
> +             add_iov_dup(&tuple->bsize, len);
> +     }

Thanks!

-- 
kostja

_______________________________________________
Mailing list: https://launchpad.net/~tarantool-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~tarantool-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to