Skip to content

Conversation

@boda26
Copy link
Collaborator

@boda26 boda26 commented Oct 27, 2025

  1. Cluster Map Object Implementation
  2. Refresh ClusterMap at the start of each fanout operation; fanout operations use targets from ClusterMap object

…nout and use targets from cluster map object

Signed-off-by: Miles Song <[email protected]>
@boda26 boda26 requested a review from allenss-amazon October 27, 2025 21:00
@yairgott
Copy link
Collaborator

I think that it would be much more efficient if the engine allow subscription to a notification mechanism which is triggered once the slot assignment is changed. @murphyjacob4 , wdyt?

shard.slots_fingerprint = 0;
new_map->shards_[master_id] = std::move(shard);
} else {
it->second.owned_slots.insert(slot_set.begin(), slot_set.end());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this list of nodes doesn't match the previous set?

it->second.owned_slots.insert(slot_set.begin(), slot_set.end());
}
}
new_map->is_cluster_map_full_ = assigned_slots.all();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the fingerprints for each shard being computed?

Comment on lines 384 to 403
if (owned_count > 0) {
std::string owned_ranges;
int range_start = -1;
int range_end = -1;
for (size_t i = 0; i < k_num_slots; i++) {
if (map->owned_slots_[i]) {
if (range_start == -1) {
range_start = i;
range_end = i;
} else if (i == range_end + 1) {
range_end = i;
} else {
if (!owned_ranges.empty()) owned_ranges += ", ";
owned_ranges +=
std::to_string(range_start) + "-" + std::to_string(range_end);
range_start = i;
range_end = i;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not save the slot ranges as they came in originally?

@boda26
Copy link
Collaborator Author

boda26 commented Oct 29, 2025

Updated ClusterMap Implementation (significant change)

  1. added a configurable ClusterMap expiration timestamp, only refresh when it expires
  2. created a slot-to-shard map (map start slot to end slot and ShardInfo), enable efficient slot to shard retrieval
  3. shard-level and cluster-level fingerprint
  4. complete redesign of CreateNewClusteMap, entirely eliminated GetTargets, building shard map and target vectors altogether with only one CLUSTER SLOTS call to core
  5. redesign of GetRandomTargets, randomly picking one node from each shard in pre-computed shard map

@boda26
Copy link
Collaborator Author

boda26 commented Oct 29, 2025

Todo: create a SocketAddress struct for ip and port

@boda26 boda26 requested a review from allenss-amazon October 29, 2025 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants