[
https://issues.apache.org/jira/browse/OAK-3130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marcel Reutegger updated OAK-3130:
----------------------------------
Attachment: OAK-3130.patch
Attached patch with proposed fix.
I removed quite a bit of code in ReferenceEditor.
The editor now ignores references from the version storage, which is IMO
according to the spec and compatible with Jackrabbit 2.x. The spec says in
[3.13.4.6 References in a Frozen
Node|http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.13.4.6
References in a Frozen Node]:
bq. A REFERENCE property stored in the frozen node of a version does not
enforce referential integrity. Under simple versioning this follows from the
fact that a REFERENCE within a frozen node does not appear within the workspace
in any case, it only appears when the frozen node is explicitly retrieved
through the Version object (see §15.2.1 Version Object). Under full versioning
a REFERENCE within a frozen node will appear in the workspace within the
read-only version storage (see §3.13.8 Version Storage) so the referential
integrity requirement must be lifted as a special case.
It does not mention inter version references like {{jcr:successors}} and
{{jcr:predecessors}}, but in [5.10.7 Backtracking
References|http://www.day.com/specs/jcr/2.0/5_Reading.html#5.10.7 Backtracking
References] it says:
bq. Note that access control and other implementation-specific limitations my
mean that some references within the workspace are not accessible.
Jackrabbit 2.x also does not return references from within the version storage.
So, I think for compatibility Oak should not return them either. This was also
previously decided in OAK-1196.
The ReferenceEditor does not track discardedIds anymore for node that changed
their UUID. Instead it remembers them in {{rmIds}} and {{newIds}} to check
referential integrity at the end.
The patch also removes all the {{rmIds.contains(uuid)}} checks in the
{{leave()}} method. [~alexparvulescu], do you remember why those were added?
All tests pass with the patch, also some new ones I added.
[~alexparvulescu], can you please review?
I'm also wondering if the current implementation potentially leaves garbage in
the reference index, which may become a problem with the new reference check
based on the index. Maybe the fix should also include an step during the
integrity check if the references still exist.
> ReferenceEditor may not enforce referential integrity
> -----------------------------------------------------
>
> Key: OAK-3130
> URL: https://issues.apache.org/jira/browse/OAK-3130
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: jcr
> Affects Versions: 1.2.3, 1.3.3, 1.0.17
> Reporter: Marcel Reutegger
> Assignee: Marcel Reutegger
> Fix For: 1.3.4
>
> Attachments: OAK-3130.patch
>
>
> VersionHistory.removeVersion() allows to remove a version of a checked in
> node still referencing that version. This results in a dangling base version.
> This is caused by a more general issue in the ReferenceEditor, which does not
> enforce referential integrity in some cases.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)