From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Serge Petrenko <sergepetrenko@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 00:15:10 +0200 [thread overview]
Message-ID: <45e563d5-9f23-581d-2453-a5b5b06abf22@tarantool.org> (raw)
In-Reply-To: <ae6301a1adf8bd6ae0b69085b387748ffc2551cc.1592482315.git.sergepetrenko@tarantool.org>
Thanks for the patch!
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
next prev parent reply other threads:[~2020-06-18 22:15 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 [this message]
2020-06-19 17:28 ` Serge Petrenko
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=45e563d5-9f23-581d-2453-a5b5b06abf22@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=gorcunov@gmail.com \
--cc=sergepetrenko@tarantool.org \
--cc=tarantool-patches@dev.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