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 "jorgeeflorez ." <jo...@gmail.com> on 2020/02/21 20:12:47 UTC

Versionable node deletion

Hi,
when I delete a node that has version history, using node.remove() and then
session.save(), should all version info related to that node be deleted
automatically? what about the files in that version history?

After deleting, I print all nodes of the repository and I keep seeing those
version nodes. Actually, I was working with a repository uses a
DataStoreBlobStore and after deleting some file nodes I was expecting that
the total size of the folder that contains the files would decrease and it
did not happen, which led me to make this question :)

Thanks.

Jorge

Re: Versionable node deletion

Posted by Julian Sedding <js...@gmail.com>.
Hi Jorge

If you're looking at reclaiming disk space from "orphaned" binaries,
you likely need Blob Garbage Collection:
https://jackrabbit.apache.org/oak/docs/plugins/blobstore.html#Blob_Garbage_Collection

Regards
Julian

On Mon, Feb 24, 2020 at 3:58 PM jorgeeflorez .
<jo...@gmail.com> wrote:
>
> Hi Marco,
> I agree, it is related to OAK-8048.
>
> > But since it
> > isn't, there is still one node that references the binary, so (the binary)
> > is not removed when running the garbage collector.
> >
> > I am not sure about this. I just printed the rootVersion node and it has
> nothing related to the node that was deleted, this is an example:
>
> "node": "jcr:rootVersion",
> "path":
> "/jcr:system/jcr:versionStorage/03/06/92/03069247-5a8e-4957-89d6-3ccaf32edad3/jcr:rootVersion",
> "mixins": [],
> "children": [{
>      "node": "jcr:frozenNode",
>      "path":
> "/jcr:system/jcr:versionStorage/03/06/92/03069247-5a8e-4957-89d6-3ccaf32edad3/jcr:rootVersion/jcr:frozenNode",
>      "mixins": [],
>      "children": [],
>      "properties": [
>          "jcr:frozenPrimaryType = nt:file",
>          "jcr:frozenUuid = 03069247-5a8e-4957-89d6-3ccaf32edad3",
>          "jcr:primaryType = nt:frozenNode",
>          "jcr:uuid = 3a63f325-2e8b-415e-8aa1-6112d4a9049a",
>          "jcr:frozenMixinTypes =
> mix:lastModified,mix:referenceable,rep:AccessControllable,mix:versionable"
>     ]
> }],
> "properties": [
>      "jcr:predecessors = ",
>      "jcr:created = 2020-02-21T17:42:44.771-05:00",
>      "jcr:primaryType = nt:version",
>      "jcr:uuid = a3eae304-16f2-438d-a482-e6dbf5b3d198",
>      "jcr:successors = "
> ]
>
> Thinking about what I want, maybe it is not that easy to mark a binary as
> "orphan" (i.e. no node is referencing it) in runtime. But it would be great
> of some method could be called that gets all orphan binaries and deletes
> them. To save space. I do not if something like that exists.
>
> Jorge
>
>
> El lun., 24 feb. 2020 a las 9:17, Marco Piovesana (<pi...@esteco.com>)
> escribió:
>
> > Hi Jorge,
> > I'm not an expert, but I think it might be related to OAK-804
> > <https://issues.apache.org/jira/browse/OAK-8048>. The root version should
> > be automatically removed when removing the last version. But since it
> > isn't, there is still one node that references the binary, so (the binary)
> > is not removed when running the garbage collector.
> >
> > Marco.
> >
> > On Mon, Feb 24, 2020 at 9:42 PM jorgeeflorez . <
> > jorgeeduardoflorez@gmail.com>
> > wrote:
> >
> > > Hi,
> > > I managed to delete all versions for nodes that no longer exist (except
> > the
> > > jcr:rootVersion nodes, they are "protected"). I was expecting that the
> > > total size of my binary storage would decrease (I am using
> > > OakFileDataStore), since some files are no longer referenced in any
> > nodes.
> > > But that did not happen...
> > >
> > > Any help is appreciated.
> > >
> > > Jorge
> > >
> > > El vie., 21 feb. 2020 a las 15:12, jorgeeflorez . (<
> > > jorgeeduardoflorez@gmail.com>) escribió:
> > >
> > > > Hi,
> > > > when I delete a node that has version history, using node.remove() and
> > > > then session.save(), should all version info related to that node be
> > > > deleted automatically? what about the files in that version history?
> > > >
> > > > After deleting, I print all nodes of the repository and I keep seeing
> > > > those version nodes. Actually, I was working with a repository uses a
> > > > DataStoreBlobStore and after deleting some file nodes I was expecting
> > > that
> > > > the total size of the folder that contains the files would decrease and
> > > it
> > > > did not happen, which led me to make this question :)
> > > >
> > > > Thanks.
> > > >
> > > > Jorge
> > > >
> > >
> >

Re: Versionable node deletion

Posted by "jorgeeflorez ." <jo...@gmail.com>.
Hi Marco,
I agree, it is related to OAK-8048.

> But since it
> isn't, there is still one node that references the binary, so (the binary)
> is not removed when running the garbage collector.
>
> I am not sure about this. I just printed the rootVersion node and it has
nothing related to the node that was deleted, this is an example:

"node": "jcr:rootVersion",
"path":
"/jcr:system/jcr:versionStorage/03/06/92/03069247-5a8e-4957-89d6-3ccaf32edad3/jcr:rootVersion",
"mixins": [],
"children": [{
     "node": "jcr:frozenNode",
     "path":
"/jcr:system/jcr:versionStorage/03/06/92/03069247-5a8e-4957-89d6-3ccaf32edad3/jcr:rootVersion/jcr:frozenNode",
     "mixins": [],
     "children": [],
     "properties": [
         "jcr:frozenPrimaryType = nt:file",
         "jcr:frozenUuid = 03069247-5a8e-4957-89d6-3ccaf32edad3",
         "jcr:primaryType = nt:frozenNode",
         "jcr:uuid = 3a63f325-2e8b-415e-8aa1-6112d4a9049a",
         "jcr:frozenMixinTypes =
mix:lastModified,mix:referenceable,rep:AccessControllable,mix:versionable"
    ]
}],
"properties": [
     "jcr:predecessors = ",
     "jcr:created = 2020-02-21T17:42:44.771-05:00",
     "jcr:primaryType = nt:version",
     "jcr:uuid = a3eae304-16f2-438d-a482-e6dbf5b3d198",
     "jcr:successors = "
]

Thinking about what I want, maybe it is not that easy to mark a binary as
"orphan" (i.e. no node is referencing it) in runtime. But it would be great
of some method could be called that gets all orphan binaries and deletes
them. To save space. I do not if something like that exists.

Jorge


El lun., 24 feb. 2020 a las 9:17, Marco Piovesana (<pi...@esteco.com>)
escribió:

> Hi Jorge,
> I'm not an expert, but I think it might be related to OAK-804
> <https://issues.apache.org/jira/browse/OAK-8048>. The root version should
> be automatically removed when removing the last version. But since it
> isn't, there is still one node that references the binary, so (the binary)
> is not removed when running the garbage collector.
>
> Marco.
>
> On Mon, Feb 24, 2020 at 9:42 PM jorgeeflorez . <
> jorgeeduardoflorez@gmail.com>
> wrote:
>
> > Hi,
> > I managed to delete all versions for nodes that no longer exist (except
> the
> > jcr:rootVersion nodes, they are "protected"). I was expecting that the
> > total size of my binary storage would decrease (I am using
> > OakFileDataStore), since some files are no longer referenced in any
> nodes.
> > But that did not happen...
> >
> > Any help is appreciated.
> >
> > Jorge
> >
> > El vie., 21 feb. 2020 a las 15:12, jorgeeflorez . (<
> > jorgeeduardoflorez@gmail.com>) escribió:
> >
> > > Hi,
> > > when I delete a node that has version history, using node.remove() and
> > > then session.save(), should all version info related to that node be
> > > deleted automatically? what about the files in that version history?
> > >
> > > After deleting, I print all nodes of the repository and I keep seeing
> > > those version nodes. Actually, I was working with a repository uses a
> > > DataStoreBlobStore and after deleting some file nodes I was expecting
> > that
> > > the total size of the folder that contains the files would decrease and
> > it
> > > did not happen, which led me to make this question :)
> > >
> > > Thanks.
> > >
> > > Jorge
> > >
> >
>

Re: Versionable node deletion

Posted by Marco Piovesana <pi...@esteco.com>.
Hi Jorge,
I'm not an expert, but I think it might be related to OAK-804
<https://issues.apache.org/jira/browse/OAK-8048>. The root version should
be automatically removed when removing the last version. But since it
isn't, there is still one node that references the binary, so (the binary)
is not removed when running the garbage collector.

Marco.

On Mon, Feb 24, 2020 at 9:42 PM jorgeeflorez . <jo...@gmail.com>
wrote:

> Hi,
> I managed to delete all versions for nodes that no longer exist (except the
> jcr:rootVersion nodes, they are "protected"). I was expecting that the
> total size of my binary storage would decrease (I am using
> OakFileDataStore), since some files are no longer referenced in any nodes.
> But that did not happen...
>
> Any help is appreciated.
>
> Jorge
>
> El vie., 21 feb. 2020 a las 15:12, jorgeeflorez . (<
> jorgeeduardoflorez@gmail.com>) escribió:
>
> > Hi,
> > when I delete a node that has version history, using node.remove() and
> > then session.save(), should all version info related to that node be
> > deleted automatically? what about the files in that version history?
> >
> > After deleting, I print all nodes of the repository and I keep seeing
> > those version nodes. Actually, I was working with a repository uses a
> > DataStoreBlobStore and after deleting some file nodes I was expecting
> that
> > the total size of the folder that contains the files would decrease and
> it
> > did not happen, which led me to make this question :)
> >
> > Thanks.
> >
> > Jorge
> >
>

Re: Versionable node deletion

Posted by "jorgeeflorez ." <jo...@gmail.com>.
Hi,
I managed to delete all versions for nodes that no longer exist (except the
jcr:rootVersion nodes, they are "protected"). I was expecting that the
total size of my binary storage would decrease (I am using
OakFileDataStore), since some files are no longer referenced in any nodes.
But that did not happen...

Any help is appreciated.

Jorge

El vie., 21 feb. 2020 a las 15:12, jorgeeflorez . (<
jorgeeduardoflorez@gmail.com>) escribió:

> Hi,
> when I delete a node that has version history, using node.remove() and
> then session.save(), should all version info related to that node be
> deleted automatically? what about the files in that version history?
>
> After deleting, I print all nodes of the repository and I keep seeing
> those version nodes. Actually, I was working with a repository uses a
> DataStoreBlobStore and after deleting some file nodes I was expecting that
> the total size of the folder that contains the files would decrease and it
> did not happen, which led me to make this question :)
>
> Thanks.
>
> Jorge
>