Skip to content

Commit

Permalink
storage_service: rename join_token_ring to join_topology
Browse files Browse the repository at this point in the history
After introducing zero-token nodes that call join_token_ring but do
not join the ring, the join_token_ring name does not make much sense.
  • Loading branch information
patjed41 committed Aug 29, 2024
1 parent 9937cf3 commit c25eefe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cdc/generation_service.hh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public:
* that generation timestamp moved in as the `startup_gen_id` parameter.
* This passes the responsibility of managing generations from the node startup code to this service;
* until then, the service remains dormant.
* At the time of writing this comment, the startup code is in `storage_service::join_token_ring`, hence
* The startup code is in `storage_service::join_topology`, hence
* `after_join` should be called at the end of that function.
* Precondition: the node has completed bootstrapping and system_distributed_keyspace is initialized.
* Must be called on shard 0 - that's where the generation management happens.
Expand Down
14 changes: 7 additions & 7 deletions service/storage_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ future<> storage_service::await_tablets_rebuilt(raft::server_id replaced_id) {
slogger.info("Tablet replicas from the replaced node have been rebuilt");
}

future<> storage_service::join_token_ring(sharded<db::system_distributed_keyspace>& sys_dist_ks,
future<> storage_service::join_topology(sharded<db::system_distributed_keyspace>& sys_dist_ks,
sharded<service::storage_proxy>& proxy,
std::unordered_set<gms::inet_address> initial_contact_nodes,
std::unordered_map<locator::host_id, gms::loaded_endpoint_state> loaded_endpoints,
Expand All @@ -1507,13 +1507,13 @@ future<> storage_service::join_token_ring(sharded<db::system_distributed_keyspac
* This value is nullopt only when:
* 1. this node is being upgraded from a non-CDC version,
* 2. this node is starting for the first time or restarting with CDC previously disabled,
* in which case the value should become populated before we leave the join_token_ring procedure.
* in which case the value should become populated before we leave the join_topology procedure.
*
* Important: this variable is using only during the startup procedure. It is moved out from
* at the end of `join_token_ring`; the responsibility handling of CDC generations is passed
* at the end of `join_topology`; the responsibility handling of CDC generations is passed
* to cdc::generation_service.
*
* DO NOT use this variable after `join_token_ring` (i.e. after we call `generation_service::after_join`
* DO NOT use this variable after `join_topology` (i.e. after we call `generation_service::after_join`
* and pass it the ownership of the timestamp.
*/
std::optional<cdc::generation_id> cdc_gen_id;
Expand Down Expand Up @@ -1865,7 +1865,7 @@ future<> storage_service::join_token_ring(sharded<db::system_distributed_keyspac
set_mode(mode::NORMAL);

if (get_token_metadata().sorted_tokens().empty()) {
auto err = ::format("join_token_ring: Sorted token in token_metadata is empty");
auto err = ::format("join_topology: Sorted token in token_metadata is empty");
slogger.error("{}", err);
throw std::runtime_error(err);
}
Expand Down Expand Up @@ -2043,7 +2043,7 @@ future<> storage_service::join_token_ring(sharded<db::system_distributed_keyspac
set_mode(mode::NORMAL);

if (get_token_metadata().sorted_tokens().empty()) {
auto err = ::format("join_token_ring: Sorted token in token_metadata is empty");
auto err = ::format("join_topology: Sorted token in token_metadata is empty");
slogger.error("{}", err);
throw std::runtime_error(err);
}
Expand Down Expand Up @@ -3013,7 +3013,7 @@ future<> storage_service::join_cluster(sharded<db::system_distributed_keyspace>&
// We must allow restarts of zero-token nodes in the gossip-based topology due to the recovery mode.
}

co_return co_await join_token_ring(sys_dist_ks, proxy, std::move(initial_contact_nodes),
co_return co_await join_topology(sys_dist_ks, proxy, std::move(initial_contact_nodes),
std::move(loaded_endpoints), std::move(loaded_peer_features), get_ring_delay(), start_hm, new_generation);
}

Expand Down
2 changes: 1 addition & 1 deletion service/storage_service.hh
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ private:
bool should_bootstrap();
bool is_replacing();
bool is_first_node();
future<> join_token_ring(sharded<db::system_distributed_keyspace>& sys_dist_ks,
future<> join_topology(sharded<db::system_distributed_keyspace>& sys_dist_ks,
sharded<service::storage_proxy>& proxy,
std::unordered_set<gms::inet_address> initial_contact_nodes,
std::unordered_map<locator::host_id, gms::loaded_endpoint_state> loaded_endpoints,
Expand Down

0 comments on commit c25eefe

Please sign in to comment.