Skip to content

Commit

Permalink
mutable state builder coverage (#6454)
Browse files Browse the repository at this point in the history
* adds some coverage for the mutable state builder's reset
  • Loading branch information
davidporter-id-au authored Oct 31, 2024
1 parent db91cd1 commit 1050f22
Show file tree
Hide file tree
Showing 2 changed files with 539 additions and 23 deletions.
32 changes: 9 additions & 23 deletions service/history/execution/mutable_state_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ type (
// TODO: persist this to db
appliedEvents map[string]struct{}

insertTransferTasks []persistence.Task
insertCrossClusterTasks []persistence.Task
insertReplicationTasks []persistence.Task
insertTimerTasks []persistence.Task
insertTransferTasks []persistence.Task
insertReplicationTasks []persistence.Task
insertTimerTasks []persistence.Task

workflowRequests map[persistence.WorkflowRequest]struct{}

Expand Down Expand Up @@ -1348,12 +1347,6 @@ func (e *mutableStateBuilder) AddTransferTasks(
e.insertTransferTasks = append(e.insertTransferTasks, transferTasks...)
}

func (e *mutableStateBuilder) AddCrossClusterTasks(
crossClusterTasks ...persistence.Task,
) {
e.insertCrossClusterTasks = append(e.insertCrossClusterTasks, crossClusterTasks...)
}

// TODO convert AddTimerTasks to prepareTimerTasks
func (e *mutableStateBuilder) AddTimerTasks(
timerTasks ...persistence.Task,
Expand All @@ -1374,10 +1367,6 @@ func (e *mutableStateBuilder) DeleteTransferTasks() {
e.insertTransferTasks = nil
}

func (e *mutableStateBuilder) DeleteCrossClusterTasks() {
e.insertCrossClusterTasks = nil
}

func (e *mutableStateBuilder) DeleteTimerTasks() {
e.insertTimerTasks = nil
}
Expand Down Expand Up @@ -1483,10 +1472,9 @@ func (e *mutableStateBuilder) CloseTransactionAsMutation(
NewBufferedEvents: e.updateBufferedEvents,
ClearBufferedEvents: e.clearBufferedEvents,

TransferTasks: e.insertTransferTasks,
CrossClusterTasks: e.insertCrossClusterTasks,
ReplicationTasks: e.insertReplicationTasks,
TimerTasks: e.insertTimerTasks,
TransferTasks: e.insertTransferTasks,
ReplicationTasks: e.insertReplicationTasks,
TimerTasks: e.insertTimerTasks,

WorkflowRequests: convertWorkflowRequests(e.workflowRequests),

Expand Down Expand Up @@ -1563,10 +1551,9 @@ func (e *mutableStateBuilder) CloseTransactionAsSnapshot(
SignalInfos: convertPendingSignalInfos(e.pendingSignalInfoIDs),
SignalRequestedIDs: convertStringSetToSlice(e.pendingSignalRequestedIDs),

TransferTasks: e.insertTransferTasks,
CrossClusterTasks: e.insertCrossClusterTasks,
ReplicationTasks: e.insertReplicationTasks,
TimerTasks: e.insertTimerTasks,
TransferTasks: e.insertTransferTasks,
ReplicationTasks: e.insertReplicationTasks,
TimerTasks: e.insertTimerTasks,

WorkflowRequests: convertWorkflowRequests(e.workflowRequests),

Expand Down Expand Up @@ -1675,7 +1662,6 @@ func (e *mutableStateBuilder) cleanupTransaction() error {
e.nextEventIDInDB = e.GetNextEventID()

e.insertTransferTasks = nil
e.insertCrossClusterTasks = nil
e.insertReplicationTasks = nil
e.insertTimerTasks = nil

Expand Down
Loading

0 comments on commit 1050f22

Please sign in to comment.