* [PATCH] applier: ignore ER_UNKNOWN_REQUEST_TYPE for IPROTO_VOTE
@ 2018-08-29 14:56 Vladimir Davydov
0 siblings, 0 replies; only message in thread
From: Vladimir Davydov @ 2018-08-29 14:56 UTC (permalink / raw)
To: kostja; +Cc: tarantool-patches
IPROTO_VOTE command (successor of IPROTO_REQUEST_VOTE) was introduced in
Tarantool 1.10.1. It is sent by an applier to its master only if the
master is running Tarantool 1.10.1 or newer. However, the master may be
running a Tarantool version 1.10.1 that isn't aware of IPROTO_VOTE, in
which case the applier will fail to connect with ER_UNKNOWN_REQUEST_TYPE
error.
Let's fix this issue by ignoring ER_UNKNOWN_REQUEST_TYPE received in
reply to IPROTO_VOTE command.
---
https://github.com/tarantool/tarantool/commits/dv/applier-ignore-unknown-request-error-on-vote
src/box/applier.cc | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/box/applier.cc b/src/box/applier.cc
index 28df8f7c..7c4fc224 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -213,17 +213,24 @@ applier_connect(struct applier *applier)
diag_clear(&fiber()->diag);
/*
- * Tarantool >= 1.10.1: send an IPROTO_VOTE request to
- * fetch the master's ballot before proceeding to "join".
- * It will be used for leader election on bootstrap.
+ * Send an IPROTO_VOTE request to fetch the master's ballot
+ * before proceeding to "join". It will be used for leader
+ * election on bootstrap.
*/
- if (applier->version_id >= version_id(1, 10, 1)) {
- xrow_encode_vote(&row);
- coio_write_xrow(coio, &row);
- coio_read_xrow(coio, ibuf, &row);
- if (row.type != IPROTO_OK)
- xrow_decode_error_xc(&row);
+ xrow_encode_vote(&row);
+ coio_write_xrow(coio, &row);
+ coio_read_xrow(coio, ibuf, &row);
+ if (row.type == IPROTO_OK) {
xrow_decode_ballot_xc(&row, &applier->ballot);
+ } else try {
+ xrow_decode_error_xc(&row);
+ } catch (ClientError *e) {
+ if (e->errcode() != ER_UNKNOWN_REQUEST_TYPE)
+ e->raise();
+ /*
+ * Master isn't aware of IPROTO_VOTE request.
+ * It's OK - we can proceed without it.
+ */
}
applier_set_state(applier, APPLIER_CONNECTED);
--
2.11.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-29 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29 14:56 [PATCH] applier: ignore ER_UNKNOWN_REQUEST_TYPE for IPROTO_VOTE Vladimir Davydov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox