[jira] [Comment Edited] (OAK-1117) [MongoMk]Flag document with children

2013-10-25 Thread Chetan Mehrotra (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13805218#comment-13805218
 ] 

Chetan Mehrotra edited comment on OAK-1117 at 10/25/13 11:04 AM:
-

Patch to optimize based on above mentioned approach. Points to note

* A new flag {{_hasChildNodes}} added. Which if
** false - Indicates that there are no child for this path
** true - Indicates that there might be child nodes for this path. It might 
happen that there are no child node found if actual call is performed
* Flag once set would not be unset
* With this logic it might happen that commit root changes as we might have to 
change the flag for a path which is not part of the commit. Due to this has to 
change assertions in 2 testcases
* With this change in place there would be some latency when a new node is 
added to a parent which did not had a child node so far. That change would only 
be picked up once backGround operations are complete on other nodes. 

With this set the number of calls reduce considerably. For example on restart 
of Adobe CQ it goes from 42000 to 25000


was (Author: chetanm):
Patch to optimize based on above mentioned approach. Points to note

* A new flag {{_hasChildNodes}} added. Which if
** false - Indicates that there are no child for this path
** true - Indicates that there might be child nodes for this path. It might 
happen that there are no child node found if actual call is performed
* Flag once set would not be unset
* With this logic it might happen that commit root changes as we might have to 
change the flag for a path which is not part of the commit. Due to this has to 
change assertions in 2 testcases

With this set the number of calls reduce considerably. For example on restart 
of Adobe CQ it goes from 42000 to 25000

 [MongoMk]Flag document with children
 

 Key: OAK-1117
 URL: https://issues.apache.org/jira/browse/OAK-1117
 Project: Jackrabbit Oak
  Issue Type: Improvement
  Components: mongomk
Reporter: Chetan Mehrotra
Assignee: Chetan Mehrotra
 Attachments: OAK-1117.patch


 Installing a vlt package shows many reads on MongoDB for children of nodes 
 that do not have child nodes. these nodes are the leafs of the tree. due to 
 the current content model, the MongoMK does not know if a node has children, 
 by just looking at the NodeDocument for that node.
 To help such cases it would be better if we mark nodes which have children. 
 Refer to [1] for more details
 [1] http://markmail.org/thread/7olmv5iqapmheasz



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Created] (OAK-1118) Removing and readding mix:versionable fails if node is referenceable

2013-10-25 Thread angela (JIRA)
angela created OAK-1118:
---

 Summary: Removing and readding mix:versionable fails if node is 
referenceable
 Key: OAK-1118
 URL: https://issues.apache.org/jira/browse/OAK-1118
 Project: Jackrabbit Oak
  Issue Type: Bug
  Components: core, jcr
Reporter: angela


removing mix:versionable from a referenceable node will fail with the following 
exception:

{quote}
javax.jcr.nodetype.ConstraintViolationException: OakConstraint0022: 
/testdata[nt:unstructured, mix:referenceable, mix:versionable]: Mandatory 
property jcr:predecessors can not be removed
at 
org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:220)
at 
org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:207)
at 
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:471)
at 
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:334)
at 
org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:399)
at 
org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:396)
at 
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:128)
at 
org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:117)
at 
org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:396)
at 
org.apache.jackrabbit.oak.jcr.nodetype.MixinTest.testRemoveAddMixVersionable2(MixinTest.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at 
org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:464)
at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: 
OakConstraint0022: /testdata[nt:unstructured, mix:referenceable, 
mix:versionable]: Mandatory property jcr:predecessors can not be removed
{quote}

the test:

{code}
@Test
public void testRemoveAddMixVersionable() throws Exception {
testRootNode.addMixin(mixReferenceable);
testRootNode.addMixin(mixVersionable);
superuser.save();
String vhId = testRootNode.getVersionHistory().getUUID();

testRootNode.removeMixin(mixVersionable);
testRootNode.addMixin(mixVersionable);
superuser.save();

assertFalse(vhId.equals(testRootNode.getVersionHistory().getUUID()));
}
{code}

i am not totally sure what is going wrong here as works if the node is only 
mix:versionable



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Created] (OAK-1119) [MongoMK] Reduce number of calls made to Mongo DB when an Oak based application is restarted

2013-10-25 Thread Chetan Mehrotra (JIRA)
Chetan Mehrotra created OAK-1119:


 Summary: [MongoMK] Reduce number of calls made to Mongo DB when an 
Oak based application is restarted
 Key: OAK-1119
 URL: https://issues.apache.org/jira/browse/OAK-1119
 Project: Jackrabbit Oak
  Issue Type: Task
  Components: mongomk
Reporter: Chetan Mehrotra
Assignee: Chetan Mehrotra


Current restarting an Oak based application like Adobe CQ makes quite high 
number of calls to Mongo DB (~23000). We should try to minimize number of such 
calls by analyzing the usage of caches , types of queries etc



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Updated] (OAK-1119) [MongoMK] Reduce number of calls made to Mongo DB when an Oak based application is restarted

2013-10-25 Thread Chetan Mehrotra (JIRA)

 [ 
https://issues.apache.org/jira/browse/OAK-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Mehrotra updated OAK-1119:
-

Attachment: queries-and-cache-entries.tar.gz

Zip containing various log files
* mongo.log - Contains details about calls made to Mongo db from 
MongoDocumentStore
* nodes.log - And other log file contains key names of the various caches used 
in Mongo MK

 [MongoMK] Reduce number of calls made to Mongo DB when an Oak based 
 application is restarted
 

 Key: OAK-1119
 URL: https://issues.apache.org/jira/browse/OAK-1119
 Project: Jackrabbit Oak
  Issue Type: Task
  Components: mongomk
Reporter: Chetan Mehrotra
Assignee: Chetan Mehrotra
 Attachments: queries-and-cache-entries.tar.gz


 Current restarting an Oak based application like Adobe CQ makes quite high 
 number of calls to Mongo DB (~23000). We should try to minimize number of 
 such calls by analyzing the usage of caches , types of queries etc



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (OAK-1119) [MongoMK] Reduce number of calls made to Mongo DB when an Oak based application is restarted

2013-10-25 Thread Chetan Mehrotra (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13805353#comment-13805353
 ] 

Chetan Mehrotra commented on OAK-1119:
--

Analysis of above logs files reveals following details

|| name || Size || Requests || Hits || Hit Rate || Misses || Miss Rate || Loads 
|| Load Time || Load Penalty || Evictions || Max Weight || CurrentWeight ||
| doc | 32338 | 87264562 | 87200611 | 1.00 | 63951 | 0.00 | 16070 | 0 min, 5 
sec | 340476.95 | 24311 | 174.5 MB | 174.5 MB |
| nodes | 10138 | 1183605 | 870871 | 0.74 | 312734 | 0.26 | 312295 | 0 min, 11 
sec | 36095.03 | 302157 | 53.7 MB | 53.5 MB |
| nodeChildren | 27696 | 218319 | 30654 | 0.14 | 187665 | 0.86 | 148042 | 4 
min, 8 sec | 1680743.66 | 129001 | 26.8 MB | 26.8 MB |
| docChildren | 10551 | 163625 | 144911 | 0.89 | 18714 | 0.11 | 0 | 0 min, 0 
sec | 0.00 | 8136 | 8.1 MB | 8.1 MB |
| diffCache | 10823 | 201052 | 180752 | 0.90 | 20300 | 0.10 | 15069 | 0 min, 8 
sec | 533439.79 | 4246 | 5.4 MB | 5.4 MB |


*Content of Node Children cache*

Number of unique paths/totalpaths = (1992/27924)

|| Count || Path ||
| 972 | / |
| 972 | /apps |
| 971 | /var |
| 970 | /etc |
| 969 | /content |
| 968 | /libs |
| 967 | /oak:index |
| 830 | /oak:index/lucene |
| 567 | /oak:index/extensionType |
| 566 | /oak:index/jcrLockOwner |
| 565 | /oak:index/cqVariantFamily |
| 565 | /oak:index/lockCreated |
| 565 | /oak:index/slingVanityPath |
| 564 | /oak:index/acPrincipalName |
| 564 | /oak:index/cqCugEnabled |
| 564 | /oak:index/event.job.topic |
| 563 | /oak:index/authorizableId |
| 563 | /oak:index/cqTags |
| 563 | /oak:index/damScene7ID |
| 562 | /jcr:system |
| 562 | /oak:index/cqCloudServiceConfigs |
| 562 | /oak:index/cqDefaultFormFor |
| 562 | /oak:index/cqKeywords |
| 562 | /oak:index/cqParentPath |
| 561 | /oak:index/cqOwnerCanvasPage |
| 561 | /oak:index/jcrLanguage |
| 561 | /oak:index/members |
| 561 | /oak:index/nodetype |
| 561 | /oak:index/principalName |

*Content of Nodes Cache*

Number of unique paths/totalpaths = (425/9923)

|| Count || Path ||
| 174 | /etc |
| 173 | /var |
| 172 | /tmp |
| 171 | /libs |
| 171 | /rep:repoPolicy |
| 170 | / |
| 170 | /:async |
| 170 | /apps |
| 170 | /content |
| 170 | /oak:index |
| 169 | /jcr:system |
| 169 | /rep:policy |
| 167 | /home |
| 166 | /bin |
| 149 | /oak:index/slingResourceType |
| 149 | /oak:index/status |
| 148 | /oak:index/damS7watch |
| 148 | /oak:index/slingResource |
| 147 | /oak:index/cqKeywords |
| 147 | /oak:index/jcrLockOwner |
| 147 | /oak:index/slingVanityPath |
| 146 | /oak:index/authorizableId |
| 146 | /oak:index/cqDefaultFormFor |
| 146 | /oak:index/event.job.topic |



 [MongoMK] Reduce number of calls made to Mongo DB when an Oak based 
 application is restarted
 

 Key: OAK-1119
 URL: https://issues.apache.org/jira/browse/OAK-1119
 Project: Jackrabbit Oak
  Issue Type: Task
  Components: mongomk
Reporter: Chetan Mehrotra
Assignee: Chetan Mehrotra
 Attachments: queries-and-cache-entries.tar.gz


 Current restarting an Oak based application like Adobe CQ makes quite high 
 number of calls to Mongo DB (~23000). We should try to minimize number of 
 such calls by analyzing the usage of caches , types of queries etc



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (OAK-1119) [MongoMK] Reduce number of calls made to Mongo DB when an Oak based application is restarted

2013-10-25 Thread Chetan Mehrotra (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13805356#comment-13805356
 ] 

Chetan Mehrotra commented on OAK-1119:
--

Analysis of Query logs reveals following stats

* Total queries - 20206
* Updates - 1179
* Creates - 78
* Find - 426
* Fetch Children - 18523

Note that when we fetch children we also populate the Document cache has number 
of finds would be low. Further following are the path for which children have 
been fetched

Number of unique paths/totalpaths = (425/9923)

|| Count || Path ||
| 174 | /etc |
| 173 | /var |
| 172 | /tmp |
| 171 | /libs |
| 171 | /rep:repoPolicy |
| 170 | / |
| 170 | /:async |
| 170 | /apps |
| 170 | /content |
| 170 | /oak:index |
| 169 | /jcr:system |
| 169 | /rep:policy |
| 167 | /home |
| 166 | /bin |
| 149 | /oak:index/slingResourceType |
| 149 | /oak:index/status |
| 148 | /oak:index/damS7watch |
| 148 | /oak:index/slingResource |
| 147 | /oak:index/cqKeywords |
| 147 | /oak:index/jcrLockOwner |
| 147 | /oak:index/slingVanityPath |
| 146 | /oak:index/authorizableId |
| 146 | /oak:index/cqDefaultFormFor |
| 146 | /oak:index/event.job.topic |
| 146 | /oak:index/nodetype |
| 146 | /oak:index/type |
| 145 | /oak:index/cqOwnerCanvasPage |
| 145 | /oak:index/damScene7ID |
| 145 | /oak:index/extensionType |
| 145 | /oak:index/jcrLanguage |
| 145 | /oak:index/lucene |
| 145 | /oak:index/principalName |
| 145 | /oak:index/slingAlias |
| 145 | /oak:index/uuid |
| 144 | /oak:index/cqCloudServiceConfigs |
| 144 | /oak:index/cqParentPath |
| 144 | /oak:index/cqVariantFamily |
| 144 | /oak:index/damResolvedPath |
| 144 | /oak:index/lockCreated |
| 143 | /oak:index/acPrincipalName |
| 143 | /oak:index/cqCugEnabled |
| 143 | /oak:index/cqMaster |
| 143 | /oak:index/cqTags |
| 142 | /oak:index/members |
| 76 | /oak:index/lucene/:data/_b_7.del |
| 75 | /oak:index/lucene/:data/_b.fnm |
| 75 | /oak:index/lucene/:data/_b_Lucene41_0.pos |
| 75 | /oak:index/lucene/:data/_b_Lucene41_0.tip |
| 74 | /oak:index/lucene/:data/_b.si |

 [MongoMK] Reduce number of calls made to Mongo DB when an Oak based 
 application is restarted
 

 Key: OAK-1119
 URL: https://issues.apache.org/jira/browse/OAK-1119
 Project: Jackrabbit Oak
  Issue Type: Task
  Components: mongomk
Reporter: Chetan Mehrotra
Assignee: Chetan Mehrotra
 Attachments: queries-and-cache-entries.tar.gz


 Current restarting an Oak based application like Adobe CQ makes quite high 
 number of calls to Mongo DB (~23000). We should try to minimize number of 
 such calls by analyzing the usage of caches , types of queries etc



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Comment Edited] (OAK-1119) [MongoMK] Reduce number of calls made to Mongo DB when an Oak based application is restarted

2013-10-25 Thread Chetan Mehrotra (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13805356#comment-13805356
 ] 

Chetan Mehrotra edited comment on OAK-1119 at 10/25/13 3:06 PM:


Analysis of Query logs reveals following stats

* Total queries - 20206
* Updates - 1179
* Creates - 78
* Find - 426
* Fetch Children - 18523

Note that when we fetch children we also populate the Document cache has number 
of finds would be low. 



was (Author: chetanm):
Analysis of Query logs reveals following stats

* Total queries - 20206
* Updates - 1179
* Creates - 78
* Find - 426
* Fetch Children - 18523

Note that when we fetch children we also populate the Document cache has number 
of finds would be low. Further following are the path for which children have 
been fetched

Number of unique paths/totalpaths = (425/9923)

|| Count || Path ||
| 174 | /etc |
| 173 | /var |
| 172 | /tmp |
| 171 | /libs |
| 171 | /rep:repoPolicy |
| 170 | / |
| 170 | /:async |
| 170 | /apps |
| 170 | /content |
| 170 | /oak:index |
| 169 | /jcr:system |
| 169 | /rep:policy |
| 167 | /home |
| 166 | /bin |
| 149 | /oak:index/slingResourceType |
| 149 | /oak:index/status |
| 148 | /oak:index/damS7watch |
| 148 | /oak:index/slingResource |
| 147 | /oak:index/cqKeywords |
| 147 | /oak:index/jcrLockOwner |
| 147 | /oak:index/slingVanityPath |
| 146 | /oak:index/authorizableId |
| 146 | /oak:index/cqDefaultFormFor |
| 146 | /oak:index/event.job.topic |
| 146 | /oak:index/nodetype |
| 146 | /oak:index/type |
| 145 | /oak:index/cqOwnerCanvasPage |
| 145 | /oak:index/damScene7ID |
| 145 | /oak:index/extensionType |
| 145 | /oak:index/jcrLanguage |
| 145 | /oak:index/lucene |
| 145 | /oak:index/principalName |
| 145 | /oak:index/slingAlias |
| 145 | /oak:index/uuid |
| 144 | /oak:index/cqCloudServiceConfigs |
| 144 | /oak:index/cqParentPath |
| 144 | /oak:index/cqVariantFamily |
| 144 | /oak:index/damResolvedPath |
| 144 | /oak:index/lockCreated |
| 143 | /oak:index/acPrincipalName |
| 143 | /oak:index/cqCugEnabled |
| 143 | /oak:index/cqMaster |
| 143 | /oak:index/cqTags |
| 142 | /oak:index/members |
| 76 | /oak:index/lucene/:data/_b_7.del |
| 75 | /oak:index/lucene/:data/_b.fnm |
| 75 | /oak:index/lucene/:data/_b_Lucene41_0.pos |
| 75 | /oak:index/lucene/:data/_b_Lucene41_0.tip |
| 74 | /oak:index/lucene/:data/_b.si |

 [MongoMK] Reduce number of calls made to Mongo DB when an Oak based 
 application is restarted
 

 Key: OAK-1119
 URL: https://issues.apache.org/jira/browse/OAK-1119
 Project: Jackrabbit Oak
  Issue Type: Task
  Components: mongomk
Reporter: Chetan Mehrotra
Assignee: Chetan Mehrotra
 Attachments: queries-and-cache-entries.tar.gz


 Current restarting an Oak based application like Adobe CQ makes quite high 
 number of calls to Mongo DB (~23000). We should try to minimize number of 
 such calls by analyzing the usage of caches , types of queries etc



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (OAK-1118) Removing and readding mix:versionable fails if node is referenceable

2013-10-25 Thread Jukka Zitting (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13805653#comment-13805653
 ] 

Jukka Zitting commented on OAK-1118:


What happens here is that the {{removeMixin}} call automatically removes all 
versioning properties and thus the link to the original version history. But 
since the {{addMixin}} call makes the node versionable again, the 
{{VersionEditor}} invoked during {{save}} interprets (based on the lack of a 
{{jcr:rootVersion}} property) that the node has been made newly versionable, 
and proceeds to re-initialize the version history (give it a new UUID, etc...). 
A better way to handle that case would be to re-connect the node to the already 
existing version history, like Jackrabbit 2.x does.

 Removing and readding mix:versionable fails if node is referenceable
 

 Key: OAK-1118
 URL: https://issues.apache.org/jira/browse/OAK-1118
 Project: Jackrabbit Oak
  Issue Type: Bug
  Components: core, jcr
Reporter: angela

 removing mix:versionable from a referenceable node will fail with the 
 following exception:
 {quote}
 javax.jcr.nodetype.ConstraintViolationException: OakConstraint0022: 
 /testdata[nt:unstructured, mix:referenceable, mix:versionable]: Mandatory 
 property jcr:predecessors can not be removed
   at 
 org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:220)
   at 
 org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:207)
   at 
 org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:471)
   at 
 org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:334)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:399)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:396)
   at 
 org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:128)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:117)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:396)
   at 
 org.apache.jackrabbit.oak.jcr.nodetype.MixinTest.testRemoveAddMixVersionable2(MixinTest.java:134)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at 
 org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:464)
   at 
 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
   at 
 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
 Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: 
 OakConstraint0022: /testdata[nt:unstructured, mix:referenceable, 
 mix:versionable]: Mandatory property jcr:predecessors can not be removed
 {quote}
 the test:
 {code}
 @Test
 public void testRemoveAddMixVersionable() throws Exception {
 testRootNode.addMixin(mixReferenceable);
 testRootNode.addMixin(mixVersionable);
 superuser.save();
 String vhId = testRootNode.getVersionHistory().getUUID();
 testRootNode.removeMixin(mixVersionable);
 testRootNode.addMixin(mixVersionable);
 superuser.save();
 assertFalse(vhId.equals(testRootNode.getVersionHistory().getUUID()));
 }
 {code}
 i am not totally sure what is going wrong here as works if the node is only 
 mix:versionable



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Comment Edited] (OAK-1118) Removing and readding mix:versionable fails if node is referenceable

2013-10-25 Thread Jukka Zitting (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13805653#comment-13805653
 ] 

Jukka Zitting edited comment on OAK-1118 at 10/25/13 8:35 PM:
--

What happens here is that the {{removeMixin}} call automatically removes all 
versioning properties and thus the link to the original version history. But 
since the {{addMixin}} call makes the node versionable again, the 
{{VersionEditor}} invoked during {{save}} -interprets (based on the lack of a 
{{jcr:rootVersion}} property) that the node has been made newly versionable, 
and proceeds to re-initialize the version history (give it a new UUID, etc...)- 
won't notice that the versioning information has changed, and thus doesn't 
re-add the versioning properties, which in turn leads to the validation error 
about missing mandatory properties. A better way to handle that case would be 
to re-connect the node to the already existing version history, like Jackrabbit 
2.x does.


was (Author: jukkaz):
What happens here is that the {{removeMixin}} call automatically removes all 
versioning properties and thus the link to the original version history. But 
since the {{addMixin}} call makes the node versionable again, the 
{{VersionEditor}} invoked during {{save}} interprets (based on the lack of a 
{{jcr:rootVersion}} property) that the node has been made newly versionable, 
and proceeds to re-initialize the version history (give it a new UUID, etc...). 
A better way to handle that case would be to re-connect the node to the already 
existing version history, like Jackrabbit 2.x does.

 Removing and readding mix:versionable fails if node is referenceable
 

 Key: OAK-1118
 URL: https://issues.apache.org/jira/browse/OAK-1118
 Project: Jackrabbit Oak
  Issue Type: Bug
  Components: core, jcr
Reporter: angela

 removing mix:versionable from a referenceable node will fail with the 
 following exception:
 {quote}
 javax.jcr.nodetype.ConstraintViolationException: OakConstraint0022: 
 /testdata[nt:unstructured, mix:referenceable, mix:versionable]: Mandatory 
 property jcr:predecessors can not be removed
   at 
 org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:220)
   at 
 org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:207)
   at 
 org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:471)
   at 
 org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:334)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:399)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.perform(SessionImpl.java:396)
   at 
 org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:128)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:117)
   at 
 org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:396)
   at 
 org.apache.jackrabbit.oak.jcr.nodetype.MixinTest.testRemoveAddMixVersionable2(MixinTest.java:134)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at 
 org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:464)
   at 
 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
   at 
 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
 Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: 
 OakConstraint0022: /testdata[nt:unstructured, mix:referenceable, 
 mix:versionable]: Mandatory property jcr:predecessors can not be removed
 {quote}
 the test:
 {code}
 @Test
 public void testRemoveAddMixVersionable() throws Exception {
 testRootNode.addMixin(mixReferenceable);
 testRootNode.addMixin(mixVersionable);
 superuser.save();
 String vhId = testRootNode.getVersionHistory().getUUID();
 testRootNode.removeMixin(mixVersionable);
 testRootNode.addMixin(mixVersionable);
 superuser.save();
 assertFalse(vhId.equals(testRootNode.getVersionHistory().getUUID()));
 }
 {code}
 i am not totally sure what is going wrong here as works if the node is only 
 mix:versionable



--
This message was sent by Atlassian JIRA
(v6.1#6144)