diff --git a/src/box/box.cc b/src/box/box.cc index eb9baa4b82d3d0bfd65a6b2febad71b7537d1946..ead02c58c1e2269dab77f5cad40de5aeee91584f 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1669,7 +1669,7 @@ box_issue_promote(uint32_t prev_leader_id, int64_t promote_lsn) txn_limbo_write_promote(&txn_limbo, promote_lsn, raft->term); struct synchro_request req = { - .type = IPROTO_PROMOTE, + .type = IPROTO_RAFT_PROMOTE, .replica_id = prev_leader_id, .origin_id = instance_id, .lsn = promote_lsn, @@ -1691,7 +1691,7 @@ box_issue_demote(uint32_t prev_leader_id, int64_t promote_lsn) txn_limbo_write_demote(&txn_limbo, promote_lsn, box_raft()->term); struct synchro_request req = { - .type = IPROTO_DEMOTE, + .type = IPROTO_RAFT_DEMOTE, .replica_id = prev_leader_id, .origin_id = instance_id, .lsn = promote_lsn, diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h index b9498868cb319adc4b799ee9e8e04c5383d4d4b0..8792737b2686624fd0aeb06c32fce436b87099cb 100644 --- a/src/box/iproto_constants.h +++ b/src/box/iproto_constants.h @@ -242,14 +242,14 @@ enum iproto_type { IPROTO_RAFT = 30, /** PROMOTE request. */ - IPROTO_PROMOTE = 31, + IPROTO_RAFT_PROMOTE = 31, /** DEMOTE request. */ - IPROTO_DEMOTE = 32, + IPROTO_RAFT_DEMOTE = 32, /** A confirmation message for synchronous transactions. */ - IPROTO_CONFIRM = 40, + IPROTO_RAFT_CONFIRM = 40, /** A rollback message for synchronous transactions. */ - IPROTO_ROLLBACK = 41, + IPROTO_RAFT_ROLLBACK = 41, /** PING request */ IPROTO_PING = 64, @@ -314,13 +314,13 @@ iproto_type_name(uint16_t type) switch (type) { case IPROTO_RAFT: return "RAFT"; - case IPROTO_PROMOTE: + case IPROTO_RAFT_PROMOTE: return "PROMOTE"; - case IPROTO_DEMOTE: + case IPROTO_RAFT_DEMOTE: return "DEMOTE"; - case IPROTO_CONFIRM: + case IPROTO_RAFT_CONFIRM: return "CONFIRM"; - case IPROTO_ROLLBACK: + case IPROTO_RAFT_ROLLBACK: return "ROLLBACK"; case VY_INDEX_RUN_INFO: return "RUNINFO"; @@ -371,15 +371,15 @@ dml_request_key_map(uint16_t type) static inline bool iproto_type_is_synchro_request(uint16_t type) { - return type == IPROTO_CONFIRM || type == IPROTO_ROLLBACK || - type == IPROTO_PROMOTE || type == IPROTO_DEMOTE; + return type == IPROTO_RAFT_CONFIRM || type == IPROTO_RAFT_ROLLBACK || + type == IPROTO_RAFT_PROMOTE || type == IPROTO_RAFT_DEMOTE; } /** PROMOTE/DEMOTE entry (synchronous replication and leader elections). */ static inline bool iproto_type_is_promote_request(uint32_t type) { - return type == IPROTO_PROMOTE || type == IPROTO_DEMOTE; + return type == IPROTO_RAFT_PROMOTE || type == IPROTO_RAFT_DEMOTE; } static inline bool diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c index 69a16f8ea6069c56992e7710e1b71351157da1c8..70ce7312fbe59fc399f2db7767e2a6e7f838d9af 100644 --- a/src/box/memtx_engine.c +++ b/src/box/memtx_engine.c @@ -229,7 +229,7 @@ memtx_engine_recover_raft(const struct xrow_header *row) static int memtx_engine_recover_synchro(const struct xrow_header *row) { - assert(row->type == IPROTO_PROMOTE); + assert(row->type == IPROTO_RAFT_PROMOTE); struct synchro_request req; if (xrow_decode_synchro(row, &req) != 0) return -1; @@ -250,7 +250,7 @@ memtx_engine_recover_snapshot_row(struct memtx_engine *memtx, if (row->type != IPROTO_INSERT) { if (row->type == IPROTO_RAFT) return memtx_engine_recover_raft(row); - if (row->type == IPROTO_PROMOTE) + if (row->type == IPROTO_RAFT_PROMOTE) return memtx_engine_recover_synchro(row); diag_set(ClientError, ER_UNKNOWN_REQUEST_TYPE, (uint32_t) row->type); diff --git a/src/box/txn.c b/src/box/txn.c index b80e722a4bfe473fbf5289ba0a1434a0e9868eb9..e057d2762176d4a576ea57172cb2f8b5812b7a42 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -407,7 +407,7 @@ txn_commit_stmt(struct txn *txn, struct request *request) /* * Create WAL record for the write requests in * non-temporary spaces. stmt->space can be NULL for - * IRPOTO_NOP or IPROTO_CONFIRM. + * IRPOTO_NOP or IPROTO_RAFT_CONFIRM. */ if (stmt->space == NULL || !space_is_temporary(stmt->space)) { if (txn_add_redo(txn, stmt, request) != 0) diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index 570f77c46ca49118b36bd2a7e7c8555e408c681d..70447caafafcaa049a8bf4880d6bd421d02ff96f 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -305,7 +305,7 @@ void txn_limbo_checkpoint(const struct txn_limbo *limbo, struct synchro_request *req) { - req->type = IPROTO_PROMOTE; + req->type = IPROTO_RAFT_PROMOTE; req->replica_id = limbo->owner_id; req->lsn = limbo->confirmed_lsn; req->term = limbo->promote_greatest_term; @@ -372,7 +372,7 @@ txn_limbo_write_confirm(struct txn_limbo *limbo, int64_t lsn) assert(lsn > limbo->confirmed_lsn); assert(!limbo->is_in_rollback); limbo->confirmed_lsn = lsn; - txn_limbo_write_synchro(limbo, IPROTO_CONFIRM, lsn, 0); + txn_limbo_write_synchro(limbo, IPROTO_RAFT_CONFIRM, lsn, 0); } /** Confirm all the entries <= @a lsn. */ @@ -450,7 +450,7 @@ txn_limbo_write_rollback(struct txn_limbo *limbo, int64_t lsn) assert(lsn > limbo->confirmed_lsn); assert(!limbo->is_in_rollback); limbo->is_in_rollback = true; - txn_limbo_write_synchro(limbo, IPROTO_ROLLBACK, lsn, 0); + txn_limbo_write_synchro(limbo, IPROTO_RAFT_ROLLBACK, lsn, 0); limbo->is_in_rollback = false; } @@ -498,7 +498,7 @@ txn_limbo_write_promote(struct txn_limbo *limbo, int64_t lsn, uint64_t term) struct txn_limbo_entry *e = txn_limbo_last_synchro_entry(limbo); assert(e == NULL || e->lsn <= lsn); (void) e; - txn_limbo_write_synchro(limbo, IPROTO_PROMOTE, lsn, term); + txn_limbo_write_synchro(limbo, IPROTO_RAFT_PROMOTE, lsn, term); limbo->is_in_rollback = false; } @@ -526,7 +526,7 @@ txn_limbo_write_demote(struct txn_limbo *limbo, int64_t lsn, uint64_t term) struct txn_limbo_entry *e = txn_limbo_last_synchro_entry(limbo); assert(e == NULL || e->lsn <= lsn); (void)e; - txn_limbo_write_synchro(limbo, IPROTO_DEMOTE, lsn, term); + txn_limbo_write_synchro(limbo, IPROTO_RAFT_DEMOTE, lsn, term); limbo->is_in_rollback = false; } @@ -768,16 +768,16 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) lsn = 0; } switch (req->type) { - case IPROTO_CONFIRM: + case IPROTO_RAFT_CONFIRM: txn_limbo_read_confirm(limbo, lsn); break; - case IPROTO_ROLLBACK: + case IPROTO_RAFT_ROLLBACK: txn_limbo_read_rollback(limbo, lsn); break; - case IPROTO_PROMOTE: + case IPROTO_RAFT_PROMOTE: txn_limbo_read_promote(limbo, req->origin_id, lsn); break; - case IPROTO_DEMOTE: + case IPROTO_RAFT_DEMOTE: txn_limbo_read_demote(limbo, lsn); break; default: diff --git a/src/box/xrow.h b/src/box/xrow.h index cb83fddff3fec1814a9beb565cb4029e976c2963..d32dcbc0d7c4c86b3602791baf1f3b7d31b1de40 100644 --- a/src/box/xrow.h +++ b/src/box/xrow.h @@ -233,8 +233,8 @@ xrow_encode_dml(const struct request *request, struct region *region, */ struct synchro_request { /** - * Operation type - either IPROTO_ROLLBACK or IPROTO_CONFIRM or - * IPROTO_PROMOTE + * Operation type - either IPROTO_RAFT_ROLLBACK or IPROTO_RAFT_CONFIRM + * or IPROTO_RAFT_PROMOTE */ uint16_t type; /**