Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-13104

Spring data 2.0 IgniteRepositoryImpl#deleteAllById contains wrong code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.1
    • 2.9
    • springdata
    • None
    • Fixed incorrect processing of non-comparable keys in spring-data for repository methods: findAllById(ids) and deleteAllById(ids).
    • Release Notes Required

    Description

          /** {@inheritDoc} */
          @Override public void deleteAllById(Iterable<ID> ids) {
              if (ids instanceof Set)
                  cache.removeAll((Set<ID>)ids);
      
              if (ids instanceof Collection)
                  cache.removeAll(new HashSet<>((Collection<ID>)ids));
      
              TreeSet<ID> keys = new TreeSet<>();
      
              for (ID id : ids)
                  keys.add(id);
      
              cache.removeAll(keys);
          }
      

      As you can see cache.removeAll may be executed THREE times in some situations.
      Also this method can throw ClassCast exception if ids collection contains objects that are not implement Comparable interface.

      Attachments

        Issue Links

          Activity

            People

              kuaw26 Alexey Kuznetsov
              kuaw26 Alexey Kuznetsov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m