8000 Add RebuildMutableState API by wxing1292 · Pull Request #2532 · temporalio/temporal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add RebuildMutableState API #2532

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
merged 6 commits into from
Feb 23, 2022
Merged

Add RebuildMutableState API #2532

merged 6 commits into from
Feb 23, 2022

Conversation

wxing1292
Copy link
Contributor

What changed?

  • Add RebuildMutableState API to admin & history service
  • Add integration test

Why?
This API allows operator to rebuild the mutable state using persisted history events, in case DB corruption ever occurs.

How did you test it?
Integration test

Potential risks
N/A

Is hotfix candidate?
No

@wxing1292 wxing1292 requested a review from a team as a code owner February 23, 2022 02:31
Comment on lines +452 to +454
if err != nil {
return nil, adh.error(err, scope)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// note: this is an admin API, for operator to recover a corrupted mutable state, so state transition count
// should remain the same, the -= 1 exists here since later CloseTransactionAsSnapshot will += 1 to state transition count
rebuildMutableState.GetExecutionInfo().StateTransitionCount = stateTransitionCount - 1
rebuildMutableState.SetUpdateCondition(rebuildMutableState.GetNextEventID(), dbRecordVersion)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If next eventID in db is corrupted, does it mean the update will fail?
Shall we use the nextEvenID in msRecord here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we stop using next event ID as CAS condition ~6 months ago, we should do more cleanup.

@wxing1292 wxing1292 enabled auto-merge (squash) February 23, 2022 06:33
@wxing1292 wxing1292 merged commit a5a91ff into temporalio:master Feb 23, 2022
@wxing1292 wxing1292 deleted the rebuild-ms-api branch February 23, 2022 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0