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

Aleksandr Polovtcev updated IGNITE-20692:
-----------------------------------------
    Description: 
I propose to introduce a mechanism for producing and consuming events related 
to the lifecycle of Partitions (a.k.a. Replicas). This mechanism can useful for 
other components, such as Index Manager to track which indices should be 
created or dropped because the corresponding partition has been moved.

I imagine this mechanism as follows:

{code:java}
interface ReplicaLifecycleListener {
    /**
     * Called after a replica has been started on the local node.
     */
    CompletableFuture<Void> afterReplicaStarted(ReplicationGroupId 
replicaGrpId);

    /**
     * Called before a replica has been stopped on the local node.
     */
    CompletableFuture<Void> beforeReplicaStopped(ReplicationGroupId 
replicaGrpId);
}
{code}

This listener should be notified of the events by the Replica Manager. Replica 
Manager should also provide API to register/deregister such listeners.

Also note that notification methods return CompletableFutures. These futures 
should block the corresponding operation (adding the new Replica to the 
ReplicaManager#replicas map or stopping a Replica). This will allow to obtain a 
happens-before relationship between the events and their listneres.


> Introduce Partition lifecycle events
> ------------------------------------
>
>                 Key: IGNITE-20692
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20692
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Aleksandr Polovtcev
>            Priority: Major
>              Labels: ignite-3
>
> I propose to introduce a mechanism for producing and consuming events related 
> to the lifecycle of Partitions (a.k.a. Replicas). This mechanism can useful 
> for other components, such as Index Manager to track which indices should be 
> created or dropped because the corresponding partition has been moved.
> I imagine this mechanism as follows:
> {code:java}
> interface ReplicaLifecycleListener {
>     /**
>      * Called after a replica has been started on the local node.
>      */
>     CompletableFuture<Void> afterReplicaStarted(ReplicationGroupId 
> replicaGrpId);
>     /**
>      * Called before a replica has been stopped on the local node.
>      */
>     CompletableFuture<Void> beforeReplicaStopped(ReplicationGroupId 
> replicaGrpId);
> }
> {code}
> This listener should be notified of the events by the Replica Manager. 
> Replica Manager should also provide API to register/deregister such listeners.
> Also note that notification methods return CompletableFutures. These futures 
> should block the corresponding operation (adding the new Replica to the 
> ReplicaManager#replicas map or stopping a Replica). This will allow to obtain 
> a happens-before relationship between the events and their listneres.



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

Reply via email to