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:
Fred Tzeng
2026-03-24 18:21:06 -07:00
committed by GitHub
parent f71b521118
commit 41f1650908
3 changed files with 21 additions and 17 deletions

View File

@@ -6,6 +6,6 @@ const (
)
var (
WorkflowArchetype = Archetype(FullyQualifiedName(WorkflowLibraryName, WorkflowComponentName))
WorkflowArchetypeID = ArchetypeID(GenerateTypeID(WorkflowArchetype))
WorkflowArchetype = FullyQualifiedName(WorkflowLibraryName, WorkflowComponentName)
WorkflowArchetypeID = GenerateTypeID(WorkflowArchetype)
)

View File

@@ -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))

View File

@@ -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) {