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

IndexOutOfBoundException in flusher selection logic in GridCacheWriteBehindStore

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.10
    • None
    • general
    • None

    Description

      There i a bug in GridCacheWriteBehindStore method for selecting which flusher should be used for current data write by specified key:

          /**
           * Return flusher by by key.
           *
           * @param key Key for search.
           * @return flusher.
           */
          private Flusher flusher(K key) {
              int h, idx;
      
              if (flushThreadCntIsPowerOfTwo)
                  idx = ((h = key.hashCode()) ^ (h >>> 16)) & (flushThreadCnt - 1);
              else
                  idx = ((h = key.hashCode()) ^ (h >>> 16)) % flushThreadCnt;
      
              return flushThreads[idx];
          }
      

      In case when flushThreadCount is not a power of 2 and incoming key.hashCode() < 0 (e.g. for UUID string) we will get IndexOutOfBoundException.

      http://apache-ignite-users.70518.x6.nabble.com/Bug-in-GridCacheWriteBehindStore-td36189.html

      Attachments

        Issue Links

          Activity

            People

              Korol Ilya Korol
              Korol Ilya Korol
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: