Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter fromInclusive is ignored for iterateEntriesMajor function inside transaction #7052

Closed
1 of 5 tasks
antonzherdev opened this issue Jan 3, 2017 · 1 comment
Closed
1 of 5 tasks
Labels
Milestone

Comments

@antonzherdev
Copy link
Contributor

OrientDB Version, operating system, or hardware.

  • v2.0 SNAPSHOT[ ] - .18[ ] .17[ ] .16[ ] .15[ ] .14[ ] .13[ ] .12[ ] .11[ ] .10[ ] .9[ ] .8[ ] .7[ ] .6[ ] .5[ ] .4[ ] .3[ ] .2[ ] .1[ ] .0[ ]
  • v2.1 SNAPSHOT[ ] - .16[ ] .15[ ] .14[ ] .13[ ] .12[ ] .11[ ] .10[ ] .9[ ] .8[ ] .7[ ] .6[ ] .5[ ] .4[ ] .3[ ] .2[ ] .1[ ] .0[ ]
  • v2.2 SNAPSHOT[ ] - .13[X] .rc1[ ] .beta2[ ] .beta1[ ]

Operating System

  • Linux
  • MacOSX
  • Windows
  • Other Unix
  • Other, name?

Steps to reproduce the problem

In a transaction save some data which will affect an index.
Try to the index iterate it with idx.iterateEntriesMajor(key, false, true) using the same value as for the saved record as a key.

Expected behavior and actual behavior

As a result the saved item will be included in the selection ignoring the fact that the second parameter (fromInclusive) is false.
It should not be included since the key is the same.

The problem happens due to the code in OIndexTxAwareMultiValue:

 public PureTxBetweenIndexForwardCursor(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive,
        OTransactionIndexChanges indexChanges) {
      this.indexChanges = indexChanges;

      fromKey = enhanceFromCompositeKeyBetweenAsc(fromKey, fromInclusive);
      toKey = enhanceToCompositeKeyBetweenAsc(toKey, toInclusive);

      if (toInclusive)
        firstKey = indexChanges.getCeilingKey(fromKey);
      else
        firstKey = indexChanges.getHigherKey(fromKey);

      if (fromInclusive)
        lastKey = indexChanges.getFloorKey(toKey);
      else
        lastKey = indexChanges.getLowerKey(toKey);

      nextKey = firstKey;
    }

toInclusive and fromInclusive should be swapped with each other because here toInclusive is applied to fromKey and fromInclusive to toKey. I suppose it should be vice versa.

The same problem is for PureTxBetweenIndexBackwardCursor.

@lvca lvca added this to the 2.2.x (next hotfix) milestone Jan 3, 2017
andrii0lomakin added a commit that referenced this issue Jan 3, 2017
andrii0lomakin added a commit that referenced this issue Jan 3, 2017
(cherry picked from commit 0d25f57)
@andrii0lomakin
Copy link
Member

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants