mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
## What changed? <!-- Describe what has changed in this PR --> 1. Cap version history items when generating verify versioned transition task, to avoid possibility where the events go further than mutable state 2. Implement ExecutableTask BackFillEvents api, so we can have separate logic for handling RetryReplication error in state base replication. Otherwise, there is risk to apply events if share same Resend logic with event based replication. 3. Correct VerifyVersionedTransition task backfill logic 4. fix deadlock on workflow_state_replicator ## Why? <!-- Tell your future self why have you made these changes --> bug fix on state based replication ## How did you test it? <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> test will be added after implementation is agreed ## Potential risks <!-- Assuming the worst case, what can be broken when deploying this change to production? --> no risk. code path feature flag is not enabled. ## 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/`? --> n/a ## Is hotfix candidate? <!-- Is this PR a hotfix candidate or does it require a notification to be sent to the broader community? (Yes/No) --> no
345 lines
13 KiB
Go
345 lines
13 KiB
Go
// The MIT License
|
|
//
|
|
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
|
|
//
|
|
// Copyright (c) 2020 Uber Technologies, Inc.
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
// in the Software without restriction, including without limitation the rights
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in
|
|
// all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
// THE SOFTWARE.
|
|
|
|
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: executable_task.go
|
|
//
|
|
// Generated by this command:
|
|
//
|
|
// mockgen -copyright_file ../../../LICENSE -package replication -source executable_task.go -destination executable_task_mock.go
|
|
//
|
|
|
|
// Package replication is a generated GoMock package.
|
|
package replication
|
|
|
|
import (
|
|
context "context"
|
|
reflect "reflect"
|
|
time "time"
|
|
|
|
repication "go.temporal.io/server/api/replication/v1"
|
|
backoff "go.temporal.io/server/common/backoff"
|
|
definition "go.temporal.io/server/common/definition"
|
|
serviceerror "go.temporal.io/server/common/serviceerror"
|
|
tasks "go.temporal.io/server/common/tasks"
|
|
gomock "go.uber.org/mock/gomock"
|
|
)
|
|
|
|
// MockExecutableTask is a mock of ExecutableTask interface.
|
|
type MockExecutableTask struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockExecutableTaskMockRecorder
|
|
}
|
|
|
|
// MockExecutableTaskMockRecorder is the mock recorder for MockExecutableTask.
|
|
type MockExecutableTaskMockRecorder struct {
|
|
mock *MockExecutableTask
|
|
}
|
|
|
|
// NewMockExecutableTask creates a new mock instance.
|
|
func NewMockExecutableTask(ctrl *gomock.Controller) *MockExecutableTask {
|
|
mock := &MockExecutableTask{ctrl: ctrl}
|
|
mock.recorder = &MockExecutableTaskMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockExecutableTask) EXPECT() *MockExecutableTaskMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Abort mocks base method.
|
|
func (m *MockExecutableTask) Abort() {
|
|
m.ctrl.T.Helper()
|
|
m.ctrl.Call(m, "Abort")
|
|
}
|
|
|
|
// Abort indicates an expected call of Abort.
|
|
func (mr *MockExecutableTaskMockRecorder) Abort() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Abort", reflect.TypeOf((*MockExecutableTask)(nil).Abort))
|
|
}
|
|
|
|
// Ack mocks base method.
|
|
func (m *MockExecutableTask) Ack() {
|
|
m.ctrl.T.Helper()
|
|
m.ctrl.Call(m, "Ack")
|
|
}
|
|
|
|
// Ack indicates an expected call of Ack.
|
|
func (mr *MockExecutableTaskMockRecorder) Ack() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ack", reflect.TypeOf((*MockExecutableTask)(nil).Ack))
|
|
}
|
|
|
|
// Attempt mocks base method.
|
|
func (m *MockExecutableTask) Attempt() int {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Attempt")
|
|
ret0, _ := ret[0].(int)
|
|
return ret0
|
|
}
|
|
|
|
// Attempt indicates an expected call of Attempt.
|
|
func (mr *MockExecutableTaskMockRecorder) Attempt() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Attempt", reflect.TypeOf((*MockExecutableTask)(nil).Attempt))
|
|
}
|
|
|
|
// BackFillEvents mocks base method.
|
|
func (m *MockExecutableTask) BackFillEvents(ctx context.Context, remoteCluster string, workflowKey definition.WorkflowKey, startEventId, startEventVersion, endEventId, endEventVersion int64, newRunId string) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "BackFillEvents", ctx, remoteCluster, workflowKey, startEventId, startEventVersion, endEventId, endEventVersion, newRunId)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// BackFillEvents indicates an expected call of BackFillEvents.
|
|
func (mr *MockExecutableTaskMockRecorder) BackFillEvents(ctx, remoteCluster, workflowKey, startEventId, startEventVersion, endEventId, endEventVersion, newRunId any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackFillEvents", reflect.TypeOf((*MockExecutableTask)(nil).BackFillEvents), ctx, remoteCluster, workflowKey, startEventId, startEventVersion, endEventId, endEventVersion, newRunId)
|
|
}
|
|
|
|
// Cancel mocks base method.
|
|
func (m *MockExecutableTask) Cancel() {
|
|
m.ctrl.T.Helper()
|
|
m.ctrl.Call(m, "Cancel")
|
|
}
|
|
|
|
// Cancel indicates an expected call of Cancel.
|
|
func (mr *MockExecutableTaskMockRecorder) Cancel() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cancel", reflect.TypeOf((*MockExecutableTask)(nil).Cancel))
|
|
}
|
|
|
|
// DeleteWorkflow mocks base method.
|
|
func (m *MockExecutableTask) DeleteWorkflow(ctx context.Context, workflowKey definition.WorkflowKey) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "DeleteWorkflow", ctx, workflowKey)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// DeleteWorkflow indicates an expected call of DeleteWorkflow.
|
|
func (mr *MockExecutableTaskMockRecorder) DeleteWorkflow(ctx, workflowKey any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWorkflow", reflect.TypeOf((*MockExecutableTask)(nil).DeleteWorkflow), ctx, workflowKey)
|
|
}
|
|
|
|
// GetNamespaceInfo mocks base method.
|
|
func (m *MockExecutableTask) GetNamespaceInfo(ctx context.Context, namespaceID string) (string, bool, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetNamespaceInfo", ctx, namespaceID)
|
|
ret0, _ := ret[0].(string)
|
|
ret1, _ := ret[1].(bool)
|
|
ret2, _ := ret[2].(error)
|
|
return ret0, ret1, ret2
|
|
}
|
|
|
|
// GetNamespaceInfo indicates an expected call of GetNamespaceInfo.
|
|
func (mr *MockExecutableTaskMockRecorder) GetNamespaceInfo(ctx, namespaceID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNamespaceInfo", reflect.TypeOf((*MockExecutableTask)(nil).GetNamespaceInfo), ctx, namespaceID)
|
|
}
|
|
|
|
// IsRetryableError mocks base method.
|
|
func (m *MockExecutableTask) IsRetryableError(err error) bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "IsRetryableError", err)
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// IsRetryableError indicates an expected call of IsRetryableError.
|
|
func (mr *MockExecutableTaskMockRecorder) IsRetryableError(err any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableError", reflect.TypeOf((*MockExecutableTask)(nil).IsRetryableError), err)
|
|
}
|
|
|
|
// MarkPoisonPill mocks base method.
|
|
func (m *MockExecutableTask) MarkPoisonPill() error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "MarkPoisonPill")
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// MarkPoisonPill indicates an expected call of MarkPoisonPill.
|
|
func (mr *MockExecutableTaskMockRecorder) MarkPoisonPill() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkPoisonPill", reflect.TypeOf((*MockExecutableTask)(nil).MarkPoisonPill))
|
|
}
|
|
|
|
// Nack mocks base method.
|
|
func (m *MockExecutableTask) Nack(err error) {
|
|
m.ctrl.T.Helper()
|
|
m.ctrl.Call(m, "Nack", err)
|
|
}
|
|
|
|
// Nack indicates an expected call of Nack.
|
|
func (mr *MockExecutableTaskMockRecorder) Nack(err any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nack", reflect.TypeOf((*MockExecutableTask)(nil).Nack), err)
|
|
}
|
|
|
|
// ReplicationTask mocks base method.
|
|
func (m *MockExecutableTask) ReplicationTask() *repication.ReplicationTask {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ReplicationTask")
|
|
ret0, _ := ret[0].(*repication.ReplicationTask)
|
|
return ret0
|
|
}
|
|
|
|
// ReplicationTask indicates an expected call of ReplicationTask.
|
|
func (mr *MockExecutableTaskMockRecorder) ReplicationTask() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplicationTask", reflect.TypeOf((*MockExecutableTask)(nil).ReplicationTask))
|
|
}
|
|
|
|
// Reschedule mocks base method.
|
|
func (m *MockExecutableTask) Reschedule() {
|
|
m.ctrl.T.Helper()
|
|
m.ctrl.Call(m, "Reschedule")
|
|
}
|
|
|
|
// Reschedule indicates an expected call of Reschedule.
|
|
func (mr *MockExecutableTaskMockRecorder) Reschedule() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reschedule", reflect.TypeOf((*MockExecutableTask)(nil).Reschedule))
|
|
}
|
|
|
|
// Resend mocks base method.
|
|
func (m *MockExecutableTask) Resend(ctx context.Context, remoteCluster string, retryErr *serviceerror.RetryReplication, remainingAttempt int) (bool, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Resend", ctx, remoteCluster, retryErr, remainingAttempt)
|
|
ret0, _ := ret[0].(bool)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Resend indicates an expected call of Resend.
|
|
func (mr *MockExecutableTaskMockRecorder) Resend(ctx, remoteCluster, retryErr, remainingAttempt any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Resend", reflect.TypeOf((*MockExecutableTask)(nil).Resend), ctx, remoteCluster, retryErr, remainingAttempt)
|
|
}
|
|
|
|
// RetryPolicy mocks base method.
|
|
func (m *MockExecutableTask) RetryPolicy() backoff.RetryPolicy {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "RetryPolicy")
|
|
ret0, _ := ret[0].(backoff.RetryPolicy)
|
|
return ret0
|
|
}
|
|
|
|
// RetryPolicy indicates an expected call of RetryPolicy.
|
|
func (mr *MockExecutableTaskMockRecorder) RetryPolicy() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetryPolicy", reflect.TypeOf((*MockExecutableTask)(nil).RetryPolicy))
|
|
}
|
|
|
|
// SourceClusterName mocks base method.
|
|
func (m *MockExecutableTask) SourceClusterName() string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "SourceClusterName")
|
|
ret0, _ := ret[0].(string)
|
|
return ret0
|
|
}
|
|
|
|
// SourceClusterName indicates an expected call of SourceClusterName.
|
|
func (mr *MockExecutableTaskMockRecorder) SourceClusterName() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SourceClusterName", reflect.TypeOf((*MockExecutableTask)(nil).SourceClusterName))
|
|
}
|
|
|
|
// State mocks base method.
|
|
func (m *MockExecutableTask) State() tasks.State {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "State")
|
|
ret0, _ := ret[0].(tasks.State)
|
|
return ret0
|
|
}
|
|
|
|
// State indicates an expected call of State.
|
|
func (mr *MockExecutableTaskMockRecorder) State() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "State", reflect.TypeOf((*MockExecutableTask)(nil).State))
|
|
}
|
|
|
|
// SyncState mocks base method.
|
|
func (m *MockExecutableTask) SyncState(ctx context.Context, syncStateErr *serviceerror.SyncState, remainingAttempt int) (bool, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "SyncState", ctx, syncStateErr, remainingAttempt)
|
|
ret0, _ := ret[0].(bool)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// SyncState indicates an expected call of SyncState.
|
|
func (mr *MockExecutableTaskMockRecorder) SyncState(ctx, syncStateErr, remainingAttempt any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncState", reflect.TypeOf((*MockExecutableTask)(nil).SyncState), ctx, syncStateErr, remainingAttempt)
|
|
}
|
|
|
|
// TaskCreationTime mocks base method.
|
|
func (m *MockExecutableTask) TaskCreationTime() time.Time {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "TaskCreationTime")
|
|
ret0, _ := ret[0].(time.Time)
|
|
return ret0
|
|
}
|
|
|
|
// TaskCreationTime indicates an expected call of TaskCreationTime.
|
|
func (mr *MockExecutableTaskMockRecorder) TaskCreationTime() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TaskCreationTime", reflect.TypeOf((*MockExecutableTask)(nil).TaskCreationTime))
|
|
}
|
|
|
|
// TaskID mocks base method.
|
|
func (m *MockExecutableTask) TaskID() int64 {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "TaskID")
|
|
ret0, _ := ret[0].(int64)
|
|
return ret0
|
|
}
|
|
|
|
// TaskID indicates an expected call of TaskID.
|
|
func (mr *MockExecutableTaskMockRecorder) TaskID() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TaskID", reflect.TypeOf((*MockExecutableTask)(nil).TaskID))
|
|
}
|
|
|
|
// TerminalState mocks base method.
|
|
func (m *MockExecutableTask) TerminalState() bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "TerminalState")
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// TerminalState indicates an expected call of TerminalState.
|
|
func (mr *MockExecutableTaskMockRecorder) TerminalState() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TerminalState", reflect.TypeOf((*MockExecutableTask)(nil).TerminalState))
|
|
}
|