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

Vladislav Pyatkov commented on IGNITE-20678:
--------------------------------------------

lgtm

> Find a way to get a MvTableStorage on recovery the index build
> --------------------------------------------------------------
>
>                 Key: IGNITE-20678
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20678
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Kirill Tkalenko
>            Assignee: Kirill Tkalenko
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> To implement the recovery of building indexes at the start of a node, it is 
> important for us to get a 
> *org.apache.ignite.internal.storage.engine.MvTableStorage* with an applied 
> replication log, how this can be done now is not entirely clear, but we need 
> to look at 
> org.apache.ignite.internal.table.distributed.TableManager#assignmentsUpdatedVv.
> I also think it’s worth reviewing the existing 
> *org.apache.ignite.internal.index.IndexManager#getMvTableStorage* and 
> changing it a little, for example, using the API from 
> *org.apache.ignite.internal.table.distributed.TableManager*, or getting rid 
> of it for a different API.
> h2. Update:
> After discussions and code analysis, I found out that this problem needs to 
> be solved using method 
> *org.apache.ignite.internal.placementdriver.PlacementDriver#getPrimaryReplica*
>  on recovery. 
> h3. But now it has the following bug:
> When restarting the cluster (for simplicity, a cluster of one node) on 
> recovery using *PlacementDriver#getPrimaryReplica*, we can get that the local 
> node is a primary replica that has not yet expired 
> (*org.apache.ignite.internal.placementdriver.ReplicaMeta#getExpirationTime* < 
> now). Then start building the index, but the index was already built; it’s 
> just that the replication log did not have time to be applied.
> h3. How to fix the bug:
> Add field 
> *org.apache.ignite.internal.placementdriver.ReplicaMeta#getLeaseholderId*, 
> meaning this is the node ID that is assigned at the start of the node 
> (org.apache.ignite.network.ClusterNode#id), which will be needed to check 
> whether the local replica is the primary one.
> If during recovery we use *PlacementDriver#getPrimaryReplica* and get that we 
> are not the primary replica, then we will not build an index, otherwise an 
> honest selection of the primary replica will occur using the replication log.



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

Reply via email to