diff --git a/common/domain/handler.go b/common/domain/handler.go index 1a0c87f4896..98ee220e199 100644 --- a/common/domain/handler.go +++ b/common/domain/handler.go @@ -437,7 +437,6 @@ func (d *handlerImpl) UpdateDomain( isGlobalDomain := getResponse.IsGlobalDomain gracefulFailoverEndTime := getResponse.FailoverEndTime currentActiveCluster := replicationConfig.ActiveClusterName - currentActiveClusters := replicationConfig.ActiveClusters.DeepCopy() previousFailoverVersion := getResponse.PreviousFailoverVersion lastUpdatedTime := time.Unix(0, getResponse.LastUpdatedTime) @@ -598,17 +597,7 @@ func (d *handlerImpl) UpdateDomain( tag.Dynamic("failover-type", failoverType), ) - err = updateFailoverHistory(info, d.config, NewFailoverEvent( - now, - failoverType, - ¤tActiveCluster, - updateRequest.ActiveClusterName, - nil, - replicationConfig.ActiveClusters, - )) - if err != nil { - d.logger.Warn("failed to update failover history", tag.Error(err)) - } + // todo (active-active): update failover history } // case 3. active-active domain's ActiveClusters is changed @@ -628,17 +617,7 @@ func (d *handlerImpl) UpdateDomain( tag.Dynamic("failover-type", failoverType), ) - err = updateFailoverHistory(info, d.config, NewFailoverEvent( - now, - failoverType, - ¤tActiveCluster, - updateRequest.ActiveClusterName, - currentActiveClusters, - replicationConfig.ActiveClusters, - )) - if err != nil { - d.logger.Warn("failed to update failover history", tag.Error(err)) - } + // todo (active-active): update failover history } failoverNotificationVersion = notificationVersion @@ -722,7 +701,6 @@ func (d *handlerImpl) FailoverDomain( isGlobalDomain := getResponse.IsGlobalDomain gracefulFailoverEndTime := getResponse.FailoverEndTime currentActiveCluster := replicationConfig.ActiveClusterName - currentActiveClusters := replicationConfig.ActiveClusters.DeepCopy() previousFailoverVersion := getResponse.PreviousFailoverVersion lastUpdatedTime := time.Unix(0, getResponse.LastUpdatedTime) @@ -832,18 +810,7 @@ func (d *handlerImpl) FailoverDomain( tag.Dynamic("failover-version", failoverVersion), tag.Dynamic("failover-type", failoverType), ) - - err = updateFailoverHistory(info, d.config, NewFailoverEvent( - now, - failoverType, - ¤tActiveCluster, - updateRequest.ActiveClusterName, - nil, - replicationConfig.ActiveClusters, - )) - if err != nil { - d.logger.Warn("failed to update failover history", tag.Error(err)) - } + // todo (active-active): update failover history } // case 3. active-active domain's ActiveClusters is changed @@ -861,18 +828,7 @@ func (d *handlerImpl) FailoverDomain( tag.Dynamic("failover-version", failoverVersion), tag.Dynamic("failover-type", failoverType), ) - - err = updateFailoverHistory(info, d.config, NewFailoverEvent( - now, - failoverType, - ¤tActiveCluster, - nil, - currentActiveClusters, - replicationConfig.ActiveClusters, - )) - if err != nil { - d.logger.Warn("failed to update failover history", tag.Error(err)) - } + // todo (active-active): update failover history } failoverNotificationVersion = notificationVersion diff --git a/common/domain/handler_test.go b/common/domain/handler_test.go index c7be81132ad..69116830559 100644 --- a/common/domain/handler_test.go +++ b/common/domain/handler_test.go @@ -1808,43 +1808,7 @@ func TestHandler_UpdateDomain(t *testing.T) { }, }, response: func(timeSource clock.MockedTimeSource) *types.UpdateDomainResponse { - data, _ := json.Marshal([]FailoverEvent{{ - EventTime: timeSource.Now(), - FromCluster: cluster.TestCurrentClusterName, - FailoverType: commonconstants.FailoverType(commonconstants.FailoverTypeForce).String(), - FromActiveClusters: types.ActiveClusters{ - AttributeScopes: map[string]types.ClusterAttributeScope{ - "region": { - ClusterAttributes: map[string]types.ActiveClusterInfo{ - cluster.TestRegion1: { - ActiveClusterName: cluster.TestCurrentClusterName, - FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion, - }, - cluster.TestRegion2: { - ActiveClusterName: cluster.TestAlternativeClusterName, - FailoverVersion: cluster.TestAlternativeClusterInitialFailoverVersion, - }, - }, - }, - }, - }, - ToActiveClusters: types.ActiveClusters{ - AttributeScopes: map[string]types.ClusterAttributeScope{ - "region": { - ClusterAttributes: map[string]types.ActiveClusterInfo{ - cluster.TestRegion1: { - ActiveClusterName: cluster.TestCurrentClusterName, - FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion, - }, - cluster.TestRegion2: { - ActiveClusterName: cluster.TestCurrentClusterName, - FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion + cluster.TestFailoverVersionIncrement, - }, - }, - }, - }, - }, - }}) + // Note: failover history is NOT updated for active-active domain changes (case 3) return &types.UpdateDomainResponse{ IsGlobalDomain: true, FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion + cluster.TestFailoverVersionIncrement, @@ -1852,7 +1816,7 @@ func TestHandler_UpdateDomain(t *testing.T) { Name: constants.TestDomainName, UUID: constants.TestDomainID, Status: common.Ptr(types.DomainStatusRegistered), - Data: map[string]string{commonconstants.DomainDataKeyForFailoverHistory: string(data)}, + Data: nil, // no failover history for active-active domain changes }, Configuration: &types.DomainConfiguration{ WorkflowExecutionRetentionPeriodInDays: 1, @@ -1996,28 +1960,7 @@ func TestHandler_UpdateDomain(t *testing.T) { }, }, response: func(timeSource clock.MockedTimeSource) *types.UpdateDomainResponse { - data, _ := json.Marshal([]FailoverEvent{{ - EventTime: timeSource.Now(), - FailoverType: commonconstants.FailoverType(commonconstants.FailoverTypeForce).String(), - FromCluster: cluster.TestCurrentClusterName, - ToActiveClusters: types.ActiveClusters{ - AttributeScopes: map[string]types.ClusterAttributeScope{ - "region": { - ClusterAttributes: map[string]types.ActiveClusterInfo{ - cluster.TestRegion1: { - ActiveClusterName: cluster.TestCurrentClusterName, - FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion, - }, - cluster.TestRegion2: { - ActiveClusterName: cluster.TestAlternativeClusterName, - FailoverVersion: cluster.TestAlternativeClusterInitialFailoverVersion, - }, - }, - }, - }, - }, - }}) - + // Note: failover history is NOT updated for active-passive to active-active migration (case 2) return &types.UpdateDomainResponse{ IsGlobalDomain: true, FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion + 3*cluster.TestFailoverVersionIncrement, @@ -2025,7 +1968,7 @@ func TestHandler_UpdateDomain(t *testing.T) { Name: constants.TestDomainName, UUID: constants.TestDomainID, Status: common.Ptr(types.DomainStatusRegistered), - Data: map[string]string{commonconstants.DomainDataKeyForFailoverHistory: string(data)}, + Data: nil, // no failover history for active-passive to active-active migration }, Configuration: &types.DomainConfiguration{ WorkflowExecutionRetentionPeriodInDays: 1,