mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
## What Retry CHASM tasks on standby indefinitely until Active cluster replication invalidates the logical tasks. ## Why Currently, if the standby cluster runs any CHASM task and none are valid, the physical task is then discarded. To prevent stuck execution cases where code deployments lead to stricter task validation and physical task discarding, we need to keep track of the physical task, only invalidating if the active cluster has completed or dropped it. ## How did you test it? - [X] built - [X] run locally and tested manually - [X] covered by existing tests - [X] added new unit test(s) - [ ] added new functional test(s)
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination chasm_tree_mock.go
|
|
|
|
package interfaces
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
persistencespb "go.temporal.io/server/api/persistence/v1"
|
|
"go.temporal.io/server/chasm"
|
|
"go.temporal.io/server/service/history/tasks"
|
|
)
|
|
|
|
var _ ChasmTree = (*chasm.Node)(nil)
|
|
|
|
// TODO: Remove this interface and use *chasm.Node directly
|
|
// when chasm/tree.go implementation completes.
|
|
type ChasmTree interface {
|
|
CloseTransaction() (chasm.NodesMutation, error)
|
|
Snapshot(*persistencespb.VersionedTransition) chasm.NodesSnapshot
|
|
ApplySystemMutation(chasm.NodesMutation) error
|
|
ApplyMutation(chasm.NodesMutation) error
|
|
ApplySnapshot(chasm.NodesSnapshot) error
|
|
RefreshTasks() error
|
|
IsStateDirty() bool
|
|
IsDirty() bool
|
|
Terminate(chasm.TerminateComponentRequest) error
|
|
Archetype() (chasm.Archetype, error)
|
|
ArchetypeID() chasm.ArchetypeID
|
|
EachPureTask(
|
|
deadline time.Time,
|
|
callback func(executor chasm.NodePureTask, taskAttributes chasm.TaskAttributes, task any) (bool, error),
|
|
) error
|
|
ExecuteSideEffectTask(
|
|
ctx context.Context,
|
|
executionKey chasm.ExecutionKey,
|
|
task *tasks.ChasmTask,
|
|
validate func(chasm.NodeBackend, chasm.Context, chasm.Component) error,
|
|
) error
|
|
ExecuteSideEffectDiscardTask(
|
|
ctx context.Context,
|
|
executionKey chasm.ExecutionKey,
|
|
task *tasks.ChasmTask,
|
|
validate func(chasm.NodeBackend, chasm.Context, chasm.Component) error,
|
|
) error
|
|
ValidateSideEffectTask(
|
|
ctx context.Context,
|
|
task *tasks.ChasmTask,
|
|
) (isTaskInTree bool, isValidByComponent bool, err error)
|
|
IsStale(chasm.ComponentRef) error
|
|
Component(chasm.Context, chasm.ComponentRef) (chasm.Component, error)
|
|
ComponentByPath(chasm.Context, []string) (chasm.Component, error)
|
|
}
|