Files
tasks/service/history/workflow/task_refresher_mock.go
michaely520andGitHub 31410fb45d No-op refreshing tasks if flag set (#8484)
## What changed?

Followup to https://github.com/temporalio/temporal/pull/8480 

Optimize passive side to not generate close transfer tasks if the flag
is set in the replication stream.

## Why?
In the case where we are force replicating a large number of closed
child workflows, each replicated workflow will generate a close transfer
task, which requires a side-effect verification against its parent
workflow on the passive resulting in massive lock contention. This
optimization works by ensuring that if the flag is set on the
replication message, then it means the child has fully been processed on
the active and the parent already has the child result in its mutable
state, meaning no need to verify on passive side.


## How did you test it?
- [x] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)


Log is emitted correctly in functional test from prior PR. From test:
`2025-10-14T13:08:33.488-0700 info Skipping workflow close task
generation - close transfer task already acked on active cluster
{"cluster-name": "standby_mnomr", "host": "127.0.0.1:55628", "shard-id":
1, "address": "127.0.0.1:55628", "wf-namespace-id":
"a43d78f4-b7b5-4940-b8ee-c3156f8016aa", "wf-id":
"test-replication-d9b7cd87-b5ae-409c-ab94-532cb5cea69c", "wf-run-id":
"0199e456-a3d1-73d4-a44d-1c2ffaf387cf", "logging-call-at":
"/Users/michaely520/projects/temporal/service/history/workflow/task_refresher.go:120"}`
2025-10-16 22:04:14 +00:00

72 lines
2.9 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: task_refresher.go
//
// Generated by this command:
//
// mockgen -package workflow -source task_refresher.go -destination task_refresher_mock.go
//
// Package workflow is a generated GoMock package.
package workflow
import (
context "context"
reflect "reflect"
persistence "go.temporal.io/server/api/persistence/v1"
interfaces "go.temporal.io/server/service/history/interfaces"
gomock "go.uber.org/mock/gomock"
)
// MockTaskRefresher is a mock of TaskRefresher interface.
type MockTaskRefresher struct {
ctrl *gomock.Controller
recorder *MockTaskRefresherMockRecorder
isgomock struct{}
}
// MockTaskRefresherMockRecorder is the mock recorder for MockTaskRefresher.
type MockTaskRefresherMockRecorder struct {
mock *MockTaskRefresher
}
// NewMockTaskRefresher creates a new mock instance.
func NewMockTaskRefresher(ctrl *gomock.Controller) *MockTaskRefresher {
mock := &MockTaskRefresher{ctrl: ctrl}
mock.recorder = &MockTaskRefresherMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockTaskRefresher) EXPECT() *MockTaskRefresherMockRecorder {
return m.recorder
}
// PartialRefresh mocks base method.
func (m *MockTaskRefresher) PartialRefresh(ctx context.Context, mutableState interfaces.MutableState, minVersionedTransition *persistence.VersionedTransition, previousPendingChildIds map[int64]struct{}, shouldSkipGeneratingCloseTransferTask bool) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "PartialRefresh", ctx, mutableState, minVersionedTransition, previousPendingChildIds, shouldSkipGeneratingCloseTransferTask)
ret0, _ := ret[0].(error)
return ret0
}
// PartialRefresh indicates an expected call of PartialRefresh.
func (mr *MockTaskRefresherMockRecorder) PartialRefresh(ctx, mutableState, minVersionedTransition, previousPendingChildIds, shouldSkipGeneratingCloseTransferTask any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PartialRefresh", reflect.TypeOf((*MockTaskRefresher)(nil).PartialRefresh), ctx, mutableState, minVersionedTransition, previousPendingChildIds, shouldSkipGeneratingCloseTransferTask)
}
// Refresh mocks base method.
func (m *MockTaskRefresher) Refresh(ctx context.Context, mutableState interfaces.MutableState, shouldSkipGeneratingCloseTransferTask bool) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Refresh", ctx, mutableState, shouldSkipGeneratingCloseTransferTask)
ret0, _ := ret[0].(error)
return ret0
}
// Refresh indicates an expected call of Refresh.
func (mr *MockTaskRefresherMockRecorder) Refresh(ctx, mutableState, shouldSkipGeneratingCloseTransferTask any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Refresh", reflect.TypeOf((*MockTaskRefresher)(nil).Refresh), ctx, mutableState, shouldSkipGeneratingCloseTransferTask)
}