[Tarantool-patches] [PATCH 1/4] xrow: fix comment typo

Serge Petrenko sergepetrenko at tarantool.org
Fri Jun 19 20:28:32 MSK 2020


19.06.2020 01:15, Vladislav Shpilevoy пишет:
> Thanks for the patch!

Hi! Thanks for the review!

>
> Consider these changes (you maybe should keep the old names,
> mine are probably worse):
>
> ====================
> diff --git a/src/box/xrow.c b/src/box/xrow.c
> index 7a79a18dd..5055cba46 100644
> --- a/src/box/xrow.c
> +++ b/src/box/xrow.c
> @@ -879,8 +879,8 @@ xrow_encode_dml(const struct request *request, struct region *region,
>   }
>   
>   int
> -xrow_encode_confirm_rollback(struct xrow_header *row, uint32_t replica_id,
> -			     int64_t lsn)
> +xrow_encode_synchro_finish(struct xrow_header *row, uint32_t replica_id,
> +			   int64_t lsn, int type)
>   {
>   	size_t len = mp_sizeof_map(2) + mp_sizeof_uint(IPROTO_REPLICA_ID) +
>   		     mp_sizeof_uint(replica_id) + mp_sizeof_uint(IPROTO_LSN) +
> @@ -903,6 +903,7 @@ xrow_encode_confirm_rollback(struct xrow_header *row, uint32_t replica_id,
>   	row->body[0].iov_base = buf;
>   	row->body[0].iov_len = len;
>   	row->bodycnt = 1;
> +	row->type = type;
>   
>   	return 0;
>   }
> @@ -910,26 +911,19 @@ xrow_encode_confirm_rollback(struct xrow_header *row, uint32_t replica_id,
>   int
>   xrow_encode_confirm(struct xrow_header *row, uint32_t replica_id, int64_t lsn)
>   {
> -	int res = xrow_encode_confirm_rollback(row, replica_id, lsn);
> -	if (res == 0) {
> -		row->type = IPROTO_CONFIRM;
> -	}
> -	return res;
> +	return xrow_encode_synchro_finish(row, replica_id, lsn, IPROTO_CONFIRM);
>   }
>   
>   int
>   xrow_encode_rollback(struct xrow_header *row, uint32_t replica_id, int64_t lsn)
>   {
> -	int res = xrow_encode_confirm_rollback(row, replica_id, lsn);
> -	if (res == 0) {
> -		row->type = IPROTO_ROLLBACK;
> -	}
> -	return res;
> +	return xrow_encode_synchro_finish(row, replica_id, lsn,
> +					  IPROTO_ROLLBACK);
>   }
>   
>   int
> -xrow_decode_confirm_rollback(struct xrow_header *row, uint32_t *replica_id,
> -			     int64_t *lsn)
> +xrow_decode_synchro_finish(struct xrow_header *row, uint32_t *replica_id,
> +			   int64_t *lsn)
>   {
>   	if (row->bodycnt == 0) {
>   		diag_set(ClientError, ER_INVALID_MSGPACK, "request body");
> @@ -976,14 +970,17 @@ xrow_decode_confirm_rollback(struct xrow_header *row, uint32_t *replica_id,
>   	return 0;
>   }
>   
> -int xrow_decode_confirm(struct xrow_header *row, uint32_t *replica_id, int64_t *lsn)
> +int
> +xrow_decode_confirm(struct xrow_header *row, uint32_t *replica_id, int64_t *lsn)
>   {
> -	return xrow_decode_confirm_rollback(row, replica_id, lsn);
> +	return xrow_decode_synchro_finish(row, replica_id, lsn);
>   }
>   
> -int xrow_decode_rollback(struct xrow_header *row, uint32_t *replica_id, int64_t *lsn)
> +int
> +xrow_decode_rollback(struct xrow_header *row, uint32_t *replica_id,
> +		     int64_t *lsn)
>   {
> -	return xrow_decode_confirm_rollback(row, replica_id, lsn);
> +	return xrow_decode_synchro_finish(row, replica_id, lsn);
>   }
>   
>   int


I applied your diff while keeping the old names and squashed the commit

into the one introducing CONFIRM entry.

(This answer is both for patches 1 and 2, since you answered here)

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list