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

Roman Puchkovskiy updated IGNITE-25302:
---------------------------------------
    Description: 
A problem with replicas' shutdown is that, when we shut a replica (and its 
listener) down, some in-flight requests might still be processed. We don't wait 
for them to be finished and proceed with closing the storages, so such requests 
processing will be failed.

There is a general problem: how to stop a component (doing stuff 
asynchronously) in such a way that its in-flight work is either finished or 
rejected gracefully.

There are two approaches. One is the cleaner: 'stop accepting new load, wait 
till in-flight load gets finished, close internal resources, proceed with stop 
to the lower level component'. Another is faster and simpler: 'switch to the 
stopping mode which makes requests being failed with exception indicating stop, 
let the callers handle them, proceed with stop to the lower level component'.

In Ignite 3, all (or most) components employ second approach. It was decided 
that first approach is the preferable one and we should switch to it in future. 
So, for replica shutdown, we have the following options:
 # Implement first approach
 # Stick with second approach, but deal with the following problems:
 ## Should we be satisfied with busy locks which already protect the storages 
and avoid adding new busy locks in PartitionReplicaListener? Reliance on busy 
locks in storages is a bit hacky, but, on the other hand, this will not bring 
any additional performance penalty which additional busy locks will induce
 ## If we introduce proper busy locks above storages, they should throw either 
NodeStoppingException (for node stop) or something different, like 
ComponentStoppingException (for partition eviction)
 ## In any case, we will throw some exceptions which need to be handled by the 
ones who send ReplicaRequests
 ### Requests caused by implicit transaction operations should be retried 
automatically
 ### Other requests caused by user operations would be failed with a specific 
error code
 ### Requests caused by our internal machinery are to be handled by the callers

> Improve replica stop
> --------------------
>
>                 Key: IGNITE-25302
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25302
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Roman Puchkovskiy
>            Priority: Major
>              Labels: ignite-3
>
> A problem with replicas' shutdown is that, when we shut a replica (and its 
> listener) down, some in-flight requests might still be processed. We don't 
> wait for them to be finished and proceed with closing the storages, so such 
> requests processing will be failed.
> There is a general problem: how to stop a component (doing stuff 
> asynchronously) in such a way that its in-flight work is either finished or 
> rejected gracefully.
> There are two approaches. One is the cleaner: 'stop accepting new load, wait 
> till in-flight load gets finished, close internal resources, proceed with 
> stop to the lower level component'. Another is faster and simpler: 'switch to 
> the stopping mode which makes requests being failed with exception indicating 
> stop, let the callers handle them, proceed with stop to the lower level 
> component'.
> In Ignite 3, all (or most) components employ second approach. It was decided 
> that first approach is the preferable one and we should switch to it in 
> future. So, for replica shutdown, we have the following options:
>  # Implement first approach
>  # Stick with second approach, but deal with the following problems:
>  ## Should we be satisfied with busy locks which already protect the storages 
> and avoid adding new busy locks in PartitionReplicaListener? Reliance on busy 
> locks in storages is a bit hacky, but, on the other hand, this will not bring 
> any additional performance penalty which additional busy locks will induce
>  ## If we introduce proper busy locks above storages, they should throw 
> either NodeStoppingException (for node stop) or something different, like 
> ComponentStoppingException (for partition eviction)
>  ## In any case, we will throw some exceptions which need to be handled by 
> the ones who send ReplicaRequests
>  ### Requests caused by implicit transaction operations should be retried 
> automatically
>  ### Other requests caused by user operations would be failed with a specific 
> error code
>  ### Requests caused by our internal machinery are to be handled by the 
> callers



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

Reply via email to