[ 
https://issues.apache.org/jira/browse/IGNITE-14898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ilya Korol updated IGNITE-14898:
--------------------------------
    Description: 
There i a bug in GridCacheWriteBehindStore method for selecting which flusher 
should be used for current data write by specified key:

{code:java}
    /**
     * 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];
    }
{code}

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

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

{code:java}
    /**
     * 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];
    }
{code}

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



> IndexOutOfBoundException in flusher selection logic in 
> GridCacheWriteBehindStore
> --------------------------------------------------------------------------------
>
>                 Key: IGNITE-14898
>                 URL: https://issues.apache.org/jira/browse/IGNITE-14898
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 2.10
>            Reporter: Ilya Korol
>            Assignee: Ilya Korol
>            Priority: Major
>
> There i a bug in GridCacheWriteBehindStore method for selecting which flusher 
> should be used for current data write by specified key:
> {code:java}
>     /**
>      * 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];
>     }
> {code}
> 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to