mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
Remove 1 day retention for standalone activities (#9645)
## What changed? Remove 1 day retention for standalone activities ## Why? No longer needed as we have tiered storage in place now ## How did you test it? - [X] built - [X] run locally and tested manually - [X] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
This commit is contained in:
@@ -6,6 +6,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
WorkflowArchetype = Archetype(FullyQualifiedName(WorkflowLibraryName, WorkflowComponentName))
|
||||
WorkflowArchetypeID = ArchetypeID(GenerateTypeID(WorkflowArchetype))
|
||||
WorkflowArchetype = FullyQualifiedName(WorkflowLibraryName, WorkflowComponentName)
|
||||
WorkflowArchetypeID = GenerateTypeID(WorkflowArchetype)
|
||||
)
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
historyspb "go.temporal.io/server/api/history/v1"
|
||||
persistencespb "go.temporal.io/server/api/persistence/v1"
|
||||
"go.temporal.io/server/chasm"
|
||||
"go.temporal.io/server/chasm/lib/activity"
|
||||
"go.temporal.io/server/common"
|
||||
"go.temporal.io/server/common/archiver"
|
||||
"go.temporal.io/server/common/backoff"
|
||||
@@ -276,11 +275,6 @@ func (r *TaskGeneratorImpl) GenerateWorkflowCloseTasks(
|
||||
// This method returns an error when the GetNamespaceByID call fails with anything other than
|
||||
// serviceerror.NamespaceNotFound.
|
||||
func (r *TaskGeneratorImpl) getRetention() (time.Duration, error) {
|
||||
// For standalone activities, use 1 day retention
|
||||
if r.mutableState.ChasmTree().ArchetypeID() == activity.ArchetypeID {
|
||||
return 24 * time.Hour, nil
|
||||
}
|
||||
|
||||
retention := defaultWorkflowRetention
|
||||
executionInfo := r.mutableState.GetExecutionInfo()
|
||||
namespaceEntry, err := r.namespaceRegistry.GetNamespaceByID(namespace.ID(executionInfo.NamespaceId))
|
||||
|
||||
@@ -920,7 +920,7 @@ func TestTaskGeneratorImpl_GenerateDirtySubStateMachineTasks_TrimsTimersForDelet
|
||||
require.Empty(t, ms.GetExecutionInfo().StateMachineTimers) // Timer should be trimmed
|
||||
}
|
||||
|
||||
func TestTaskGeneratorImpl_GenerateDeleteHistoryEventTask_ActivityRetention(t *testing.T) {
|
||||
func TestTaskGeneratorImpl_GenerateDeleteHistoryEventTask_ChasmComponentRetention(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
@@ -930,25 +930,36 @@ func TestTaskGeneratorImpl_GenerateDeleteHistoryEventTask_ActivityRetention(t *t
|
||||
testCases := []struct {
|
||||
name string
|
||||
archetypeID chasm.ArchetypeID
|
||||
namespaceRetention time.Duration
|
||||
expectedMinRetention time.Duration
|
||||
expectedMaxRetention time.Duration
|
||||
setupNamespaceRegistry func(*namespace.MockRegistry)
|
||||
}{
|
||||
{
|
||||
name: "standalone activity uses 1 day retention",
|
||||
name: "standalone activity uses namespace retention",
|
||||
archetypeID: activity.ArchetypeID,
|
||||
namespaceRetention: 90 * 24 * time.Hour, // 90 days namespace retention
|
||||
expectedMinRetention: 24 * time.Hour, // Activity should use 1 day
|
||||
expectedMaxRetention: 24*time.Hour + retentionJitterDuration*2,
|
||||
expectedMinRetention: 90 * 24 * time.Hour,
|
||||
expectedMaxRetention: 90*24*time.Hour + retentionJitterDuration*2,
|
||||
setupNamespaceRegistry: func(nr *namespace.MockRegistry) {
|
||||
// Namespace registry should not be called for activities
|
||||
namespaceConfig := &persistencespb.NamespaceConfig{
|
||||
Retention: durationpb.New(90 * 24 * time.Hour),
|
||||
}
|
||||
namespaceEntry := namespace.NewGlobalNamespaceForTest(
|
||||
&persistencespb.NamespaceInfo{Id: tests.NamespaceID.String(), Name: tests.Namespace.String()},
|
||||
namespaceConfig,
|
||||
&persistencespb.NamespaceReplicationConfig{
|
||||
ActiveClusterName: cluster.TestCurrentClusterName,
|
||||
Clusters: []string{
|
||||
cluster.TestCurrentClusterName,
|
||||
},
|
||||
},
|
||||
tests.Version,
|
||||
)
|
||||
nr.EXPECT().GetNamespaceByID(namespaceEntry.ID()).Return(namespaceEntry, nil).AnyTimes()
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "workflow uses namespace retention",
|
||||
archetypeID: chasm.WorkflowArchetypeID,
|
||||
namespaceRetention: 7 * 24 * time.Hour, // 7 days namespace retention
|
||||
expectedMinRetention: 7 * 24 * time.Hour,
|
||||
expectedMaxRetention: 7*24*time.Hour + retentionJitterDuration*2,
|
||||
setupNamespaceRegistry: func(nr *namespace.MockRegistry) {
|
||||
@@ -972,7 +983,6 @@ func TestTaskGeneratorImpl_GenerateDeleteHistoryEventTask_ActivityRetention(t *t
|
||||
{
|
||||
name: "scheduler uses namespace retention",
|
||||
archetypeID: chasm.SchedulerArchetypeID,
|
||||
namespaceRetention: 30 * 24 * time.Hour, // 30 days namespace retention
|
||||
expectedMinRetention: 30 * 24 * time.Hour,
|
||||
expectedMaxRetention: 30*24*time.Hour + retentionJitterDuration*2,
|
||||
setupNamespaceRegistry: func(nr *namespace.MockRegistry) {
|
||||
|
||||
Reference in New Issue
Block a user