-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[object store refactor 1/n] Introduce IAllocator and PlasmaAllocator #17307
Conversation
8bb8d09
to
ae21707
Compare
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.
LGTM!! Most of comments are comment updates.
@@ -64,10 +65,22 @@ ray::ObjectID GetCreateRequestObjectId(const std::vector<uint8_t> &message) { | |||
return ray::ObjectID::FromBinary(request->object_id()->str()); | |||
} | |||
|
|||
void ToPlasmaObject(const ObjectTableEntry &entry, PlasmaObject *object, |
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.
Why don't we just return the Plasma object instead of accepting mutable arg?
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.
There is some subtlety at the caller of ToPlasmaObject. Let's defer that to follow up PRs.
void *pointer = PlasmaAllocator::Memalign( | ||
kBlockSize, PlasmaAllocator::GetFootprintLimit() - 256 * sizeof(size_t)); | ||
RAY_CHECK(pointer != nullptr); | ||
// TODO(scv119): this leaks details of PlasmaAlloctor, |
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.
Why don't we just fix it here?
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.
is fixed in next PR!
@@ -49,4 +41,6 @@ struct MmapRecord { | |||
/// and size. | |||
extern std::unordered_map<void *, MmapRecord> mmap_records; | |||
|
|||
/// private function, only used by PlasmaAllocator | |||
bool GetMallocMapinfo(void *addr, MEMFD_TYPE *fd, int64_t *map_length, ptrdiff_t *offset); |
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.
If it's a get, please mark it as const
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.
this is unfortunate a C function. I'll make addr const.
I feel fine about this one. Only one nit. |
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.
LGTM. It'll be great if we can run the nightly before merging this...
54bb716
to
28fe635
Compare
Let me know when it is mergeable! |
Problem
There are two major issues with plasma store:
Which makes the IO layer unstable & vulnerable to race conditions & slow to develop.
Goal
The goal is to make local object management unit testable, easy to extend, and hide implementation detail from the upper layer.
Phase 1: Unit test all major components:
This is the first PR that refactors object store. Next PR #17313
Specifically in this PR, we creates IAllocator interface thats allocates mmaped memories, and refactor the PlasmaAllocator to implement this interface.
Test Plan
-[x] existing tests
-[ ] on demand stress tests
-[x] more unit test coming in follow up PR #17313
Note: I'm trying out stack PRs in ray-project/test-wheels branch so that we can get signals from CI, so we need merge PRs in sequence.