-
Couldn't load subscription status.
- Fork 26
DOC-6610 - Automatic Ledger Recovery: includes updates to node mainte… #2342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
paulmoloneyr3
wants to merge
8
commits into
release/platform/4.13
Choose a base branch
from
paulmoloneyr3/DOC-6610/auto-ledger-recovery-4-13
base: release/platform/4.13
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
95a9362
DOC-6610 - Automatic Ledger Recovery: includes updates to node mainte…
paulmoloneyr3 89dc693
DOC-6610 - removed invalid links
paulmoloneyr3 8c67b3a
DOC-6610 - review by Lucas
paulmoloneyr3 dcfa28b
DOC-6610 - typo
paulmoloneyr3 f7d47c1
DOC-6610 - review by Adel - edits
paulmoloneyr3 b311540
DOC-6610 - readded system flows topic
paulmoloneyr3 ff66cf4
DOC-6610 - more updates
paulmoloneyr3 a09c371
Merge branch 'release/platform/4.13' into paulmoloneyr3/DOC-6610/auto…
paulmoloneyr3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
content/en/platform/corda/4.13/enterprise/cordapps/system-flows.md
This file contains hidden or 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,49 @@ | ||
| --- | ||
| date: '2021-07-15' | ||
| menu: | ||
| corda-enterprise-4-13: | ||
| identifier: corda-enterprise-4-13-cordapps-flows-system | ||
| name: System flows | ||
| parent: corda-enterprise-4-13-cordapps-flows | ||
| tags: | ||
| - api | ||
| - flows | ||
| title: System flows | ||
| weight: 70 | ||
| --- | ||
|
|
||
|
|
||
| # System flows | ||
|
|
||
| *System flows* are [flows]({{< relref "api-flows.md" >}}) that run at node startup, before any services flows or user flows. The only currently supported system flow is [automatic ledger recovery]({{< relref "../node/ledger-recovery/automatic-ledger-recovery.md" >}}). | ||
|
|
||
| To configure a node to run system flows, including the automatic ledger recovery flow, the Boolean parameter `runSystemFlowsAtStartup` in the *[enterpriseConfiguration]({{< relref "../node/setup/corda-configuration-fields.md#enterpriseconfiguration" >}})* section of the [node configuration]({{< relref "../node/setup/corda-configuration-fields.md" >}}) must be set to `true`. The node will now have a system flow phase after startup, during which system flows are run. | ||
|
|
||
| A second parameter, `systemFlowsStuckSkipThreshold`, must also be configured. This integer parameter specifies the number of seconds that a system flow can be stuck on a suspension point during a system flow phase before it is skipped. Such a flow will skip up to two times: once in checkpoint system flows phase, then again in startup system flows phase. | ||
|
|
||
| System flow annotation has the property `supersedes`. This is used with the fully qualified name of another system flow to run that in its place at startup. For example, the following example shows how an existing system flow A could be superseded by flow B: | ||
|
|
||
| ``` | ||
| @SystemFlow(supersedes = "com.r3.mypackage.FlowA") | ||
| @StartableByRPC | ||
| @InitiatingFlow | ||
| class FlowB : FlowLogic<Unit>() { | ||
| @Suspendable | ||
| override fun call() { | ||
| //my code | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Once a node is configured to run system flows at startup, the following sequence of actions occurs during the system flow phase: | ||
|
|
||
| 1. If there are system flows that were previously checkpointed, these checkpointed system flows will run before the startup system flows. | ||
| 2. Once any checkpointed system flows have either completed or resulted in an exception, normal system flows then run. | ||
| 3. If there are paused flows, unpausing flows during the system flow phase will only unpause system flows. | ||
| 4. If a system flow gets stuck on a suspension point during the system flow phase for longer than the value (in seconds) of the `systemFlowsStuckSkipThreshold` configured in the [node configuration]({{< relref "../node/setup/corda-configuration-fields.md#enterpriseconfiguration" >}}), it will skip up to two times: once for checkpoint system flows and then again for startup system flows (each system flow is checked for being stuck every one minute). | ||
| 4. If the node is configured with the "[pause all flows]({{< relref "../flow-pause-and-resume.md#starting-the-node-and-pausing-all-flows" >}})" option (`smmStartMode="Safe"`) or flow draining mode is on, then system flows will not run at startup. | ||
| 5. While system flows at startup are running, if [a flow is started via RPC]({{< relref "../api-rpc.md" >}}), it will be blocked until the system flows have finished. | ||
| 6. Flows annotated with `@SystemFlow` can be started via RPC during the the system flow phase. | ||
| 7. Once system flows have finished, a `SystemFlowsPhaseCompleted` event is produced, and the metric `SystemFlows.Phase` is recorded, with values CHECKPOINT, STARTUP and USER in this order (only the latest metric is recorded). | ||
| 8. After the startup system flow phase ends and the `SystemFlowsPhaseCompleted` event is distributed, user and non-system checkpointed flows will run. | ||
| 9. [Resuming or retrying nodes]({{< relref "../flow-pause-and-resume.md" >}}) after the system flow phase ends will resume/retry only user and non-system flows. |
This file contains hidden or 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
46 changes: 46 additions & 0 deletions
46
...latform/corda/4.13/enterprise/node/ledger-recovery/automatic-ledger-recovery.md
This file contains hidden or 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,46 @@ | ||
| --- | ||
| date: '2023-11-20' | ||
| menu: | ||
| corda-enterprise-4-13: | ||
| identifier: corda-enterprise-4-13-corda-ledger-recovery-automatic | ||
| name: "Automatic ledger recovery" | ||
| parent: corda-enterprise-4-13-corda-ledger-recovery | ||
| tags: | ||
| - ledger recovery | ||
|
|
||
| title: Automatic ledger recovery | ||
| weight: 900 | ||
| --- | ||
|
|
||
| # Automatic ledger recovery | ||
|
|
||
| [Ledger recovery]({{< relref "ledger-recovery.md" >}}) was introduced to complement the normal backup and recovery process. Ledger recovery involves using [the Ledger Recovery flow]({{< relref "ledger-recovery-flow.md" >}}) to enable a node to restore transactions from its peer nodes in the event of local data loss. | ||
|
|
||
| *Automatic ledger recovery* enables ledger recovery to automatically run as a `EnterpriseLedgerRecoveryFlow` [system flow]({{< relref "../../cordapps/system-flows.md" >}}) at the startup of a node. This is done to ensure that the node will synchronize with the rest of its network on a regular basis, at startup, before proceeding to process user and customer CorDapp flows. Any time a node is restarted, the first thing it will do is identify any inconsistencies and repair them automatically (where possible). Any other flows are deferred until the ledger recovery flow is complete. | ||
|
|
||
| To turn on automatic ledger recovery, you must at a minimum: | ||
|
|
||
| 1. For the [node configuration]({{< relref "../setup/corda-configuration-fields.md" >}}), inside *[enterpriseConfiguration]({{< relref "../setup/corda-configuration-fields.md#enterpriseconfiguration" >}})*, configure `runSystemFlowsAtStartup` to be `true`. | ||
| 2. Specify a value for `recoveryMaximumBackupInterval`. | ||
|
|
||
| The following example shows the minimum configuration required to enable automatic ledger recovery: | ||
|
|
||
| ```json | ||
| enterpriseConfiguration = { | ||
| runSystemFlowsAtStartup = true | ||
| ledgerRecoveryConfiguration = { | ||
| recoveryMaximumBackupInterval = 15m | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Note that instead of using the `recoveryMaximumBackupInterval` node parameter, the `recoveryMaximumBackupInterval` [network parameter]({{< relref "../../network/available-network-parameters#recoverymaximumbackupinterval" >}}) can be used. | ||
|
|
||
| The metric `EnterpriseLedgerRecoveryFlow.RecoveryResults` is returned at the end automatic ledger recovery: | ||
|
|
||
| - `EnterpriseLedgerRecoveryFlow.RecoveryResults.TotalRecoveredRecords` - Long; total number of recovered transaction distribution records. For the purpose of recovery counting, | ||
| there is a one-to-one association with a single transaction on a node. | ||
| - `EnterpriseLedgerRecoveryFlow.RecoveryResults.TotalRecoveredTransactions` - Long; total number of recovered transactions. This may be less than the total number of distribution records | ||
| if there are any transactions that already exist in the recovering node's database. | ||
| - `EnterpriseLedgerRecoveryFlow.RecoveryResults.TotalRecoveredInFlightTransactions` - Long; total number of in-flight transactions recovered where the `alsoFinalize` option has been specified. | ||
| - `EnterpriseLedgerRecoveryFlow.RecoveryResults.TotalErrors` - | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know i mentioned we are not supporting the general system flow. But i guess as configuration deals in system flows we need to introduce the term.
Maybe describe something like a system flow will run automatically startup and the only system flow supported is EnterpriseLedgerRecoveryFlow
Need also explain the concepts of supercedes, incase default not good enough for user. i.e. another flow can supercede the recoveryflow