ARROW-2195: [Plasma] Return auto-releasing buffers#1807
ARROW-2195: [Plasma] Return auto-releasing buffers#1807pitrou wants to merge 11 commits intoapache:masterfrom
Conversation
|
This changes/adds some APIs on the CUDA side so will need reviewing from someone familiar with that code base. |
43d488f to
e1a22da
Compare
|
@robertnishihara @pcmoritz @Wapaul1 Is one of you interested in reviewing this? |
8a01b22 to
c0db264
Compare
cpp/src/plasma/common.h
Outdated
There was a problem hiding this comment.
Let's put this into https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/macros.h. It seems more broadly useful for the whole arrow project.
pcmoritz
left a comment
There was a problem hiding this comment.
Thanks for doing this! On a high level, here is what we should attempt: Make it so the new APIs CreateAuto and GetAuto can be used as replacements for Create and Get and then deprecate the old ones and rename CreateAuto -> Create and GetAuto -> Get. I can give some more lower level comments about that in the PR.
cpp/src/plasma/client.cc
Outdated
There was a problem hiding this comment.
we have ARROW_UNUSED for this:
arrow/cpp/src/arrow/util/macros.h
Line 28 in ecb7605
cpp/src/plasma/client.cc
Outdated
There was a problem hiding this comment.
This should be exposed through the Info method, see
Line 301 in ecb7605
Given that is is private, we can leave it for now, but can you create a JIRA for it?
There was a problem hiding this comment.
Info requires an IPC to the plasma store and seems too heavy-weight since this can all be determined with locally available information.
IsInUse is probably better named something like IsInUseByThisClient (that's an ugly name, but I think it's more clear).
We have a lot of code in client.cc that's already doing stuff like
auto elem = objects_in_use_.find(object_id);
if (elem == objects_in_use_.end()) {
...
}so it may make sense for IsInUse to replace some of that code.
cpp/src/plasma/client.cc
Outdated
There was a problem hiding this comment.
Can we get rid of this callback, and do the wrapping into PlasmaBuffer as a post-processing step to GetBuffers?
There was a problem hiding this comment.
That sounds a bit brittle. You want to have a single PlasmaBuffer per exported (e.g. mmap'ed) piece of memory, but both data and metadata share that piece of memory.
|
How do people feel about replacing the old Get and Create methods with new ones which return PlasmaBuffers, and make Release private (which means PlasmaBuffer needs to be friend of PlasmaClient). Given that 0.9 has just been released it might be the right time to do it. |
|
I suppose that depends how you feel about breaking compatibility without notice :-) |
|
Ok, let's do the following:
I'm slightly uncomfortable that the two overloaded ones have different behavior and the same name, but going forward that seems to be the best solution (we should try to avoid having two rounds of deprecations). |
cpp/src/plasma/client.h
Outdated
There was a problem hiding this comment.
It's ok for it to be sealed before it is released.
Maybe "The returned object must be released once it is done with. It must also be either sealed or aborted."?
There was a problem hiding this comment.
Indeed, it seems you're right.
python/pyarrow/plasma.pyx
Outdated
There was a problem hiding this comment.
Should this be changed to use GetAuto?
There was a problem hiding this comment.
Yes, I had overlooked that. Thank you.
cpp/src/plasma/client.cc
Outdated
There was a problem hiding this comment.
There was a problem hiding this comment.
Once we migrate Create() too, yes.
On the C++ side, add a new PlasmaClient::GetAuto() method to return buffers that release the corresponding object on destruction. On the Python side, return such buffers in PlasmaClient.get_buffers().
167dc0c to
e869757
Compare
|
@pcmoritz I would suggest tackling Create() in a separate PR, since there are additional complications in how it interacts with Seal() and Abort(). What do you think? |
e869757 to
04c1842
Compare
04c1842 to
ac2d84c
Compare
|
Note an ideal API would have the Seal(), Abort() and Release() methods on the PlasmaBuffer, not on PlasmaClient. |
cpp/src/arrow/util/macros.h
Outdated
|
|
||
| // ---------------------------------------------------------------------- | ||
| // From googletest | ||
| // XXX also in parquet-cpp |
cpp/src/plasma/test/client_tests.cc
Outdated
| ARROW_CHECK_OK(client2_.Disconnect()); | ||
| system("killall plasma_store &"); | ||
| // Kill all plasma_store processes | ||
| // XXX should only kill the processes we launched |
|
Awesome, this is really great! Let's remove the XXX in the PR and then we can merge it. |
|
Nice job @pitrou! This will be a lot cleaner. Especially once we can do the same thing for |
|
I also created a JIRA for the Create API (very similar to what you propose, in addition it allows us to get rid of the Abort() method): https://issues.apache.org/jira/browse/ARROW-2386 |
|
@pcmoritz I fixed the XXX's. |
|
@pitrou I'm seeing https://issues.apache.org/jira/browse/ARROW-2448 when using this PR. It seems like we need each client to keep track of the buffers that it produces and to invalidate them when the client disconnects (or something like that). cc @pcmoritz |
On the C++ side, add a new PlasmaClient::GetAuto() method to return buffers that release
the corresponding object on destruction.
On the Python side, return such buffers in PlasmaClient.get_buffers().