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

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

JinHai-CN commented on a change in pull request #1427: ARROW-1927: [Plasma] Add 
delete function
URL: https://github.com/apache/arrow/pull/1427#discussion_r157923946
 
 

 ##########
 File path: cpp/src/plasma/client.cc
 ##########
 @@ -501,9 +501,20 @@ Status PlasmaClient::Abort(const ObjectID& object_id) {
 }
 
 Status PlasmaClient::Delete(const ObjectID& object_id) {
-  // TODO(rkn): In the future, we can use this method to give hints to the
-  // eviction policy about when an object will no longer be needed.
-  return Status::NotImplemented("PlasmaClient::Delete is not implemented.");
+  RETURN_NOT_OK(FlushReleaseHistory());
+  // If the object is in used, client can't send the remove message.
+  if (objects_in_use_.count(object_id) > 0) {
+    return Status::UnknownError("PlasmaClient::Object is in used.");
+  } else {
+    // If we don't already have a reference to the object, we can try to 
remove the object
+    RETURN_NOT_OK(SendDeleteRequest(store_conn_, object_id));
+    std::vector<uint8_t> buffer;
+    RETURN_NOT_OK(PlasmaReceive(store_conn_, MessageType_PlasmaDeleteReply, 
&buffer));
 
 Review comment:
   Yes, just update operation. And it can be implemented as: check contains, 
delete, check contains again to make it happen. 
   Currently, only two reasons: not sealed object and object is in use will 
make the DELETE operation failed. We can make it as non-blocking API. But when 
I look at other APIs such as CREATE, they also will provide the reply to the 
client. I think DELETE operation should follow the same way as CREATE operation.

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


> [Plasma] Implement delete function
> ----------------------------------
>
>                 Key: ARROW-1927
>                 URL: https://issues.apache.org/jira/browse/ARROW-1927
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Plasma (C++), Python
>            Reporter: Philipp Moritz
>              Labels: pull-request-available
>
> The function should check if the reference count of the object is zero and if 
> yes, delete it from the store. If no, it should raise an exception or return 
> a status value.



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

Reply via email to