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

ARROW-3958: [Plasma] Reduce number of IPCs #3124

Closed
wants to merge 12 commits into from
Closed
19 changes: 8 additions & 11 deletions cpp/src/plasma/test/client_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ class TestPlasmaStore : public ::testing::Test {

void CreateObject(PlasmaClient& client, const ObjectID& object_id,
const std::vector<uint8_t>& metadata,
const std::vector<uint8_t>& data) {
const std::vector<uint8_t>& data,
bool release = true) {
std::shared_ptr<Buffer> data_buffer;
ARROW_CHECK_OK(client.Create(object_id, data.size(), &metadata[0], metadata.size(),
&data_buffer));
for (size_t i = 0; i < data.size(); i++) {
data_buffer->mutable_data()[i] = data[i];
}
ARROW_CHECK_OK(client.Seal(object_id));
ARROW_CHECK_OK(client.Release(object_id));
if (release) {
ARROW_CHECK_OK(client.Release(object_id));
}
}

const std::string& GetStoreSocketName() const { return store_socket_name_; }
Expand Down Expand Up @@ -155,11 +158,12 @@ TEST_F(TestPlasmaStore, SealErrorsTest) {

// Create object.
std::vector<uint8_t> data(100, 0);
CreateObject(client_, object_id, {42}, data);
CreateObject(client_, object_id, {42}, data, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug that was masked by the release_delay before. If we call Release before the second Seal, the result status will be "PlasmaObjectNonexistent" instead of "PlasmaObjectAlreadySealed".


// Trying to seal it again.
result = client_.Seal(object_id);
ASSERT_TRUE(result.IsPlasmaObjectAlreadySealed());
ARROW_CHECK_OK(client_.Release(object_id));
}

TEST_F(TestPlasmaStore, DeleteTest) {
Expand Down Expand Up @@ -228,13 +232,7 @@ TEST_F(TestPlasmaStore, DeleteObjectsTest) {
// client2_ won't send the release request immediately because the trigger
// condition is not reached. The release is only added to release cache.
object_buffers.clear();
// The reference count went to zero, but the objects are still in the release
// cache.
ARROW_CHECK_OK(client_.Contains(object_id1, &has_object));
ASSERT_TRUE(has_object);
ARROW_CHECK_OK(client_.Contains(object_id2, &has_object));
ASSERT_TRUE(has_object);
// The Delete call will flush release cache and send the Delete request.
// Delete the objects.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is not needed any more (there is no release cache any more)

result = client2_.Delete(std::vector<ObjectID>{object_id1, object_id2});
ARROW_CHECK_OK(client_.Contains(object_id1, &has_object));
ASSERT_FALSE(has_object);
Expand Down Expand Up @@ -386,7 +384,6 @@ TEST_F(TestPlasmaStore, AbortTest) {
// Test that we can get the object.
ARROW_CHECK_OK(client_.Get({object_id}, -1, &object_buffers));
AssertObjectBufferEqual(object_buffers[0], {42, 43}, {1, 2, 3, 4, 5});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following line was a bug masked by the release cache. This form of get calls Release in the destructor of the PlasmaBuffer shared pointer.

ARROW_CHECK_OK(client_.Release(object_id));
}

TEST_F(TestPlasmaStore, MultipleClientTest) {
Expand Down