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
12 changes: 12 additions & 0 deletions mooncake-store/src/master_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3497,6 +3497,12 @@ tl::expected<void, ErrorCode> MasterService::CopyEnd(
LOG(ERROR) << "key=" << key << ", source_id=" << source_id
<< ", status=" << (source == nullptr ? "nullptr" : "invalid")
<< ", copy source becomes invalid during data transfer";
// Release the refcnt taken in CopyStart. The success path below does
// this once the copy completes; this error path must do it too, or the
// source replica stays pinned and can never be evicted.
if (source != nullptr) {
source->dec_refcnt();
}
// Discard target replicas and clear the replication task.
EraseReplicasWithCacheTotalAccounting(
metadata, [&task](const Replica& replica) {
Expand Down Expand Up @@ -3724,6 +3730,12 @@ tl::expected<void, ErrorCode> MasterService::MoveEnd(
LOG(ERROR) << "key=" << key << ", source_id=" << source_id
<< ", status=" << (source == nullptr ? "nullptr" : "invalid")
<< ", move source becomes invalid during data transfer";
// Release the refcnt taken in MoveStart. The success path below does
// this once the move completes; this error path must do it too, or the
// source replica stays pinned and can never be evicted.
if (source != nullptr) {
source->dec_refcnt();
}
// Discard target replica and clear the replication task.
EraseReplicasWithCacheTotalAccounting(
metadata, [&task](const Replica& replica) {
Expand Down
Loading