-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fixed test_mt and made TCPClient threadsafe #83
Conversation
@jcarreira I realized that the CacheManager is likely not thread safe at the moment due to the lack of locks on the cache itself. Assuming that having a thread safe CacheManager is a priority, would it be better to simply add a around the map used as the cache, or to convert the map into a cuckoo map or another thread safe map implementation? |
src/client/TCPClient.cpp
Outdated
@@ -103,15 +104,18 @@ cirrus::Future TCPClient::write_async(ObjectID oid, const void* data, | |||
auto msg_contents = message::TCPBladeMessage::CreateWrite(*builder, | |||
oid, | |||
data_fb_vector); | |||
curr_txn_id_lock.wait(); |
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 don't think you need this. There are atomic types in C++
@jcarreira latest commit addresses your comment. |
@@ -103,15 +105,16 @@ cirrus::Future TCPClient::write_async(ObjectID oid, const void* data, | |||
auto msg_contents = message::TCPBladeMessage::CreateWrite(*builder, | |||
oid, | |||
data_fb_vector); | |||
const int txn_id = curr_txn_id++; |
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.
As far as I understand, you use a map txn_id->txn_info to keep the state of a put/get operation. This is necessary because our network layer works as an event handler.
I think this needs to be briefly explained in the code. Probably in a comment to txn_map
.
Latest commit adds an explanation, let me know what you think |
Fixes #45 . Changed the
test_mt
test so that each thread works in its own range.Updated TCPClient so that it is thread safe.
The RDMA Client hangs in the new test, so I'm thinking there's some element that is not thread safe. I'll look into this further, but the changes elsewhere are still good to be looked over. I've opened an issue in #84