Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Add object back to memory store when object recovery is skipped #46460

Merged
merged 7 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 6 additions & 0 deletions src/ray/core_worker/object_recovery_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ bool ObjectRecoveryManager::RecoverObject(const ObjectID &object_id) {
} else {
RAY_LOG(DEBUG) << "Object " << object_id
<< " has a pinned or spilled location, skipping recovery";
// If the object doesn't exist in the memory store
// (core_worker.cc removes the object from memory store before calling this method),
// we need to add it back to indicate that it's available.
// If the object is already in the memory store then the put is a no-op.
RAY_CHECK(
in_memory_store_->Put(RayObject(rpc::ErrorType::OBJECT_IN_PLASMA), object_id));
}
return true;
}
Expand Down
24 changes: 24 additions & 0 deletions src/ray/core_worker/test/object_recovery_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,30 @@ TEST_F(ObjectRecoveryManagerTest, TestLineageEvicted) {
rpc::ErrorType::OBJECT_UNRECONSTRUCTABLE_LINEAGE_EVICTED);
}

TEST_F(ObjectRecoveryManagerTest, TestReconstructionSkipped) {
// Test that if the object is already pinned or spilled,
// reconstruction is skipped.
ObjectID object_id = ObjectID::FromRandom();
ref_counter_->AddOwnedObject(object_id,
{},
rpc::Address(),
"",
0,
true,
/*add_local_ref=*/true);
ref_counter_->UpdateObjectPinnedAtRaylet(object_id, NodeID::FromRandom());

memory_store_->Delete({object_id});
ASSERT_TRUE(manager_.RecoverObject(object_id));
ASSERT_TRUE(failed_reconstructions_.empty());
ASSERT_EQ(object_directory_->Flush(), 0);
ASSERT_EQ(raylet_client_->Flush(), 0);
ASSERT_EQ(task_resubmitter_->num_tasks_resubmitted, 0);
bool in_plasma = false;
ASSERT_TRUE(memory_store_->Contains(object_id, &in_plasma));
ASSERT_TRUE(in_plasma);
}

} // namespace core
} // namespace ray

Expand Down