Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 134
Fix miscellaneous state machine bugs#3283
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
29 changes: 27 additions & 2 deletions
29 ...de/src/services/stateMachineManager/stateMonitoring/findReplicaSetUpdates.jobProcessor.js
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 |
|---|---|---|
| @@ -87,16 +87,22 @@ module.exports = async function ({ | ||
| // Combine each promise's updateReplicaSetOps into a job | ||
| for (const updateReplicaSetOp of updateReplicaSetOps) { | ||
| const { wallet } = updateReplicaSetOp | ||
| updateReplicaSetJobs.push({ | ||
| jobName: JOB_NAMES.UPDATE_REPLICA_SET, | ||
| jobData: { | ||
| wallet: updateReplicaSetOp.wallet, | ||
| wallet, | ||
| userId: updateReplicaSetOp.user_id, | ||
| primary: updateReplicaSetOp.primary, | ||
| secondary1: updateReplicaSetOp.secondary1, | ||
| secondary2: updateReplicaSetOp.secondary2, | ||
| unhealthyReplicas: Array.from(updateReplicaSetOp.unhealthyReplicas), | ||
| replicaSetNodesToUserClockStatusesMap | ||
| replicaSetNodesToUserClockStatusesMap: | ||
| _transformAndFilterNodeToClockValuesMapping( | ||
| replicaSetNodesToUserClockStatusesMap, | ||
| wallet | ||
| ) | ||
| } | ||
| }) | ||
| } | ||
| @@ -295,3 +301,22 @@ const _findReplicaSetUpdatesForUser = async ( | ||
| return requiredUpdateReplicaSetOps | ||
| } | ||
| /** | ||
| * Transforms data type from ((K1,V1) => (K2,V2)) to (K1,V1[K2]), where K1 is the node endpoint, | ||
| * V1 is the mapping, and K2 is the wallet to filter by. Default to clock value of -1 whenever the given | ||
| * wallet isn't present in a node's mapping. | ||
| * @param {Object} replicaSetNodesToUserClockStatusesMap map of secondary endpoint strings to (map of user wallet strings to clock value of secondary for user) | ||
| * @param {string} wallet the wallet to filter clock values for (other wallets will be exlucded from the output) | ||
| * @returns mapping of node endpoint (string) to clock value (number) on that node for the given wallet | ||
| */ | ||
| const _transformAndFilterNodeToClockValuesMapping = ( | ||
SidSethi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| replicaSetNodesToUserClockStatusesMap, | ||
| wallet | ||
| ) => { | ||
| return Object.fromEntries( | ||
| Object.entries(replicaSetNodesToUserClockStatusesMap).map( | ||
| ([node, clockValueMapping]) => [node, clockValueMapping[wallet] || -1] | ||
| ) | ||
| ) | ||
| } | ||
9 changes: 7 additions & 2 deletions
9 ...or-node/src/services/stateMachineManager/stateMonitoring/findSyncRequests.jobProcessor.js
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
35 changes: 16 additions & 19 deletions
35 ...ode/src/services/stateMachineManager/stateReconciliation/updateReplicaSet.jobProcessor.js
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
26 changes: 10 additions & 16 deletions
26 creator-node/test/findReplicaSetUpdates.jobProcessor.test.js
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
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.
Uh oh!
There was an error while loading. Please reload this page.