Skip to content

Commit

Permalink
reserve delete_on_completion (#7036)
Browse files Browse the repository at this point in the history
## What changed?
Set delete_on_completion to reserved

## Why?
delete_on_completion is no longer needed

## How did you test it?
make

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
No
  • Loading branch information
justinp-tt authored Jan 21, 2025
1 parent 1125103 commit 2cbee2c
Show file tree
Hide file tree
Showing 7 changed files with 796 additions and 810 deletions.
1,588 changes: 788 additions & 800 deletions api/persistence/v1/executions.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/nexusoperations/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (d ScheduledEventDefinition) Apply(root *hsm.Node, event *historypb.History
if err != nil {
return err
}
_, err = AddChild(root, strconv.FormatInt(event.EventId, 10), event, token, true)
_, err = AddChild(root, strconv.FormatInt(event.EventId, 10), event, token)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion components/nexusoperations/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func newOperationNode(t *testing.T, backend *hsmtest.NodeBackend, event *history
root := newRoot(t, backend)
token, err := hsm.GenerateEventLoadToken(event)
require.NoError(t, err)
node, err := nexusoperations.AddChild(root, fmt.Sprintf("%d", event.EventId), event, token, false)
node, err := nexusoperations.AddChild(root, fmt.Sprintf("%d", event.EventId), event, token)
require.NoError(t, err)
return node
}
Expand Down
6 changes: 2 additions & 4 deletions components/nexusoperations/statemachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type Operation struct {
}

// AddChild adds a new operation child machine to the given node and transitions it to the SCHEDULED state.
func AddChild(node *hsm.Node, id string, event *historypb.HistoryEvent, eventToken []byte, deleteOnCompletion bool) (*hsm.Node, error) {
func AddChild(node *hsm.Node, id string, event *historypb.HistoryEvent, eventToken []byte) (*hsm.Node, error) {
attrs := event.GetNexusOperationScheduledEventAttributes()

node, err := node.AddChild(hsm.Key{Type: OperationMachineType, ID: id}, Operation{
Expand All @@ -78,9 +78,7 @@ func AddChild(node *hsm.Node, id string, event *historypb.HistoryEvent, eventTok
ScheduleToCloseTimeout: attrs.ScheduleToCloseTimeout,
RequestId: attrs.RequestId,
State: enumsspb.NEXUS_OPERATION_STATE_UNSPECIFIED,
// TODO(bergundy): actually delete on completion if this is set.
DeleteOnCompletion: deleteOnCompletion,
ScheduledEventToken: eventToken,
ScheduledEventToken: eventToken,
},
})

Expand Down
2 changes: 1 addition & 1 deletion components/nexusoperations/statemachine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestAddChild(t *testing.T) {
},
},
}
child, err := nexusoperations.AddChild(root, "test-id", event, []byte("token"), false)
child, err := nexusoperations.AddChild(root, "test-id", event, []byte("token"))
require.NoError(t, err)
opLog, err := root.Outputs()
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ message NexusOperationInfo {
// Operation name.
string operation = 3;

// If set the state machine will remove itself from the HSM tree on completion.
bool delete_on_completion = 4;
// reserved due to removal of delete_on_completion
reserved 4;

// Token for fetching the scheduled event.
bytes scheduled_event_token = 5;
Expand Down
2 changes: 1 addition & 1 deletion service/history/workflow/task_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func TestTaskGenerator_GenerateDirtySubStateMachineTasks(t *testing.T) {
ScheduleToCloseTimeout: durationpb.New(time.Hour),
},
},
}, []byte("token"), false)
}, []byte("token"))
require.NoError(t, err)
err = taskGenerator.GenerateDirtySubStateMachineTasks(reg)
require.NoError(t, err)
Expand Down

0 comments on commit 2cbee2c

Please sign in to comment.