[ 
https://issues.apache.org/jira/browse/IGNITE-21482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815291#comment-17815291
 ] 

Vladimir Steshin commented on IGNITE-21482:
-------------------------------------------

The only usage of the _last version_ (except the _asserts_) is 
inside_GridDhtPartitionsExchangeFuture_. It takes 
_GridDhtPartitionsAbstractMessage#lastVersion()_. Looks like only the _order_ 
is used and fixing of the other fields is safe. The tests have passed.

1) _void updatePartitionFullMap(AffinityTopologyVersion resTopVer, 
GridDhtPartitionsFullMessage msg)_:
{code:java}
cctx.versions().onExchange(msg.lastVersion().order());
{code}

2) _void onReceiveSingleMessage(final ClusterNode node, final 
GridDhtPartitionsSingleMessage msg)_ , _updateLastVersion(msg.lastVersion())_:
{code:java}
if (old == null || Long.compare(old.order(), ver.order()) < 0)
{code}

3) _void finishExchangeOnCoordinator(@Nullable Collection<ClusterNode> 
sndResNodes)_:
{code:java}
 cctx.versions().onExchange(lastVer.get().order());
{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
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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 the initialization code. The 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