[jira] [Commented] (OAK-8848) Impossible to replace a mix:versionable by a different mix:versionable
[ https://issues.apache.org/jira/browse/OAK-8848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17849942#comment-17849942 ] Julian Reschke commented on OAK-8848: - What is the expection about what would happen with the existing version history? Maybe this needs a TCK test to compare behavior with Jackrabbit. > Impossible to replace a mix:versionable by a different mix:versionable > -- > > Key: OAK-8848 > URL: https://issues.apache.org/jira/browse/OAK-8848 > Project: Jackrabbit Oak > Issue Type: Bug > Components: core, jcr >Affects Versions: 1.16.0 > Environment: The problem occurred from within Sling (Starter 11) > using oak 1.16.0. >Reporter: Hans-Peter Stoerr >Priority: Minor > > If you delete a node with mixin mix:versionable and move another node with > the same mixin in its place (that is, it now has the very same path), you get > a ConstraintViolationException that complains that you are changing protected > properties. Thus, this operation is impossible to perform within one > transaction. But splitting it into two transactions is risky in many cases. > It seems there is a mechanism that checks for changes of protected > properties, and ignores that this is now a different node. > If you have two nodes /somewhere/1 and /somewhere/2 which both are > nt:unstructured and have mix:versionable, the following code triggers an > exception but shouldn't: > session.removeItem("/somewhere/2"); > session.move("/somewhere/1", "/somewhere/2"); > session.save(); > The actual stacktrace thrown is: > javax.jcr.nodetype.ConstraintViolationException: OakConstraint0100: Property > is protected: jcr:versionHistory > at > org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:226) > at > org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:669) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:495) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:420) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:417) > at > org.apache.sling.jcr.oak.server.internal.TcclWrappingJackrabbitSession.save(TcclWrappingJackrabbitSession.java:212) > at > org.apache.jsp.apps.composum.prototype.assets.pagesintegration.hpsx.hpsx_jsp._jspService(hpsx_jsp.java:115) > at > org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) > (irrelevant sling stuff omitted) > Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: > OakConstraint0100: Property is protected: jcr:versionHistory > at > org.apache.jackrabbit.oak.plugins.version.VersionEditor.throwProtected(VersionEditor.java:257) > at > org.apache.jackrabbit.oak.plugins.version.VersionEditor.propertyChanged(VersionEditor.java:152) > at > org.apache.jackrabbit.oak.spi.commit.VisibleEditor.propertyChanged(VisibleEditor.java:73) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyChanged(EditorDiff.java:92) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareProperties(SegmentNodeState.java:664) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:558) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:495) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:422) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:422) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:422) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at >
[jira] [Commented] (OAK-8848) Impossible to replace a mix:versionable by a different mix:versionable
[ https://issues.apache.org/jira/browse/OAK-8848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17847205#comment-17847205 ] Julian Reschke commented on OAK-8848: - Can we start with a subtask to create a reproducable test and mark that as "@Ignore". > Impossible to replace a mix:versionable by a different mix:versionable > -- > > Key: OAK-8848 > URL: https://issues.apache.org/jira/browse/OAK-8848 > Project: Jackrabbit Oak > Issue Type: Bug > Components: core, jcr >Affects Versions: 1.16.0 > Environment: The problem occurred from within Sling (Starter 11) > using oak 1.16.0. >Reporter: Hans-Peter Stoerr >Priority: Minor > > If you delete a node with mixin mix:versionable and move another node with > the same mixin in its place (that is, it now has the very same path), you get > a ConstraintViolationException that complains that you are changing protected > properties. Thus, this operation is impossible to perform within one > transaction. But splitting it into two transactions is risky in many cases. > It seems there is a mechanism that checks for changes of protected > properties, and ignores that this is now a different node. > If you have two nodes /somewhere/1 and /somewhere/2 which both are > nt:unstructured and have mix:versionable, the following code triggers an > exception but shouldn't: > session.removeItem("/somewhere/2"); > session.move("/somewhere/1", "/somewhere/2"); > session.save(); > The actual stacktrace thrown is: > javax.jcr.nodetype.ConstraintViolationException: OakConstraint0100: Property > is protected: jcr:versionHistory > at > org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:226) > at > org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:669) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:495) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:420) > at > org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273) > at > org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:417) > at > org.apache.sling.jcr.oak.server.internal.TcclWrappingJackrabbitSession.save(TcclWrappingJackrabbitSession.java:212) > at > org.apache.jsp.apps.composum.prototype.assets.pagesintegration.hpsx.hpsx_jsp._jspService(hpsx_jsp.java:115) > at > org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) > (irrelevant sling stuff omitted) > Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: > OakConstraint0100: Property is protected: jcr:versionHistory > at > org.apache.jackrabbit.oak.plugins.version.VersionEditor.throwProtected(VersionEditor.java:257) > at > org.apache.jackrabbit.oak.plugins.version.VersionEditor.propertyChanged(VersionEditor.java:152) > at > org.apache.jackrabbit.oak.spi.commit.VisibleEditor.propertyChanged(VisibleEditor.java:73) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyChanged(EditorDiff.java:92) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareProperties(SegmentNodeState.java:664) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:558) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:495) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:422) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:422) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:422) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) > at > org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147) > at > org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:598) > at >