You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2014/11/07 18:39:34 UTC

[jira] [Comment Edited] (OAK-2259) SegmentBlob equals check should verify compaction in both directions

    [ https://issues.apache.org/jira/browse/OAK-2259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14202270#comment-14202270 ] 

Michael Dürig edited comment on OAK-2259 at 11/7/14 5:39 PM:
-------------------------------------------------------------

Yes I agree that this is probably the right thing to do for now. Depending on how things turn out regarding our approach to compaction, the compaction map might need some overhaul. While it was initially implemented to find out whether a certain state has been compacted to another one, it seems that it more and more needs to work bidirectionally. That is, what we really need is an encoding of an equivalence relation. I think there are more suitable data structures for this. One of which is the [disjoint-set data structure | http://en.wikipedia.org/wiki/Disjoint-set_data_structure]. As we don't need the union operation it should be rather simple to implement. 




was (Author: mduerig):
Yes I agree that this is probably the right thing to do for now. Depending on how things turn out regarding our approach to compaction, the compaction map might need some overhaul. While it was initially implemented to find out whether a certain state has been compacted to another one, it seems that it more and more needs to work bidirectionally. That is, what we really need is an encoding of an equivalence relation. I think there are more suitable data structures for this. 



> SegmentBlob equals check should verify compaction in both directions
> --------------------------------------------------------------------
>
>                 Key: OAK-2259
>                 URL: https://issues.apache.org/jira/browse/OAK-2259
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: segmentmk
>            Reporter: Alex Parvulescu
>            Assignee: Alex Parvulescu
>             Fix For: 1.0.9, 1.1.3
>
>
> It looks like the SegmentNodeState checks compaction in one direction [0], while the SegmentBlob checks in the other direction. This will not break anything as the fallback is to use byte comparison, but it will be terribly slow.
> I'm proposing to verify both directions in the #equals check, to make sure we don't miss out.
> [0] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java#L401
> [1] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java#L198



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)