-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-4418 [Plasma] replace event loop with boost::asio for plasma store #3704
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
Conversation
|
@suquark Can you remove the asio commit? We don't want to commit asio into here, let me know if you need help to integrate asio into the build system! |
|
@pcmoritz Yes, I would like to know how to integrate asio. Should we download the source when building plasma? |
a45202c to
37fb5d2
Compare
|
I have rebased the branch to resolve conflicts. |
|
@suquark Just FYI. If I understand correctly boost::asio::local::stream_protocol is only supported on POSIX systems, on windows you might need boost::asio::windows::stream_handle or local TCP? Also on linux it's reported that AF_UNIX is has better performance over tcp, thus it might not be very desirable to use local TCP on all platforms. |
9967441 to
14b25ea
Compare
565ceda to
10f28fd
Compare
|
@robertnishihara @pcmoritz It is ready for review. The CI failure comes from the master branch. |
|
I have removed most unix-only headers for cross-platform compiling, but we still cannot build it on Windows because the shared memory operation is not windows-compatible. I would like to fix this in a following PR. |
cpp/src/plasma/CMakeLists.txt
Outdated
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 should be formatted more like the following to be consistent with ThirdpartyToolchain.cmake. Maybe even consider to add it there?
ExternalProject_Add(asio_ep
URL https://github.com/chriskohlhoff/asio/archive/asio-1-12-2.zip
CONFIGURE_COMMAND "" # No autogen since we use asio in header-only way.
BUILD_IN_SOURCE 1
BUILD_COMMAND ""
INSTALL_COMMAND
cmake -E copy asio/include/asio.hpp ${OUTPUT_DIR}/.. &&
cmake -E copy_directory asio/include/asio ${OUTPUT_DIR}/../asio/)
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 was formatted by the cmake format checker. I can move it into ThirdpartyToolchain.cmake to keep the currect format.
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.
Can you hang on until the CMake refactor is merged to make sure this doesn't conflict (easier to fix this PR than to fix that)?
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.
Sure. Which PR is about CMake refactor?
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 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 not currently used, right? Let's remove it!
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.
I created this because we can use it under windows. Windows do not support unix domain sockets, so we can use tcp socket instead (or we can use UDP, since it would be more efficient).
And do you know how to build it with the CI under windows?
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.
An if condition would be more idiomatic here I think
cpp/src/plasma/io/basic_connection.h
Outdated
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.
Let's rename this to PlasmaStream (UPPER_CASE should be reserved for macros)
cpp/src/plasma/io/basic_connection.h
Outdated
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.
Let's rename this to PlasmaAcceptor
|
@zhijunfu would you be interested in reviewing this PR? |
…elegate class. This provides less "pluggability" but I think still offers a clean model for extension (subsystems can wrap the constructor for there purposes, and provide external static methods to check for particular types of errors). Author: Micah Kornfield <emkornfield@gmail.com> Author: Antoine Pitrou <antoine@python.org> Closes apache#4484 from emkornfield/status_code_proposal and squashes the following commits: 4d1ab8d <Micah Kornfield> don't import plasma errors directly into top level pyarrow module a66f999 <Micah Kornfield> make format 040216d <Micah Kornfield> fixes for comments outside python 729bba1 <Antoine Pitrou> Fix Py2 issues (hopefully) ea56d1e <Antoine Pitrou> Fix PythonErrorDetail to store Python error state (and restore it in check_status()) 21e1b95 <Micah Kornfield> fix compilation 9c905b0 <Micah Kornfield> fix lint 74d563c <Micah Kornfield> fixes 85786ef <Micah Kornfield> change messages 3626a90 <Micah Kornfield> try removing message a4e6a1f <Micah Kornfield> add logging for debug 4586fd1 <Micah Kornfield> fix typo 8f011b3 <Micah Kornfield> fix status propagation 317ea9c <Micah Kornfield> fix complie 9f59160 <Micah Kornfield> don't make_shared inline 484b3a2 <Micah Kornfield> style fix 14e3467 <Micah Kornfield> dont rely on rtti cd22df6 <Micah Kornfield> format dec4585 <Micah Kornfield> not-quite pluggable error codes
|
@pcmoritz I have seen you removing the independent asio headers. Why doing so? |
|
@suquark This way it is easier to integrate with Ray's build system (we already have boost as a dependency in both arrow's and Ray's build system so it seems logical to use them). I did it with minimal modification so it's easy to change, but I don't see a clear advantage of using the standalone one right now, do you? :) |
|
@pcmoritz Oh, that makes sense then. Thx for doing that. |
ed180da to
85fe336
Compare
|
What are the next steps with this PR? |
|
@emkornfield I am going to fix these conflicts, and hopefully we can get it merged in the next few weeks. |
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.
@suquark this looks like a good start on an ambitious change. Could you rebase please?
|
|
||
| #include "arrow/status.h" | ||
|
|
||
| namespace asio = boost::asio; |
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.
Global namespace aliases in non-internal headers are against our coding style. Please either remove these aliases or confine them to the plasma::io namespace
|
|
||
| -------------------------------------------------------------------------------- | ||
|
|
||
| This project includes code from the Boost project |
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 is this notation necessary?
| // under the License. | ||
|
|
||
| #ifndef PLASMA_IO_CONNECTION_H | ||
| #define PLASMA_IO_CONNECTION_H |
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.
| #define PLASMA_IO_CONNECTION_H | |
| #pragma once |
| } | ||
|
|
||
| // We have to fill the template of all possible types. | ||
| template class Connection<PlasmaStream>; |
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.
An extern template like this is extremely difficult to get working under MSVC, and you only instantiate this template once anyway. Why is this a template instead of just defining PlasmaConnection directly in connection.h?
| /// Disconnect a client from the PlasmaStore. | ||
| /// | ||
| /// \param client The client that is disconnected. | ||
| void ProcessDisconnectClient(const std::shared_ptr<ClientConnection>& client); |
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 the Process prefix?
| if [ "${have_gandiva}" = "yes" ]; then | ||
| apt install -y -V libgandiva-glib-dev=${deb_version} | ||
| apt install -y -V libgandiva-glib-doc=${deb_version} | ||
| # apt install -y -V libgandiva-glib-doc=${deb_version} |
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's this change about?
|
|
||
| struct GetRequest { | ||
| GetRequest(Client* client, const std::vector<ObjectID>& object_ids); | ||
| GetRequest(asio::io_context& io_context, |
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.
Although it's not the asio pattern, it may be necessary to pass these around by pointer to appease cpplint
| } | ||
|
|
||
| // Send the get reply to the client. | ||
| Status s = SendGetReply(client, &object_ids[0], objects, object_ids.size(), store_fds, |
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.
Nit: this looks like it could segfault if object_ids is empty. Could be made more clear with:
| Status s = SendGetReply(client, &object_ids[0], objects, object_ids.size(), store_fds, | |
| Status s = SendGetReply(client, object_ids.data(), objects, object_ids.size(), store_fds, |
|
@suquark do you think you will have time to rebase and address the feedback? |
|
@suquark thank you for the PR if you have time to update it, please reopen. closing for now do to lack of response. |
|
Sorry for my late response. Let me try to address these issues. |
This is replacing the socket based IO with boost asio so plasma can be ported to windows.