This is an automated email from the ASF dual-hosted git repository.

pcmoritz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 0ecba4f  ARROW-3558: [Plasma] Remove fatal error when calling get on 
unsealed object.
0ecba4f is described below

commit 0ecba4f0479c159be86820096a6acac35088441b
Author: Robert Nishihara <[email protected]>
AuthorDate: Fri Oct 19 13:04:04 2018 -0700

    ARROW-3558: [Plasma] Remove fatal error when calling get on unsealed object.
    
    In addition to removing the fatal error in the case of a timeout, this PR 
also removes the deprecated version of `Get`.
    
    Author: Robert Nishihara <[email protected]>
    
    Closes #2791 from robertnishihara/changeplasmaerror and squashes the 
following commits:
    
    2e60a2b3d <Robert Nishihara> Fix
    7f7a8b54e <Robert Nishihara> Undo removal of old API.
    8770aefe7 <Robert Nishihara> Fix usage of get in plasma_op.
    0ff8602dd <Robert Nishihara> Update java code.
    d11da6c9b <Robert Nishihara> Remove fatal error when calling get on 
unsealed object.
---
 cpp/src/plasma/client.cc            | 13 +++++++++----
 cpp/src/plasma/client.h             | 10 +++++-----
 python/pyarrow/tests/test_plasma.py | 10 ++++++++++
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/cpp/src/plasma/client.cc b/cpp/src/plasma/client.cc
index 7e2ce0f..d37b033 100644
--- a/cpp/src/plasma/client.cc
+++ b/cpp/src/plasma/client.cc
@@ -475,11 +475,16 @@ Status PlasmaClient::Impl::GetBuffers(
       // This object is not currently in use by this client, so we need to send
       // a request to the store.
       all_present = false;
-    } else {
-      // NOTE: If the object is still unsealed, we will deadlock, since we must
-      // have been the one who created it.
-      ARROW_CHECK(object_entry->second->is_sealed)
+    } else if (!object_entry->second->is_sealed) {
+      // This client created the object but hasn't sealed it. If we call Get
+      // with no timeout, we will deadlock, because this client won't be able 
to
+      // call Seal.
+      ARROW_CHECK(timeout_ms != -1)
           << "Plasma client called get on an unsealed object that it created";
+      ARROW_LOG(WARNING)
+          << "Attempting to get an object that this client created but hasn't 
sealed.";
+      all_present = false;
+    } else {
       PlasmaObject* object = &object_entry->second->object;
       std::shared_ptr<Buffer> physical_buf;
 
diff --git a/cpp/src/plasma/client.h b/cpp/src/plasma/client.h
index 59b001c..1ad09f5 100644
--- a/cpp/src/plasma/client.h
+++ b/cpp/src/plasma/client.h
@@ -110,16 +110,16 @@ class ARROW_EXPORT PlasmaClient {
   /// objects have all been created and sealed in the Plasma Store or the
   /// timeout expires.
   ///
+  /// If an object was not retrieved, the corresponding metadata and data
+  /// fields in the ObjectBuffer structure will evaluate to false.
+  /// Objects are automatically released by the client when their buffers
+  /// get out of scope.
+  ///
   /// \param object_ids The IDs of the objects to get.
   /// \param timeout_ms The amount of time in milliseconds to wait before this
   ///        request times out. If this value is -1, then no timeout is set.
   /// \param[out] object_buffers The object results.
   /// \return The return status.
-  ///
-  /// If an object was not retrieved, the corresponding metadata and data
-  /// fields in the ObjectBuffer structure will evaluate to false.
-  /// Objects are automatically released by the client when their buffers
-  /// get out of scope.
   Status Get(const std::vector<ObjectID>& object_ids, int64_t timeout_ms,
              std::vector<ObjectBuffer>* object_buffers);
 
diff --git a/python/pyarrow/tests/test_plasma.py 
b/python/pyarrow/tests/test_plasma.py
index 9229479..25a8aac 100644
--- a/python/pyarrow/tests/test_plasma.py
+++ b/python/pyarrow/tests/test_plasma.py
@@ -280,6 +280,16 @@ class TestPlasmaClient(object):
                 else:
                     assert results[i] is None
 
+        # Test trying to get an object that was created by the same client but
+        # not sealed.
+        object_id = random_object_id()
+        self.plasma_client.create(object_id, 10, b"metadata")
+        assert self.plasma_client.get_buffer(object_id, timeout_ms=0) is None
+        assert self.plasma_client.get_buffer(object_id, timeout_ms=1) is None
+        self.plasma_client.seal(object_id)
+        assert (self.plasma_client.get_buffer(object_id, timeout_ms=0) is
+                not None)
+
     def test_buffer_lifetime(self):
         # ARROW-2195
         arr = pa.array([1, 12, 23, 3, 34], pa.int32())

Reply via email to