[ 
https://issues.apache.org/jira/browse/ARROW-1775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16242966#comment-16242966
 ] 

ASF GitHub Bot commented on ARROW-1775:
---------------------------------------

wesm commented on a change in pull request #1289: ARROW-1775: Ability to abort 
created but unsealed Plasma objects
URL: https://github.com/apache/arrow/pull/1289#discussion_r149512465
 
 

 ##########
 File path: cpp/src/plasma/client.cc
 ##########
 @@ -278,6 +278,43 @@ Status PlasmaClient::Get(const ObjectID* object_ids, 
int64_t num_objects,
   return Status::OK();
 }
 
+/// This is a helper method for unmapping objects for which all references have
+/// gone out of scope, either by calling Release or Abort.
+///
+/// @param object_id The object ID whose data we should unmap.
+Status PlasmaClient::UnmapObject(const ObjectID& object_id) {
+  auto object_entry = objects_in_use_.find(object_id);
+  ARROW_CHECK(object_entry != objects_in_use_.end());
+  ARROW_CHECK(object_entry->second->count == 0);
+
+  // Decrement the count of the number of objects in this memory-mapped file
+  // that the client is using. The corresponding increment should have
+  // happened in plasma_get.
+  int fd = object_entry->second->object.handle.store_fd;
+  auto entry = mmap_table_.find(fd);
+  ARROW_CHECK(entry != mmap_table_.end());
+  ARROW_CHECK(entry->second.count >= 1);
+  if (entry->second.count == 1) {
+    // If no other objects are being used, then unmap the file.
+    int err = munmap(entry->second.pointer, entry->second.length);
+    if (err == -1) {
+      return Status::IOError("Error during munmap");
+    }
+    // Remove the corresponding entry from the hash table.
+    mmap_table_.erase(fd);
 
 Review comment:
   If munmap fails, what should happen to this `fd`? I guess it would be an 
esoteric failure

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Ability to abort created but unsealed Plasma objects
> ----------------------------------------------------
>
>                 Key: ARROW-1775
>                 URL: https://issues.apache.org/jira/browse/ARROW-1775
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Plasma (C++)
>            Reporter: Stephanie Wang
>              Labels: pull-request-available
>
> It would be useful to allow a Plasma client to abort an object that it 
> created but hasn't yet sealed. After the abort, it should appear as if the 
> object was never created all. The logic is similar to the delete case, except 
> that the client must release the object atomically with the removal of the 
> object from the cache and store.
> In Ray, for example, we need this for the distributed version of the Plasma 
> store, where many Plasma clients transfer objects to each other. If a sending 
> Plasma client fails during a transfer, we want to make sure that the 
> receiving client can abort the transfer, so that we can later recreate the 
> object successfully. Otherwise, we will fail with an error that the object 
> already exists.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to