jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Ryan <mattr...@apache.org>
Subject Re: Document deletion check
Date Tue, 13 Oct 2020 15:51:42 GMT
Hi Feng,

You said:

> I am working on JackRabbit Oak, and have questions about the node
deletion.

Do you mean you are working on an application that uses Jackrabbit Oak?  Or
do you mean that you are working on a code contribution to Jackrabbit Oak?

Assuming you are working on an application that uses Jackrabbit Oak, the
proper way to check whether a node is deleted is via the JCR API.  Use the
"exists" methods of the Session object, e.g.:

  session.nodeExists("/path/to/node");

See [0] for the specification.  An example of this in the Oak unit tests is
at [1].


Your application should not be checking the node storage backend (MySQL in
your case) to determine if a node is deleted, nor really for any reason.
The node storage backend is an implementation detail, as is the schema
being used, and could change.


[0] -
https://docs.adobe.com/docs/en/spec/jcr/2.0/5_Reading.html#5.1.2%20Testing%20for%20Existence%20by%20Absolute%20Path
[1] -
https://github.com/apache/jackrabbit-oak/blob/23e0e73c86544a731d4dd4fdff5c36b852446956/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java#L1360


- Matt Ryan



On Mon, Oct 12, 2020 at 3:09 PM fengiaw <fengiaw@163.com> wrote:

> Hi Jackrabbit Dev Team,
>
> I am working on JackRabbit Oak, and have questions about the node deletion.
> Our backend store is using mysql.
>
> From Jackrabbit documentation, I see this "The _deleted sub-document
> contains the revision this node was created in. In the above example the
> root node was created in revision r13f3875b5d1-0-1. If the node is later
> deleted, the _deleted sub-document will get a new field with the revision
> the node was deleted in."
> And I can see this "_deleted" in mysql in the "data" field,
> So I  reply on the "_deleted" field, and tried to use the latest value of
> it to determine whether it's gotten deleted.
> For example,
> _deleted={r173bcb4360b-0-34d=false, r173bcb2fb8f-0-34d=false,
> r173bcaf6d2c-0-34e=false, r173bcae10fa-0-350=false,
> r173bcac5862-0-34d=false, r173bcac5859-0-34d=false,
> r173bc9bf9f0-0-342=false, r173bc9a42ce-0-343=false,
> r173bc994dce-0-34d=false, r173bc962853-0-34d=false,
> r173bc942ceb-0-34d=false, r173baa5a789-0-329=true,
> r1739196c343-1-2e9=false}.
>
> The latest value is "r173bcb4360b-0-34d=false", base on this, I assume
> it's not deleted. But actually, I have deleted this node via our UI, and it
> disappears in explorer as well.
> And there are some cases that we did not delete the anything, but the
> "_deleted" field shows the last revison as "true", which means it's gotten
> deleted.
> Thsi quite confuses us.
> So the question here is without mysql db connection (active jcr instance)
> what is the best/correct way to determin a node indeed exists or gets
> deleted from the mysql record?
>
> Thank for your support,
> Feng
>
>
>
>
>

Mime
View raw message