[MGNLTOOLS-86] Purge versions of previously deleted content doesn't work since 5.5 Created: 27/Jul/17  Updated: 08/Aug/17  Resolved: 03/Aug/17

Status: Closed
Project: Repository Tools
Component/s: None
Affects Version/s: None
Fix Version/s: 1.9

Type: Bug Priority: Neutral
Reporter: Oanh Thai Hoang Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 1.5d
Original Estimate: 2d

Attachments: PNG File Screen Shot 2017-08-07 at 2.28.33 PM.png     PNG File Screen Shot 2017-08-07 at 2.28.59 PM.png     PNG File Screen Shot 2017-08-07 at 2.29.30 PM.png     PNG File new version structure.png     PNG File old-version-structure.png    
Issue Links:
Relates
relates to MGNLTOOLS-85 Remove uses of the Content API Closed
relates to MGNLTOOLS-87 Remove empty folders in mgnlVersion w... Accepted
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Saigon 106, Saigon 107
Story Points: 3

 Description   

Since MAGNOLIA-6774 introduces new path's structure of version in magnolia-mgnlVersion workspace so info.magnolia.tools.commands.VersionStorePurgeCommand#purge has never reached (https://git.magnolia-cms.com/projects/ENTERPRISE/repos/tools/browse/src/main/java/info/magnolia/tools/commands/VersionStorePurgeCommand.java#110).

Reason is mgnlVersion.getRootNode().getNodes() only get child of root node from magnolia-mgnlVersion workspace and those nodes alway invalid because of missing mix:versionable.
More code details:

Step to reproduce:

  • Create page with name 'test' in pages app
  • Publish that 'test' page
  • Check version of it is created in JCR-Browser app/magnolia-mgnlVersion
  • Open Groovy app
  • Run below script to delete 'test' page, note: the name of page (in my case 'test') need to change if you create a different name
java.lang.String querySql2 = "select * from [mgnl:page] as t where name(t) = 'test'";
java.lang.String queryWorkspace = "website";
 
javax.jcr.NodeIterator nodeList = info.magnolia.cms.util.QueryUtil.search(queryWorkspace, querySql2, javax.jcr.query.Query.JCR_SQL2, "mgnl:page");
 
println "Removing nodes :";
while(nodeList.hasNext()) {
  javax.jcr.Node currNode = nodeList.nextNode();
  println "${currNode.path}";
  currNode.remove();
}
 
info.magnolia.context.MgnlContext.getJCRSession(queryWorkspace).save();
println "Nodes removal finished";
  • Check the 'test' page is gone in Pages app
  • Open JCR-Browser app/magnolia-mgnlVersion and make sure that the all node related to version of 'test' from step 3 is still existed
  • Open Repository tools app and click purge version in magnolia-mgnlVersion
  • Open JCR-Browser app/magnolia-mgnlVersion again and check the node has mix:versionable or node name is uuid

Expectation: Version of 'test' page is gone
Observation: Version of 'test' page still exist



 Comments   
Comment by Dai Ha [ 07/Aug/17 ]

Purge version command function:

Clean repository command function (before - test with jvisualvm):

Clean repository command function (after)

Generated at Mon Feb 12 10:40:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.