Skip to content
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

Merged
merged 4 commits into from
Jul 20, 2017
Merged

Conversation

TylerADavis
Copy link
Collaborator

@TylerADavis TylerADavis commented Jul 12, 2017

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

@TylerADavis TylerADavis requested a review from jcarreira July 12, 2017 19:04
@TylerADavis
Copy link
Collaborator Author

@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?

@@ -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();
Copy link
Owner

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++

http://en.cppreference.com/w/cpp/atomic/atomic

@TylerADavis
Copy link
Collaborator Author

@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++;
Copy link
Owner

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.

@TylerADavis
Copy link
Collaborator Author

Latest commit adds an explanation, let me know what you think

@jcarreira jcarreira merged commit 670d5f8 into master Jul 20, 2017
@jcarreira jcarreira deleted the fix_test_mt branch July 27, 2017 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants