diff --git a/src/box/applier.cc b/src/box/applier.cc index 02486acaeb5decac91b2d25f265e5fbc9ad79991..dbb4d05f9691ee222873fe48617f32842403e370 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -213,11 +213,11 @@ applier_connect(struct applier *applier) diag_clear(&fiber()->diag); /* - * Tarantool >= 1.7.7: send an IPROTO_REQUEST_VOTE message - * to fetch the master's vclock before proceeding to "join". + * 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. */ - if (applier->version_id >= version_id(1, 7, 7)) { + if (applier->version_id >= version_id(1, 10, 1)) { xrow_encode_vote(&row); coio_write_xrow(coio, &row); coio_read_xrow(coio, ibuf, &row); diff --git a/src/box/applier.h b/src/box/applier.h index fbf1685e78ae0d7b8adab5d82abc3eb2dc6795eb..5a9c40fc84ed1c2d6f4ce4ac48270a55d48581dd 100644 --- a/src/box/applier.h +++ b/src/box/applier.h @@ -94,7 +94,7 @@ struct applier { struct uri uri; /** Remote version encoded as a number, see version_id() macro */ uint32_t version_id; - /** Remote status at time of connect. */ + /** Remote ballot at the time of connect. */ struct ballot ballot; /** Remote address */ union { diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 04b66ee14f5579a8579a1e6cc6a7a112fe840be7..4eb6c9826393f862f700197c4f18d0a1dc397a3d 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -1158,7 +1158,7 @@ iproto_msg_decode(struct iproto_msg *msg, const char **pos, const char *reqend, cmsg_init(&msg->base, subscribe_route); *stop_input = true; break; - case IPROTO_REQUEST_VOTE: /* deprecated. */ + case IPROTO_VOTE_DEPRECATED: case IPROTO_VOTE: cmsg_init(&msg->base, misc_route); break; @@ -1538,11 +1538,11 @@ tx_process_misc(struct cmsg *m) iproto_reply_ok_xc(out, msg->header.sync, ::schema_version); break; - case IPROTO_REQUEST_VOTE: - iproto_reply_request_vote_xc(out, msg->header.sync, - ::schema_version, - &replicaset.vclock, - cfg_geti("read_only")); + case IPROTO_VOTE_DEPRECATED: + iproto_reply_vote_deprecated_xc(out, msg->header.sync, + ::schema_version, + &replicaset.vclock, + cfg_geti("read_only")); break; case IPROTO_VOTE: box_process_vote(&ballot); diff --git a/src/box/iproto_constants.c b/src/box/iproto_constants.c index 3cd91cc4d1e9c4786baec531ac0ba8a3d4476838..3e25204e9af7e5748e37ef2b13b3510a6ee8e985 100644 --- a/src/box/iproto_constants.c +++ b/src/box/iproto_constants.c @@ -169,7 +169,7 @@ const char *iproto_key_strs[IPROTO_KEY_MAX] = { "expression", /* 0x27 */ "operations", /* 0x28 */ "server is ro", /* 0x29 */ - "status", /* 0x2a */ + "ballot", /* 0x2a */ NULL, /* 0x2b */ NULL, /* 0x2c */ NULL, /* 0x2d */ diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h index a4f0f3b01e565611dce04521176bda751615f0cc..108ae00ef9a098f45fcc532ecebfd5efc88f590a 100644 --- a/src/box/iproto_constants.h +++ b/src/box/iproto_constants.h @@ -161,12 +161,9 @@ enum iproto_type { IPROTO_JOIN = 65, /** Replication SUBSCRIBE command */ IPROTO_SUBSCRIBE = 66, - /** - * Vote request command for master election - * DEPRECATED: use IPROTO_VOTE instead - */ - IPROTO_REQUEST_VOTE = 67, - /** Instance status request command */ + /** DEPRECATED: use IPROTO_VOTE instead */ + IPROTO_VOTE_DEPRECATED = 67, + /** Vote request command for master election */ IPROTO_VOTE = 68, /** Vinyl run info stored in .index file */ diff --git a/src/box/xrow.c b/src/box/xrow.c index 499379bcf7f98e0d8b0f0976bf1cdde282608536..bd85d6bd4a1708422f370a9564d733350ae17793 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -311,9 +311,10 @@ iproto_reply_ok(struct obuf *out, uint64_t sync, uint32_t schema_version) } int -iproto_reply_request_vote(struct obuf *out, uint64_t sync, - uint32_t schema_version, const struct vclock *vclock, - bool read_only) +iproto_reply_vote_deprecated(struct obuf *out, uint64_t sync, + uint32_t schema_version, + const struct vclock *vclock, + bool read_only) { size_t max_size = IPROTO_HEADER_LEN + mp_sizeof_map(2) + mp_sizeof_uint(UINT32_MAX) + mp_sizeof_vclock(vclock) + @@ -904,7 +905,7 @@ xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) if (mp_check(&tmp, end) != 0 || mp_typeof(*data) != MP_MAP) goto err; - /* Find STATUS key. */ + /* Find BALLOT key. */ uint32_t map_size = mp_decode_map(&data); for (uint32_t i = 0; i < map_size; i++) { if (mp_typeof(*data) != MP_UINT) { @@ -918,7 +919,7 @@ xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) if (data == end) return 0; - /* Decode STATUS map. */ + /* Decode BALLOT map. */ map_size = mp_decode_map(&data); for (uint32_t i = 0; i < map_size; i++) { if (mp_typeof(*data) != MP_UINT) { diff --git a/src/box/xrow.h b/src/box/xrow.h index 4653aff2df070de4d8104ddede0814205b48c2d5..01a9544ea2a468a00af54d081cfe64aaaba8cb62 100644 --- a/src/box/xrow.h +++ b/src/box/xrow.h @@ -223,7 +223,7 @@ xrow_encode_auth(struct xrow_header *row, const char *salt, size_t salt_len, const char *login, size_t login_len, const char *password, size_t password_len); -/** Instance status. */ +/** Reply to IPROTO_VOTE request. */ struct ballot { /** Set if the instance is running in read-only mode. */ bool is_ro; @@ -234,7 +234,7 @@ struct ballot { /** * Decode ballot response to IPROTO_VOTE from MessagePack. * @param row Row to decode. - * @param[out] status + * @param[out] ballot Where to store the decoded ballot. */ int xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot); @@ -388,8 +388,8 @@ int iproto_reply_ok(struct obuf *out, uint64_t sync, uint32_t schema_version); /** - * Encode iproto header with IPROTO_OK response code. DEPRECATED. - * and vclock in the body. + * Encode iproto header with IPROTO_OK response code and vclock + * in the body. This function is DEPRECATED. * @param out Encode to. * @param sync Request sync. * @param schema_version. @@ -400,14 +400,14 @@ iproto_reply_ok(struct obuf *out, uint64_t sync, uint32_t schema_version); * @retval -1 Memory error. */ int -iproto_reply_request_vote(struct obuf *out, uint64_t sync, - uint32_t schema_version, const struct vclock *vclock, - bool read_only); +iproto_reply_vote_deprecated(struct obuf *out, uint64_t sync, + uint32_t schema_version, + const struct vclock *vclock, bool read_only); /** - * Encode a reply to an instance status request. + * Encode a reply to an IPROTO_VOTE request. * @param out Buffer to write to. - * @param status Instance status to encode. + * @param ballot Ballot to encode. * @param sync Request sync. * @param schema_version Actual schema version. * @@ -672,23 +672,23 @@ iproto_reply_ok_xc(struct obuf *out, uint64_t sync, uint32_t schema_version) diag_raise(); } -/** @copydoc iproto_reply_request_vote. */ +/** @copydoc iproto_reply_vote_deprecated. */ static inline void -iproto_reply_request_vote_xc(struct obuf *out, uint64_t sync, - uint32_t schema_version, - const struct vclock *vclock, bool read_only) +iproto_reply_vote_deprecated_xc(struct obuf *out, uint64_t sync, + uint32_t schema_version, + const struct vclock *vclock, bool read_only) { - if (iproto_reply_request_vote(out, sync, schema_version, - vclock, read_only) != 0) + if (iproto_reply_vote_deprecated(out, sync, schema_version, + vclock, read_only) != 0) diag_raise(); } -/** @copydoc iproto_reply_status. */ +/** @copydoc iproto_reply_vote. */ static inline void -iproto_reply_vote_xc(struct obuf *out, const struct ballot *status, +iproto_reply_vote_xc(struct obuf *out, const struct ballot *ballot, uint64_t sync, uint32_t schema_version) { - if (iproto_reply_vote(out, status, sync, schema_version) != 0) + if (iproto_reply_vote(out, ballot, sync, schema_version) != 0) diag_raise(); }