jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raj <db.raj...@gmail.com>
Subject Delete complete version history when node is deleted.
Date Mon, 23 May 2011 08:42:55 GMT
hi All,

My requirement is to delete the node and its history, as both won't be
useful as per application logic.
I would like to completely delete version history for the node as it will
save us disk space and backup time.

        Node childNode = parentNode.getNode("mynode"); /* node to be
completely deleted */

     /* get a handle to version history before node deletion */
    VersionHistory vh =
    VersionIterator vitr = vh.getAllVersions();
    vitr.skip(1);          /* skipping as this is "jcr:baseVersion" */
    List<String> vnames = new ArrayList<String>();
        childNode.remove() ;
    while (vitr.hasNext()) {
    Version v = vitr.nextVersion();
    String vName = v.getName();
    for (String name: vnames) {

Using this logic I can delete all version nodes, except the base node
Node hierarchy is root/parent/childNode. I don't have any references of
childNode from any other node in Jack rabbit tree.

Would like to know --
1. How to completely delete the version history of node, including
"jcr:baseVersion" ?

2. If it is impossible to delete them, what is the overhead (space and
references wise) of leaving then hanging?

3. As per Cedric's reply, "jcr:baseVersion" should be auto deleted. When
does the system actually delete it? During session.save() ?
How to verify it?

Pasted below is the note about auto deletion -

Hi all,

As of 1.6, empty and unused VersionHistory will be automatically removed
after removal of the last Version (see
This will ensure that the disk usage will not grow unnecessarily.



Related discussion -

thanks & regards,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message