You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/08 13:51:00 UTC

[jira] [Commented] (IGNITE-9235) Transitivity violation in GridMergeIndex Comparator

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

ASF GitHub Bot commented on IGNITE-9235:
----------------------------------------

GitHub user andrewmed opened a pull request:

    https://github.com/apache/ignite/pull/4498

    IGNITE-9235: Transitivity violation in GridMergeIndex Comparator

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gridgain/apache-ignite ignite-9235

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/4498.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4498
    
----
commit 07cbf194d94e41a741dfcaecc74826c0b897c9bf
Author: AMedvedev <gi...@...>
Date:   2018-08-08T13:46:37Z

    IGNITE-9235: Transitivity violation in GridMergeIndex Comparator

----


> Transitivity violation in GridMergeIndex Comparator
> ---------------------------------------------------
>
>                 Key: IGNITE-9235
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9235
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.5
>            Reporter: Andrew Medvedev
>            Priority: Major
>
> Currently comparator in org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndex is:
>  
> Private final Comparator<RowStream> streamCmp = new Comparator<RowStream>() {
>  @Override public int compare(RowStream o1, RowStream o2) {
>  // Nulls at the beginning.
>  if (o1 == null)
>  return -1;
>  if (o2 == null)
>  return 1;
>  return compareRows(o1.get(), o2.get());
>  }
> };
> --
>  
> This comparator violates transitivity when o1 and o2 are null. Thus we get exception in JDK1.8:
>  
>  
> {color:#d04437}Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!{color}
> {color:#d04437}  at java.util.TimSort.mergeHi(TimSort.java:899){color}
> {color:#d04437}  at java.util.TimSort.mergeAt(TimSort.java:516){color}
> {color:#d04437}  at java.util.TimSort.mergeCollapse(TimSort.java:441){color}
> {color:#d04437}  at java.util.TimSort.sort(TimSort.java:245){color}
> {color:#d04437}  at java.util.Arrays.sort(Arrays.java:1438){color}
> {color:#d04437}  at org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndexSorted$MergeStreamIterator.goFirst(GridMergeIndexSorted.java:248){color}
> {color:#d04437}  at org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndexSorted$MergeStreamIterator.hasNext(GridMergeIndexSorted.java:270){color}
> {color:#d04437}  at org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndex$FetchingCursor.fetchRows(GridMergeIndex.java:614){color}
> {color:#d04437}  at org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndex$FetchingCursor.next(GridMergeIndex.java:658){color}
> {color:#d04437}  at org.h2.index.IndexCursor.next(IndexCursor.java:305){color}
> {color:#d04437}  at org.h2.table.TableFilter.next(TableFilter.java:499){color}
> {color:#d04437}  at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1452){color}
> {color:#d04437}  at org.h2.result.LazyResult.hasNext(LazyResult.java:79){color}
> {color:#d04437}  at org.h2.result.LazyResult.next(LazyResult.java:59){color}
> {color:#d04437}  at org.h2.command.dml.Select.queryFlat(Select.java:519){color}
> {color:#d04437}  at org.h2.command.dml.Select.queryWithoutCache(Select.java:625){color}
> {color:#d04437}  at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:114){color}
> {color:#d04437}  at org.h2.command.dml.Query.query(Query.java:352){color}
> {color:#d04437}  at org.h2.command.dml.Query.query(Query.java:333){color}
> {color:#d04437}  at org.h2.command.CommandContainer.query(CommandContainer.java:113){color}
> {color:#d04437}  at org.h2.command.Command.executeQuery(Command.java:201){color}
> {color:#d04437} ... 44 more{color}
>   
> WA: use -Djava.util.Arrays.useLegacyMergeSort=true
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)