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

Affinity methods should return List instead of Collection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • Docs Required

    Description

      Methods of class Affinity should return List instead of Collection when order of nodes matters.

      The following methods are supposed to always return a collection with primary node preceding backups:
      Affinity::mapPartitionToPrimaryAndBackups
      Affinity::mapKeyToPrimaryAndBackups

      The return type for both methods is Collection<ClusterNode>. The Javadocs say: "Note that primary node is always first in the returned collection".
      In general, the notion of "order" and "first element" is not defined for a Collection (we could play with iterators, but its awkward from both code and logic perspective). It makes more sense for this methods to return List instead.

      The task is to introduce List equivalents of these methods. It would also be nice to check if other APIs have similar issues.

      The tricky part is compatibility.
      Changing return type from Collection to List is source compatible (meaning the old client code will compile with the new method), but not binary compatible (meaning the already compiled client code will break because the signature has changed).
      A compatible solution would be to

      • deprecate the existing methods
      • add methods with different names, like mapPartitionToPrimaryAndBackups*List*

      Attachments

        Issue Links

          Activity

            People

              Diana Diana Iakovleva
              slukyanov Stanislav Lukyanov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m