mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 19:21:01 +00:00
We start keeping track of mappings IP - host ID. The mappings are between endpoint managers (identified by host IDs) and the hint directories managed by them (represented by IP addresses). This is a prelude to handling IP directories by the hint shard manager. The structure should only be used by the hint manager before it's migrated to using host IDs. The reason for that is that we rely on the information obtained from the structure, but it might not make sense later on. When we start creating directories named after host IDs and there are no longer directories representing IP addresses, there is no relation between host IDs and IPs -- just because the structure is supposed to keep track between endpoint managers and hint directories that represent IP addresses. If they represent host IDs, the connection between the two is lost. Still using the data structure could lead to bugs, e.g. if we tried to associate a given endpoint manager's host ID with its corresponding IP address from locator::token_metadata, it could happen that two different host IDs would be bound to the same IP address by the data structure: node A has IP I1, node A changes its IP to I2, node B changes its IP to I1. Though nodes A and B have different host IDs (because they are unique), the code would try to save hints towards node B in node A's hint directory, which should NOT happen. Relying on the data structure is thus only safe before migrating hinted handoff to using host IDs. It may happen that we save a hint in the hint directory of the wrong node indeed, but since migration to using host IDs is a process that only happens once, it's a price we are ready to pay. It's only imperative to prevent it from happening in normal circumstances.