diff --git a/common/namespace/attrValidator.go b/common/namespace/attrValidator.go index d6638260168..316b48a62cc 100644 --- a/common/namespace/attrValidator.go +++ b/common/namespace/attrValidator.go @@ -118,32 +118,6 @@ func (d *AttrValidatorImpl) validateNamespaceReplicationConfigForGlobalNamespace return nil } -func (d *AttrValidatorImpl) validateNamespaceReplicationConfigClustersDoesNotRemove( - clustersOld []string, - clustersNew []string, -) error { - - clusterNamesOld := make(map[string]bool) - for _, clusterName := range clustersOld { - clusterNamesOld[clusterName] = true - } - clusterNamesNew := make(map[string]bool) - for _, clusterName := range clustersNew { - clusterNamesNew[clusterName] = true - } - - if len(clusterNamesNew) < len(clusterNamesOld) { - return errCannotRemoveClustersFromNamespace - } - - for clusterName := range clusterNamesOld { - if _, ok := clusterNamesNew[clusterName]; !ok { - return errCannotRemoveClustersFromNamespace - } - } - return nil -} - func (d *AttrValidatorImpl) validateClusterName( clusterName string, ) error { diff --git a/common/namespace/attrValidator_test.go b/common/namespace/attrValidator_test.go index b22e8a8a1cf..76ab43686f8 100644 --- a/common/namespace/attrValidator_test.go +++ b/common/namespace/attrValidator_test.go @@ -184,49 +184,3 @@ func (s *attrValidatorSuite) TestValidateNamespaceReplicationConfigForGlobalName ) s.NoError(err) } - -func (s *attrValidatorSuite) TestValidateNamespaceReplicationConfigClustersDoesNotRemove() { - err := s.validator.validateNamespaceReplicationConfigClustersDoesNotRemove( - []string{ - cluster.TestCurrentClusterName, - cluster.TestAlternativeClusterName, - }, - []string{ - cluster.TestCurrentClusterName, - cluster.TestAlternativeClusterName, - }, - ) - s.NoError(err) - - err = s.validator.validateNamespaceReplicationConfigClustersDoesNotRemove( - []string{ - cluster.TestCurrentClusterName, - }, - []string{ - cluster.TestCurrentClusterName, - cluster.TestAlternativeClusterName, - }, - ) - s.NoError(err) - - err = s.validator.validateNamespaceReplicationConfigClustersDoesNotRemove( - []string{ - cluster.TestCurrentClusterName, - cluster.TestAlternativeClusterName, - }, - []string{ - cluster.TestAlternativeClusterName, - }, - ) - s.IsType(&serviceerror.InvalidArgument{}, err) - - err = s.validator.validateNamespaceReplicationConfigClustersDoesNotRemove( - []string{ - cluster.TestCurrentClusterName, - }, - []string{ - cluster.TestAlternativeClusterName, - }, - ) - s.IsType(&serviceerror.InvalidArgument{}, err) -} diff --git a/common/namespace/handler.go b/common/namespace/handler.go index 1cf7d30ab20..696e64b5edc 100644 --- a/common/namespace/handler.go +++ b/common/namespace/handler.go @@ -501,13 +501,6 @@ func (d *HandlerImpl) UpdateNamespace( for _, clusterConfig := range updateReplicationConfig.Clusters { clustersNew = append(clustersNew, clusterConfig.GetClusterName()) } - - if err := d.namespaceAttrValidator.validateNamespaceReplicationConfigClustersDoesNotRemove( - replicationConfig.Clusters, - clustersNew, - ); err != nil { - return nil, err - } replicationConfig.Clusters = clustersNew } if updateReplicationConfig.State != enumspb.REPLICATION_STATE_UNSPECIFIED &&