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

Vladimir Steshin updated IGNITE-21482:
--------------------------------------
    Description: 
GridCacheVersionManager has wierd initialization of its _last_ version:
{code:java}
public void onLocalJoin(long topVer) {
        long startTime = cctx.kernalContext().discovery().gridStartTime();

        if (startTime != 0)
            offset = (int)((startTime - TOP_VER_BASE_TIME) / 1000);

        last = new GridCacheVersion(0, order.get(), 0, dataCenterId);
        ...
    }
{code}

_topVer_, _nodeOrder_ and _offset_ are ignored. While _GridCacheVersion_ says 
'_topVer Topology version plus number of seconds from the start time of the 
first grid node._'. If this 'zeroed' value is read before any CRUD, a following 
comparation of the versions may fail. This happened in 
[IGNITE-21236|https://issues.apache.org/jira/browse/IGNITE-21236]. 

We should revise initialization of this value. Assumed fix is:
{code:java}
last = new GridCacheVersion((int)topVer + offset, order.get(), 
(int)cctx.localNode().order(), dataCenterId);
{code}


  was:
GridCacheVersionManager has wierd initialization of its _last_ version:
{code:java}
public void onLocalJoin(long topVer) {
        long startTime = cctx.kernalContext().discovery().gridStartTime();

        if (startTime != 0)
            offset = (int)((startTime - TOP_VER_BASE_TIME) / 1000);

        last = new GridCacheVersion(0, order.get(), 0, dataCenterId);
        ...
    }
{code}

_topVer_, _nodeOrder_ and _offset_ are ignored. While _GridCacheVersion_ says 
'_topVer Topology version plus number of seconds from the start time of the 
first grid node._'. If this value is read before any CRUD, a following version 
comparation of the versions may fail. This happened in 
[IGNITE-21236|https://issues.apache.org/jira/browse/IGNITE-21236]. 

We should revise initialization of this value. Assumed fix is:
{code:java}
last = new GridCacheVersion((int)topVer + offset, order.get(), 
(int)cctx.localNode().order(), dataCenterId);
{code}



> Fix of initialization of the last version in GridCacheVersionManager
> --------------------------------------------------------------------
>
>                 Key: IGNITE-21482
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21482
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Vladimir Steshin
>            Priority: Minor
>
> GridCacheVersionManager has wierd initialization of its _last_ version:
> {code:java}
> public void onLocalJoin(long topVer) {
>         long startTime = cctx.kernalContext().discovery().gridStartTime();
>         if (startTime != 0)
>             offset = (int)((startTime - TOP_VER_BASE_TIME) / 1000);
>         last = new GridCacheVersion(0, order.get(), 0, dataCenterId);
>         ...
>     }
> {code}
> _topVer_, _nodeOrder_ and _offset_ are ignored. While _GridCacheVersion_ says 
> '_topVer Topology version plus number of seconds from the start time of the 
> first grid node._'. If this 'zeroed' value is read before any CRUD, a 
> following comparation of the versions may fail. This happened in 
> [IGNITE-21236|https://issues.apache.org/jira/browse/IGNITE-21236]. 
> We should revise initialization of this value. Assumed fix is:
> {code:java}
> last = new GridCacheVersion((int)topVer + offset, order.get(), 
> (int)cctx.localNode().order(), dataCenterId);
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to