Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions mooncake-store/src/master_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,18 +1128,41 @@ auto MasterService::ReMountSegment(const std::vector<Segment>& segments,
.get_memory_descriptor()
.buffer_descriptor;
SegmentRestore* match = nullptr;
SegmentRestore* endpoint_match = nullptr;
size_t endpoint_match_count = 0;
for (auto& restore : restores) {
if (descriptor.transport_endpoint_ ==
restore.segment.te_endpoint ||
descriptor.transport_endpoint_ ==
restore.segment.name) {
endpoint_match = &restore;
++endpoint_match_count;
if (descriptor.buffer_address_ <
restore.segment.base ||
descriptor.buffer_address_ -
restore.segment.base >=
restore.segment.size) {
continue;
}
if (match != nullptr) {
ambiguous_endpoint = true;
return;
}
match = &restore;
}
}
// Preserve endpoint-only matching when it is
// unique so allocator restoration validates
// descriptor bounds. Shared endpoints (e.g.
// UB per-NUMA segments) require one address
// range match to disambiguate the segment.
if (endpoint_match_count == 1) {
match = endpoint_match;
} else if (endpoint_match_count > 1 &&
match == nullptr) {
ambiguous_endpoint = true;
return;
}
if (match != nullptr) {
if (descriptor.protocol_ == "cxl") {
unsupported_cxl = true;
Expand Down
Loading