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

Mirza Aliev updated IGNITE-23882:
---------------------------------
    Description: 
h3. Motivation

For the purpose of the partition graceful start 
https://issues.apache.org/jira/browse/IGNITE-23874
we need to implement the functionality to check if partition state machine had 
user's input after specific raft group reconfiguration.

In the flow of the partition graceful start, when node send request to a node 
from the next chain,
it specifies raft index of the conf, and the target node must answer if there 
was user input after this raft group reconfiguration.

To receive this information, we must do two things: track and persist in the 
partition state machine info if there was user input after raft reconfiguration.
Second thing is the ability on node restart replay raft log in a safe mode and 
track if there was not user inputs that weren't applied to SM. 
This will be done in this ticket 
https://issues.apache.org/jira/browse/IGNITE-23881

In this ticket the first thing must be implemented, meaning that node must 
track and persist info if there was any user specific command 
that was applied after last raft reconfiguration.
h3. Implementation notes

To achieve this, we need to introduce method to {{PartitionListener}} with the 
name like {{hasUserInput(int cfgIndex)}} where {{cfgIndex}} is 
the raft index on which this cfg was applied.

Prerequisites are already implemented, we already have 
{{PartitionListener#onConfigurationCommitted}} which saves to storage 
configuration with the term and index.

 

New Pseudo code which must be implemented in  {{PartitionListener}}

{code:java}
boolean hasUserInput(TermIndex cfgTermIndex) {
    currentCfg = onConfigurationCommitted()

    if (currentCfg.termIndex < cfgIndex) {
        return false;
    }

    return hasUserInputAfterLastReconfiguration();
}

boolean hasUserInputAfterLastReconfiguration() {
    return storage.hasUserInputAfterLastReconfiguration();
}

onWrite() {
   ...
   if (command instanceof "UserSpecificCommands") {
      if (!storage.hasUserInputAfterLastReconfiguration()) {
            storage.hasUserInputAfterLastReconfiguration(true)
      }
   }
}

"UserSpecificCommands" = [UpdateCommand, UpdateAllCommand, FinishTxCommand, 
WriteIntentSwitchCommand, UpdateMinimumActiveTxBeginTimeCommand]

onConfigurationCommitted(CommittedConfiguration config) {
    ...
    storage.hasUserInputAfterLastReconfiguration(false)
}

{code}
We need to extend {{PartitionListener}} with new getter 
{{PartitionListener#committedGroupConfiguration}} which returns 
{{RaftGroupConfiguration}}
We need to extend {{org.apache.ignite.internal.raft.RaftGroupConfiguration}} 
with term and index.
h3. Definition of done
 * Node must able to check if there was user input into the specified partition 
after specified raft re-configuration event.

  was:
h3. Motivation

For the purpose of the partition graceful start 
https://issues.apache.org/jira/browse/IGNITE-23874
we need to implement the functionality to check if partition state machine has 
user's input after raft group reconfiguration.

In the flow of the partition graceful start, when node send request to a node 
from the next chain,
it specifies raft index of the conf, and the target node must answer if there 
was user input after this raft group reconfiguration. 

To receive this information, we must do two things: track and persist in the 
partition state machine info if there was user input after raft 
reconfiguration, so we could use this info on restart.

Second thing is the ability on node restart replay raft log in a safe mode and 
track if there was not user inputs that weren't yet applied to state machine. 
This will be done in this ticket 
https://issues.apache.org/jira/browse/IGNITE-23881

In this ticket the first thing must be implemented. 


h3. Implementation notes

h3. Definition of done

* Node must track if there was user input into the specified partition after 
specified raft re-configuration event.   


> Within raft SM evaluate whether there was user input after group 
> reconfiguration
> --------------------------------------------------------------------------------
>
>                 Key: IGNITE-23882
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23882
>             Project: Ignite
>          Issue Type: New Feature
>            Reporter: Alexander Lapin
>            Priority: Major
>              Labels: ignite-3
>
> h3. Motivation
> For the purpose of the partition graceful start 
> https://issues.apache.org/jira/browse/IGNITE-23874
> we need to implement the functionality to check if partition state machine 
> had user's input after specific raft group reconfiguration.
> In the flow of the partition graceful start, when node send request to a node 
> from the next chain,
> it specifies raft index of the conf, and the target node must answer if there 
> was user input after this raft group reconfiguration.
> To receive this information, we must do two things: track and persist in the 
> partition state machine info if there was user input after raft 
> reconfiguration.
> Second thing is the ability on node restart replay raft log in a safe mode 
> and track if there was not user inputs that weren't applied to SM. 
> This will be done in this ticket 
> https://issues.apache.org/jira/browse/IGNITE-23881
> In this ticket the first thing must be implemented, meaning that node must 
> track and persist info if there was any user specific command 
> that was applied after last raft reconfiguration.
> h3. Implementation notes
> To achieve this, we need to introduce method to {{PartitionListener}} with 
> the name like {{hasUserInput(int cfgIndex)}} where {{cfgIndex}} is 
> the raft index on which this cfg was applied.
> Prerequisites are already implemented, we already have 
> {{PartitionListener#onConfigurationCommitted}} which saves to storage 
> configuration with the term and index.
>  
> New Pseudo code which must be implemented in  {{PartitionListener}}
> {code:java}
> boolean hasUserInput(TermIndex cfgTermIndex) {
>     currentCfg = onConfigurationCommitted()
>     if (currentCfg.termIndex < cfgIndex) {
>         return false;
>     }
>     return hasUserInputAfterLastReconfiguration();
> }
> boolean hasUserInputAfterLastReconfiguration() {
>     return storage.hasUserInputAfterLastReconfiguration();
> }
> onWrite() {
>    ...
>    if (command instanceof "UserSpecificCommands") {
>       if (!storage.hasUserInputAfterLastReconfiguration()) {
>             storage.hasUserInputAfterLastReconfiguration(true)
>       }
>    }
> }
> "UserSpecificCommands" = [UpdateCommand, UpdateAllCommand, FinishTxCommand, 
> WriteIntentSwitchCommand, UpdateMinimumActiveTxBeginTimeCommand]
> onConfigurationCommitted(CommittedConfiguration config) {
>     ...
>     storage.hasUserInputAfterLastReconfiguration(false)
> }
> {code}
> We need to extend {{PartitionListener}} with new getter 
> {{PartitionListener#committedGroupConfiguration}} which returns 
> {{RaftGroupConfiguration}}
> We need to extend {{org.apache.ignite.internal.raft.RaftGroupConfiguration}} 
> with term and index.
> h3. Definition of done
>  * Node must able to check if there was user input into the specified 
> partition after specified raft re-configuration event.



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

Reply via email to