-
Notifications
You must be signed in to change notification settings - Fork 872
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
Add HSM Deletion Tombstone Tracking #7014
base: main
Are you sure you want to change the base?
Conversation
case "Activity": | ||
tombstone = &persistencespb.StateMachineTombstone{ | ||
StateMachineKey: &persistencespb.StateMachineTombstone_ActivityScheduledEventId{ | ||
ActivityScheduledEventId: ms.parseID(key.ID), | ||
}, | ||
} | ||
case "Timer": | ||
tombstone = &persistencespb.StateMachineTombstone{ | ||
StateMachineKey: &persistencespb.StateMachineTombstone_TimerId{ | ||
TimerId: key.ID, | ||
}, | ||
} | ||
case "ChildExecution": | ||
tombstone = &persistencespb.StateMachineTombstone{ | ||
StateMachineKey: &persistencespb.StateMachineTombstone_ChildExecutionInitiatedEventId{ | ||
ChildExecutionInitiatedEventId: ms.parseID(key.ID), | ||
}, | ||
} | ||
case "RequestCancel": | ||
tombstone = &persistencespb.StateMachineTombstone{ | ||
StateMachineKey: &persistencespb.StateMachineTombstone_RequestCancelInitiatedEventId{ | ||
RequestCancelInitiatedEventId: ms.parseID(key.ID), | ||
}, | ||
} | ||
case "Signal": | ||
tombstone = &persistencespb.StateMachineTombstone{ | ||
StateMachineKey: &persistencespb.StateMachineTombstone_SignalExternalInitiatedEventId{ | ||
SignalExternalInitiatedEventId: ms.parseID(key.ID), | ||
}, | ||
} | ||
} |
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.
This is not necessary, you only need to track StateMachinePath
changes here. Activities and other state machines pre-date the HSM framework and won't be reflected in the oplog.
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.
Changed! Thanks
if ms.stateMachineNode != nil { | ||
opLog, err := ms.stateMachineNode.Outputs() | ||
if err != nil { | ||
panic(fmt.Sprintf("Failed to get HSM operation log: %v", err)) |
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.
Don't panic here, return an error instead and handle it in the caller.
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'd be okay panicking if the only reason this would happen only unexpectedly. Consider making the Outputs()
function panic instead of returning an error.
@@ -5907,6 +5907,39 @@ func (ms *MutableStateImpl) closeTransactionTrackTombstones( | |||
} | |||
|
|||
var tombstones []*persistencespb.StateMachineTombstone | |||
if ms.stateMachineNode != nil { | |||
opLog, err := ms.stateMachineNode.Outputs() |
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.
We can rename Outputs
to OpLog
.
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.
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.
LGTM.
Applying those tombstones will be in a later PR I assume?
What changed?
StateMachinePath
tombstone type for HSM deletions alongside existing activity/timer/etc. tombstonesWhy?
Without this:
How did you test it?
Draft PR. Tests not developed yet
Potential risks
Risk Mitigation:
Documentation
No changes required - this extends an internal implementation detail of how deletions are tracked.
Is hotfix candidate?
No - this should follow normal deployment process.