You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Julian Reschke <ju...@gmx.de> on 2014/04/08 19:56:29 UTC

UpdateOp containing tests vs DocumentStore API

Hi,

in the MongoDocumentStore, it depends on what method is used whether 
conditional checks in the UpdateOp happen or not.

I believe I have copied these checks correctly in RDBDocumentStore, but 
still wonder why this is needed?

If a call doesn't need conditional checks, why is it made with the 
checks in the UpdateOp in the first place?

So, as an experiment, I tried to do the checks all the time, and I'm getting

   Failed tests: 
gcSplitDocs[1](org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollectorTest): 
expected:<PROP_COMMIT_ONLY> but was:<NONE>

Is this expected? I think it would be really good if the DS could do the 
conditional check all the time; maybe it's worth looking into this?

Best regards, Julian

RE: UpdateOp containing tests vs DocumentStore API

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

> in the MongoDocumentStore, it depends on what method is used whether
> conditional checks in the UpdateOp happen or not.
> 
> I believe I have copied these checks correctly in RDBDocumentStore, but
> still wonder why this is needed?

it shouldn't be needed because only findAndModify() is specified to check
conditions if present on the UpdateOp. The other methods like
createOrUpdate(), update() or create() do not check conditions and the
MongoDocumentStore simply ignores them if there are any in the UpdateOp.

> If a call doesn't need conditional checks, why is it made with the
> checks in the UpdateOp in the first place?

I'm not sure I understand your question. The expectation is that those
calls that do not check conditions get UpdateOps without conditions.

> So, as an experiment, I tried to do the checks all the time, and I'm getting
> 
>    Failed tests:
> gcSplitDocs[1](org.apache.jackrabbit.oak.plugins.document.VersionGarbage
> CollectorTest):
> expected:<PROP_COMMIT_ONLY> but was:<NONE>
> 
> Is this expected? I think it would be really good if the DS could do the
> conditional check all the time; maybe it's worth looking into this?

no, I would expect the test passes even if you always check a condition
when present.

it may make sense to tighten the contract of the methods and require
an implementation to throw an IllegalArgumentException if the UpdateOp
contains a condition for a method that does not check them.

Regards
 Marcel