You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Alex Rodriguez <ar...@enonic.com> on 2013/01/04 09:36:40 UTC

OAK-539: Wrong compareTo in micro-kernel Id class

Hi, 

I have submitted an issue and also a patch with a fix. The bug and fix are quite simple, but I think the effects are quite serious. The problem is that Id.compareTo method is broken and returns the wrong ordering in some cases. 

I found the issue because I got randomly primary key exceptions when using H2Persistence. DefaultRevisionStore tries to retrieve the commitCounter on initialization, and for that it takes the highest of headId and lastCommitId. Due to the bug in compareTo it ends up using an id that already exists in the REVS table. After this, basically all write operations fail. And I suspect there might be other issues caused by this bug. 

Sorry for the long summary, maybe that belongs in the issue in jira. What I wanted to ask is what is the procedure for sending patches? It seems like the Github project is a mirror, or can I make pull requests from Github? 
If this is explained somewhere kindly send me to the right url. 

https://issues.apache.org/jira/browse/OAK-539 

-- 
Best regards, 

Alex Rodriguez 



Re: OAK-539: Wrong compareTo in micro-kernel Id class

Posted by Stefan Guggisberg <st...@gmail.com>.
hi alex,

On Fri, Jan 4, 2013 at 9:36 AM, Alex Rodriguez <ar...@enonic.com> wrote:
> Hi,
>
> I have submitted an issue and also a patch with a fix. The bug and fix are quite simple, but I think the effects are quite serious. The problem is that Id.compareTo method is broken and returns the wrong ordering in some cases.
>
> I found the issue because I got randomly primary key exceptions when using H2Persistence. DefaultRevisionStore tries to retrieve the commitCounter on initialization, and for that it takes the highest of headId and lastCommitId. Due to the bug in compareTo it ends up using an id that already exists in the REVS table. After this, basically all write operations fail. And I suspect there might be other issues caused by this bug.
>
> Sorry for the long summary, maybe that belongs in the issue in jira. What I wanted to ask is what is the procedure for sending patches? It seems like the Github project is a mirror, or can I make pull requests from Github?
> If this is explained somewhere kindly send me to the right url.
>
> https://issues.apache.org/jira/browse/OAK-539

good catch! and thanks for providing a patch :)

i've applied your patch and resolved the issue.

the github project is just a mirror, as you've already guessed.

the jackrabbit-oak projects sources are stored in the
svn repository at http://svn.apache.org/repos/asf/jackrabbit/.

'svn diff' is the preferred patch format.

cheers
stefan

>
> --
> Best regards,
>
> Alex Rodriguez
>
>