-
Notifications
You must be signed in to change notification settings - Fork 7k
[Core] Ownership-based Object Directory - Added support for object spilling in the ownership-based object directory. #13948
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
Merged
rkooo567
merged 6 commits into
ray-project:master
from
clarkzinzow:core/feat/obod-object-spilling
Feb 11, 2021
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7503cb1
Add support for object spilling in the ownership-based object directory.
clarkzinzow 9a6a3b4
Move owner address hashmap into pinned_objects_ and objects_pending_s…
clarkzinzow aedebdb
Update local object manager tests.
clarkzinzow 5116209
Feedback and misc. fixes.
clarkzinzow ce8f30c
Move spilled unpin callback lambda to std::binded private method.
clarkzinzow e383d85
Skip test_delete_objects_multi_node test on MacOS for now.
clarkzinzow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1263,6 +1263,8 @@ void CoreWorker::SpillOwnedObject(const ObjectID &object_id, | |
| RAY_LOG(ERROR) << "Failed to spill object " << object_id | ||
| << ", raylet unreachable or object could not be spilled."; | ||
| } | ||
| // TODO(Clark): Provide spilled URL and spilled node ID to callback so it can | ||
| // added them to the reference. | ||
| callback(); | ||
| }); | ||
| } | ||
|
|
@@ -1273,6 +1275,7 @@ Status CoreWorker::SpillObjects(const std::vector<ObjectID> &object_ids) { | |
| auto ready_promise = std::make_shared<std::promise<void>>(std::promise<void>()); | ||
| Status final_status; | ||
|
|
||
| // TODO(Clark): Add spilled URL and spilled node ID to reference in this callback. | ||
| auto callback = [mutex, num_remaining, ready_promise]() { | ||
| absl::MutexLock lock(mutex.get()); | ||
| (*num_remaining)--; | ||
|
|
@@ -1312,7 +1315,10 @@ Status CoreWorker::SpillObjects(const std::vector<ObjectID> &object_ids) { | |
| ready_promise->get_future().wait(); | ||
|
|
||
| for (const auto &object_id : object_ids) { | ||
| reference_counter_->HandleObjectSpilled(object_id); | ||
| // TODO(Clark): Move this to the callback (unless we really wanted to batch it) and | ||
| // also include the spilled URL, spilled node ID, and updated object size. | ||
| reference_counter_->HandleObjectSpilled(object_id, "", NodeID::Nil(), -1, | ||
| /*release*/ true); | ||
| } | ||
| return final_status; | ||
| } | ||
|
|
@@ -2221,15 +2227,19 @@ void CoreWorker::HandleGetObjectLocationsOwner( | |
| auto object_id = ObjectID::FromBinary(request.object_id()); | ||
| const auto &callback = [object_id, reply, send_reply_callback]( | ||
| const absl::flat_hash_set<NodeID> &locations, | ||
| int64_t object_size, int64_t current_version) { | ||
| int64_t object_size, const std::string &spilled_url, | ||
| const NodeID &spilled_node_id, int64_t current_version) { | ||
| RAY_LOG(DEBUG) << "Replying to HandleGetObjectLocationsOwner for " << object_id | ||
| << " with location update version " << current_version << ", " | ||
| << locations.size() << " locations, and " << object_size | ||
| << " object size."; | ||
| << locations.size() << " locations, " << spilled_url | ||
| << " spilled url, " << spilled_node_id << " spilled node ID, and " | ||
| << object_size << " object size."; | ||
| for (const auto &node_id : locations) { | ||
| reply->add_node_ids(node_id.Binary()); | ||
| } | ||
| reply->set_object_size(object_size); | ||
| reply->set_spilled_url(spilled_url); | ||
| reply->set_spilled_node_id(spilled_node_id.Binary()); | ||
| reply->set_current_version(current_version); | ||
| send_reply_callback(Status::OK(), nullptr, nullptr); | ||
| }; | ||
|
|
@@ -2422,7 +2432,13 @@ void CoreWorker::HandleSpillObjects(const rpc::SpillObjectsRequest &request, | |
| for (const auto &id_binary : request.object_ids_to_spill()) { | ||
| object_ids_to_spill.push_back(ObjectID::FromBinary(id_binary)); | ||
| } | ||
| std::vector<std::string> object_urls = options_.spill_objects(object_ids_to_spill); | ||
| std::vector<std::string> owner_addresses; | ||
| owner_addresses.reserve(request.owner_addresses_size()); | ||
| for (const auto &owner_address : request.owner_addresses()) { | ||
| owner_addresses.push_back(owner_address.SerializeAsString()); | ||
| } | ||
| std::vector<std::string> object_urls = | ||
| options_.spill_objects(object_ids_to_spill, owner_addresses); | ||
| for (size_t i = 0; i < object_urls.size(); i++) { | ||
| reply->add_spilled_objects_url(std::move(object_urls[i])); | ||
| } | ||
|
|
@@ -2433,6 +2449,24 @@ void CoreWorker::HandleSpillObjects(const rpc::SpillObjectsRequest &request, | |
| } | ||
| } | ||
|
|
||
| void CoreWorker::HandleAddSpilledUrl(const rpc::AddSpilledUrlRequest &request, | ||
| rpc::AddSpilledUrlReply *reply, | ||
| rpc::SendReplyCallback send_reply_callback) { | ||
| const ObjectID object_id = ObjectID::FromBinary(request.object_id()); | ||
| const std::string &spilled_url = request.spilled_url(); | ||
| const NodeID node_id = NodeID::FromBinary(request.spilled_node_id()); | ||
| RAY_LOG(DEBUG) << "Received AddSpilledUrl request for object " << object_id | ||
| << ", which has been spilled to " << spilled_url << " on node " | ||
| << node_id; | ||
| auto reference_exists = reference_counter_->HandleObjectSpilled( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
| object_id, spilled_url, node_id, request.size(), /*release*/ false); | ||
| Status status = | ||
| reference_exists | ||
| ? Status::OK() | ||
| : Status::ObjectNotFound("Object " + object_id.Hex() + " not found"); | ||
| send_reply_callback(status, nullptr, nullptr); | ||
| } | ||
|
|
||
| void CoreWorker::HandleRestoreSpilledObjects( | ||
| const rpc::RestoreSpilledObjectsRequest &request, | ||
| rpc::RestoreSpilledObjectsReply *reply, rpc::SendReplyCallback send_reply_callback) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this
=*mean?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's how you define optional arguments in Cython
.pxdheader files: https://cython.readthedocs.io/en/stable/src/userguide/language_basics.html#optional-arguments