You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Marcel Reutegger (JIRA)" <ji...@apache.org> on 2015/04/22 17:04:59 UTC

[jira] [Commented] (OAK-2804) Conditional remove on DocumentStore

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

Marcel Reutegger commented on OAK-2804:
---------------------------------------

Added a new method:

{noformat}
    /**
     * Batch remove documents with given keys and corresponding conditions. Keys
     * for documents that do not exist are simply ignored. A document is only
     * removed if the corresponding conditions are met. If this method fails
     * with an exception, then only some of the documents may have been removed.
     *
     * @param <T> the document type
     * @param collection the collection.
     * @param toRemove the keys of the documents to remove with the
     *                 corresponding conditions.
     * @return the number of removed documents.
     */
    <T extends Document> int remove(Collection<T> collection,
                                     Map<String, Map<UpdateOp.Key, UpdateOp.Condition>> toRemove);
{noformat}

Implementations for {{MemoryDocumentStore}} and {{MongoDocumentStore}} is done already. {{RDBDocumentStore}} is still missing.

Work in progress committed to trunk: http://svn.apache.org/r1675382

> Conditional remove on DocumentStore
> -----------------------------------
>
>                 Key: OAK-2804
>                 URL: https://issues.apache.org/jira/browse/OAK-2804
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core, mongomk
>            Reporter: Marcel Reutegger
>            Assignee: Marcel Reutegger
>             Fix For: 1.3.0
>
>
> The DocumentStore API allows for conditional inserts (only add document if not present yet) and updates (using findAndModify() with a condition), but it doesn't allow you to remove a document given some conditions are met.
> This feature is required to make sure the VersionGarbageCollector does not remove document that are modified concurrently. See OAK-2778.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)