Alexandru Popescu ☀ a écrit : > On Tue, Jan 6, 2009 at 11:55 AM, Sébastien Launay > <[email protected]> wrote: > >> Alexandru Popescu ☀ a écrit : >> >>> On Mon, Jan 5, 2009 at 11:19 PM, Sébastien Launay >>> <[email protected]> wrote: >>> >>> >>>> You have to first delete the node and then its versions. >>>> For this you need to store the version history before deleting the node. >>>> Indeed, if you delete the node you cannot access the version history >>>> anymore. >>>> >>>> Here an example, from JCR-134 test case: >>>> >>>> Node n = rootNode.addNode("test"); >>>> n.addMixin(mixVersionable); >>>> rootNode.save(); >>>> VersionHistory vh = n.getVersionHistory(); >>>> >>>> // From here there is the dumy root version >>>> // and the base version references this root version >>>> >>>> // First version which will be the new base version >>>> Version v10 = n.checkin(); >>>> n.checkout(); >>>> >>>> // Second version which will be the new base version >>>> Version v11 = n.checkin(); >>>> n.checkout(); >>>> >>>> // Remove node >>>> n.remove(); >>>> rootNode.save(); >>>> >>>> // Remove the first version >>>> vh.removeVersion(v10.getName()); >>>> >>>> // Remove the second >>>> vh.removeVersion(v11.getName()); >>>> >>>> // vh still exists and it contains the empty >>>> // and its immutable dummy root version >>>> >>>> >>> Have you been able to decrease the disk space used by the repository >>> after this operation has completed? Do you have any statistics by how >>> much the disk space usage was reduced? >>> >>> I must confess that I am extremely interested in a solution in this >>> direction and I would appreciate any ideas. >>> >>> ./alex >>> -- >>> .w( the_mindstorm )p. >>> Alexandru Popescu >>> >>> >>> >> Yes the disk usage has been reduced (shown using "du -sh" on the repository >> folder with embedded derby persistence manager). >> >> But, i do not have real statistics because the issue takes places is in >> a production >> environment and we do not want to change official jackrabbit jar to possible >> unstable jar. >> We could retrieve the official repository from our client but it is >> quite huge and >> contains sensible data... >> >> > > So, if I'm getting it right you are saying that the mechanism you've > posted works, but there aren't any statistics available for how much > space is saved. > > thanks, > > ./alex > -- > .w( the_mindstorm )p. > Alexandru Popescu Exactly, but the patch is a little messy (i needed a method getNodeStateEx into AbstractVersionManager instances, don't know if this is the rigth approach), that's why i'm waiting for feedbacks :).
Test cases are included into the patch for verifying total deletion of the orphan version history (which failed before applying the patch). -- Sébastien Launay
