commit 5ebbed7711d442e9b5ea21703c4aa5ba613a1a5d from: Vladislav Shpilevoy date: Tue Jun 04 19:52:03 2024 UTC relay: rename vclock args and make const It wasn't clear which of them are inputs and which are outputs. The patch explicitly marks the input vclocks as const. It makes the code a bit easier to read inside of relay.cc knowing that these vclocks shouldn't change. Alongside "replica_clock" in subscribe is renamed to "start_vclock". To make it consistent with relay_final_join(), and to signify that technically it doesn't have to be a replica vclock. It isn't really. Box.cc alters the replica's vclock before giving it to relay, which means it is no longer "replica clock". In scope of #10047 NO_TEST=refactoring NO_CHANGELOG=refactoring NO_DOC=refactoring commit - 4dc0c1ea06c485d5f0b14358d90e0d90e8d45711 commit + 5ebbed7711d442e9b5ea21703c4aa5ba613a1a5d blob - 7035821d76c17a20774025ba9b3fbea2c6b46170 blob + 4c550c6b3c65aed1d27fb8b4a0692c67f06863c6 --- src/box/relay.cc +++ src/box/relay.cc @@ -532,7 +532,8 @@ relay_final_join_f(va_list ap) void relay_final_join(struct replica *replica, struct iostream *io, uint64_t sync, - struct vclock *start_vclock, struct vclock *stop_vclock) + const struct vclock *start_vclock, + const struct vclock *stop_vclock) { /* * As a new thread is started for the final join stage, its cancellation @@ -1092,7 +1093,7 @@ relay_subscribe_f(va_list ap) /** Replication acceptor fiber handler. */ void relay_subscribe(struct replica *replica, struct iostream *io, uint64_t sync, - struct vclock *replica_clock, uint32_t replica_version_id, + const struct vclock *start_vclock, uint32_t replica_version_id, uint32_t replica_id_filter, uint64_t sent_raft_term) { assert(replica->anon || replica->id != REPLICA_ID_NIL); @@ -1112,9 +1113,9 @@ relay_subscribe(struct replica *replica, struct iostre /* * Save the first vclock as 'received'. Because it was really received. */ - vclock_copy(&relay->last_recv_ack.vclock, replica_clock); - relay->r = recovery_new(wal_dir(), false, replica_clock); - vclock_copy(&relay->tx.vclock, replica_clock); + vclock_copy(&relay->last_recv_ack.vclock, start_vclock); + relay->r = recovery_new(wal_dir(), false, start_vclock); + vclock_copy(&relay->tx.vclock, start_vclock); relay->version_id = replica_version_id; relay->id_filter |= replica_id_filter; blob - f33b076d81baaa15c9d44c371c48bef633fc2df8 blob + 87b7d7c591574702f92fab281a606a502d2f31fd --- src/box/relay.h +++ src/box/relay.h @@ -135,7 +135,8 @@ relay_initial_join(struct iostream *io, uint64_t sync, */ void relay_final_join(struct replica *replica, struct iostream *io, uint64_t sync, - struct vclock *start_vclock, struct vclock *stop_vclock); + const struct vclock *start_vclock, + const struct vclock *stop_vclock); /** * Subscribe a replica to updates. @@ -144,7 +145,7 @@ relay_final_join(struct replica *replica, struct iostr */ void relay_subscribe(struct replica *replica, struct iostream *io, uint64_t sync, - struct vclock *replica_vclock, uint32_t replica_version_id, + const struct vclock *start_vclock, uint32_t replica_version_id, uint32_t replica_id_filter, uint64_t sent_raft_term); #endif /* TARANTOOL_REPLICATION_RELAY_H_INCLUDED */