-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INDY-971: Added state diagrams for catch-up actors (#630)
* INDY-971: Added state diagrams for catch-up actors - Added initial versions of state diagrams for catch-up actors. Signed-off-by: Nikita Spivachuk <[email protected]> * INDY-971: Minor corrections in catch-up diagrams - Made minor corrections in the state diagrams for catch-up actors. Signed-off-by: Nikita Spivachuk <[email protected]> * INDY-971: Parallel lag checks for ledgers (design) - Added parallel lag checks for different ledgers to the design of CatchUpAll actor. Signed-off-by: Nikita Spivachuk <[email protected]> * INDY-971: Added comment to catch-up design - Added a clarification comment to the design of CatchUpLedger actor. Signed-off-by: Nikita Spivachuk <[email protected]>
- Loading branch information
1 parent
b33f1d7
commit 0192696
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@startuml | ||
|
||
[*] --> Ready | ||
|
||
state Ready { | ||
note "One nested finite-state machine per ledger" as NestedFsmForReadyState | ||
|
||
[*] --> Idle | ||
|
||
Idle --> Checking : CheckIfLedgerLagged(x) / request LedgerStatuses(x) from others | ||
|
||
state Checking_LedgerStatus <<choice>> | ||
Checking --> Checking_LedgerStatus : LedgerStatus(x) | ||
|
||
state Checking_LedgerStatus_Newer <<choice>> | ||
Checking_LedgerStatus --> Checking_LedgerStatus_Newer : [newer] | ||
state Checking_LedgerStatus_NotNewer <<choice>> | ||
Checking_LedgerStatus --> Checking_LedgerStatus_NotNewer : [not newer] | ||
|
||
Checking_LedgerStatus_Newer --> Checking : [did not gather f+1 newer LSes(x)] | ||
Checking_LedgerStatus_Newer --> Idle : [gathered f+1 newer LSes(x)] / StartCatchup | ||
|
||
Checking_LedgerStatus_NotNewer --> Checking : [did not gather n-f-1 not newer LSes(x)] | ||
Checking_LedgerStatus_NotNewer --> Idle : [gathered n-f-1 not newer LSes(x)] | ||
} | ||
|
||
Ready --> CatchingUpLedgers : StartCatchup / lastTxn3PCs = []; StartLedgerCatchup(0) | ||
|
||
state CatchingUpLedgers_LedgerCatchupFinished <<choice>> | ||
CatchingUpLedgers --> CatchingUpLedgers_LedgerCatchupFinished : LedgerCatchupFinished(i, lastTxn3PC) / lastTxn3PCs.append(lastTxn3PC) | ||
|
||
CatchingUpLedgers_LedgerCatchupFinished --> CatchingUpLedgers : [i+1 < len(ledgers)] / StartLedgerCatchup(i+1) | ||
CatchingUpLedgers_LedgerCatchupFinished --> Ready : [i+1 == len(ledgers)] / last3PC = max(lastTxn3PCs); CatchupFinished(last3PC) | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@startuml | ||
|
||
[*] --> Finished | ||
|
||
Finished --> Started : StartLedgerCatchup(ledgerId) / request LedgerStatuses from others | ||
|
||
state Started_LedgerStatus <<choice>> | ||
Started --> Started_LedgerStatus : LedgerStatus | ||
state Started_ConsistencyProof <<choice>> | ||
Started --> Started_ConsistencyProof : ConsistencyProof | ||
Started --> Started : RequestAdjustedCPs / request CPs for median end from others; remove all received CPs | ||
|
||
Started_LedgerStatus --> Started : [newer] / send own LedgerStatus backwards | ||
state Started_LedgerStatus_NotNewer <<choice>> | ||
Started_LedgerStatus --> Started_LedgerStatus_NotNewer : [not newer] | ||
|
||
Started_LedgerStatus_NotNewer --> Finished : [gathered n-f-1 not newer LSes] / send LedgerCatchupFinished(ledgerId, lastTxn3PC)\nwhere lastTxn3PC is minimal quorumed 3PC-key from even LedgerStatuses\nif there are any quorumed or None otherwise | ||
Started_LedgerStatus_NotNewer --> Started : [did not gather n-f-1 not newer LSes] | ||
|
||
state Started_ConsistencyProof_Gathered <<choice>> | ||
Started_ConsistencyProof --> Started_ConsistencyProof_Gathered : [gathered more than f+1 CPs] | ||
Started_ConsistencyProof --> Started_ConsistencyProof_Gathered : [gathered exactly f+1 CPs] / schedule RequestAdjustedCPs after t1 | ||
Started_ConsistencyProof --> Started : [did not gather f+1 CPs] | ||
|
||
Started_ConsistencyProof_Gathered --> Syncing : [gathered f+1 same CPs] / send CatchupReqs distributed among others; schedule RequestMissingTxns after t2 | ||
Started_ConsistencyProof_Gathered --> Started : [did not gather f+1 same CPs] | ||
|
||
state Syncing_CatchupRep <<choice>> | ||
Syncing --> Syncing : RequestMissingTxns / send CatchupReqs for missing txns distributed among shuffled others; schedule RequestMissingTxns after t2 | ||
Syncing --> Syncing_CatchupRep : CatchupRep / apply solid range adjacent to ledger of not yet applied received txns if such range exists | ||
|
||
Syncing_CatchupRep --> Finished : [ledger.size == catchUpTill] / send LedgerCatchupFinished(ledgerId, lastTxn3PC) | ||
Syncing_CatchupRep --> Syncing : [ledger.size < catchUpTill] | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@startuml | ||
|
||
[*] --> Active | ||
|
||
state Active { | ||
[*] --> LedgerStatusServantActive | ||
|
||
LedgerStatusServantActive --> LedgerStatusServantActive : Request for LedgerStatus / send LedgerStatus | ||
state LedgerStatusServantActive_LS <<choice>> | ||
LedgerStatusServantActive --> LedgerStatusServantActive_LS : LedgerStatus | ||
|
||
LedgerStatusServantActive_LS --> LedgerStatusServantActive : [older] / send ConsistencyProof | ||
LedgerStatusServantActive_LS --> LedgerStatusServantActive : [same] | ||
LedgerStatusServantActive_LS --> LedgerStatusServantActive : [newer] / send CheckIfLedgerLagged(ledgerId) | ||
-- | ||
|
||
[*] --> ConsistenyProofServantActive | ||
|
||
state ConsistenyProofServantActive_ReqForCP <<choice>> | ||
ConsistenyProofServantActive --> ConsistenyProofServantActive_ReqForCP : Request for ConsistencyProof(..., end) | ||
state ConsistenyProofServantActive_CP <<choice>> | ||
ConsistenyProofServantActive --> ConsistenyProofServantActive_CP : ConsistencyProof | ||
|
||
ConsistenyProofServantActive_ReqForCP --> ConsistenyProofServantActive : [end <= ledger.size] / send ConsistencyProof(..., end) | ||
ConsistenyProofServantActive_ReqForCP --> ConsistenyProofServantActive : [end > ledger.size] | ||
|
||
ConsistenyProofServantActive_CP --> ConsistenyProofServantActive : [end <= ledger.size] | ||
ConsistenyProofServantActive_CP --> ConsistenyProofServantActive : [end > ledger.size] / send CheckIfLedgerLagged(ledgerId) | ||
-- | ||
|
||
[*] --> CatchupReqServantActive | ||
|
||
state CatchupReqServantActive_CatchupReq <<choice>> | ||
CatchupReqServantActive --> CatchupReqServantActive_CatchupReq : CatchupReq(..., catchUpTill) | ||
|
||
CatchupReqServantActive_CatchupReq --> CatchupReqServantActive : [catchUpTill <= ledger.size] / send CatchupRep(...) | ||
CatchupReqServantActive_CatchupReq --> CatchupReqServantActive : [catchUpTill > ledger.size] | ||
} | ||
|
||
@enduml |