Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/4] xrow: fix comment typo
Date: Fri, 19 Jun 2020 20:28:32 +0300	[thread overview]
Message-ID: <19c81031-454c-b8a0-0434-e311d604677b@tarantool.org> (raw)
In-Reply-To: <45e563d5-9f23-581d-2453-a5b5b06abf22@tarantool.org>


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

  reply	other threads:[~2020-06-19 17:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 12:13 [Tarantool-patches] [PATCH 0/4] sync replication: add rollback processing Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 1/4] xrow: fix comment typo Serge Petrenko
2020-06-18 22:15   ` Vladislav Shpilevoy
2020-06-18 22:15   ` Vladislav Shpilevoy
2020-06-19 17:28     ` Serge Petrenko [this message]
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 2/4] xrow: add ability to encode/decode ROLLBACK requests Serge Petrenko
2020-06-18 14:46   ` Cyrill Gorcunov
2020-06-19 17:30     ` Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 3/4] txn_limbo: add timeout when waiting for acks Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 4/4] txn_limbo: add ROLLBACK processing Serge Petrenko
2020-06-18 22:15   ` Vladislav Shpilevoy
2020-06-19 17:35     ` Serge Petrenko
2020-06-21 15:53       ` Vladislav Shpilevoy
2020-06-19 17:53   ` Serge Petrenko
2020-06-23  8:37   ` Serge Petrenko
2020-06-25 22:14   ` Vladislav Shpilevoy
2020-06-25 22:43     ` Vladislav Shpilevoy

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=19c81031-454c-b8a0-0434-e311d604677b@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/4] xrow: fix comment typo' \
    /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