diff --git a/common/persistence/persistence-tests/metadataPersistenceV2Test.go b/common/persistence/persistence-tests/metadataPersistenceV2Test.go index 7644e6b053a..43d2442cf88 100644 --- a/common/persistence/persistence-tests/metadataPersistenceV2Test.go +++ b/common/persistence/persistence-tests/metadataPersistenceV2Test.go @@ -68,7 +68,7 @@ func (m *MetadataPersistenceSuiteV2) SetupTest() { ListLoop: for { resp, err := m.ListDomains(pageSize, token) - m.Nil(err) + m.NoError(err) token = resp.NextPageToken for _, domain := range resp.Domains { m.DeleteDomain(domain.Info.ID, "") @@ -120,14 +120,14 @@ func (m *MetadataPersistenceSuiteV2) TestCreateDomain() { configVersion, failoverVersion, ) - m.Nil(err0) + m.NoError(err0) m.NotNil(resp0) m.Equal(id, resp0.ID) // for domain which do not have replication config set, will default to // use current cluster as active, with current cluster as all clusters resp1, err1 := m.GetDomain(id, "") - m.Nil(err1) + m.NoError(err1) m.NotNil(resp1) m.Equal(id, resp1.Info.ID) m.Equal(name, resp1.Info.Name) @@ -163,7 +163,7 @@ func (m *MetadataPersistenceSuiteV2) TestCreateDomain() { configVersion, failoverVersion, ) - m.NotNil(err2) + m.Error(err2) m.IsType(&gen.DomainAlreadyExistsError{}, err2) m.Nil(resp2) } @@ -195,7 +195,7 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { resp0, err0 := m.GetDomain("", "does-not-exist") m.Nil(resp0) - m.NotNil(err0) + m.Error(err0) m.IsType(&gen.EntityNotExistsError{}, err0) resp1, err1 := m.CreateDomain( @@ -219,12 +219,12 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { configVersion, failoverVersion, ) - m.Nil(err1) + m.NoError(err1) m.NotNil(resp1) m.Equal(id, resp1.ID) resp2, err2 := m.GetDomain(id, "") - m.Nil(err2) + m.NoError(err2) m.NotNil(resp2) m.Equal(id, resp2.Info.ID) m.Equal(name, resp2.Info.Name) @@ -245,7 +245,7 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { m.Equal(p.InitialFailoverNotificationVersion, resp2.FailoverNotificationVersion) resp3, err3 := m.GetDomain("", name) - m.Nil(err3) + m.NoError(err3) m.NotNil(resp3) m.Equal(id, resp3.Info.ID) m.Equal(name, resp3.Info.Name) @@ -266,7 +266,7 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { m.Equal(p.InitialFailoverNotificationVersion, resp3.FailoverNotificationVersion) resp4, err4 := m.GetDomain(id, name) - m.NotNil(err4) + m.Error(err4) m.IsType(&gen.BadRequestError{}, err4) m.Nil(resp4) @@ -338,7 +338,7 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentCreateDomain() { m.Equal(int32(1), successCount) resp, err3 := m.GetDomain("", name) - m.Nil(err3) + m.NoError(err3) m.NotNil(resp) m.Equal(name, resp.Info.Name) m.Equal(status, resp.Info.Status) @@ -359,7 +359,7 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentCreateDomain() { ss := strings.Split(resp.Info.Data["k0"], "-") m.Equal(2, len(ss)) vi, err := strconv.Atoi(ss[1]) - m.Nil(err) + m.NoError(err) m.Equal(true, vi > 0 && vi <= concurrency) } @@ -409,13 +409,13 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { configVersion, failoverVersion, ) - m.Nil(err1) + m.NoError(err1) m.Equal(id, resp1.ID) resp2, err2 := m.GetDomain(id, "") - m.Nil(err2) + m.NoError(err2) metadata, err := m.MetadataManagerV2.GetMetadata() - m.Nil(err) + m.NoError(err) notificationVersion := metadata.NotificationVersion concurrency := 16 @@ -457,7 +457,7 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { m.Equal(int32(1), successCount) resp3, err3 := m.GetDomain("", name) - m.Nil(err3) + m.NoError(err3) m.NotNil(resp3) m.Equal(id, resp3.Info.ID) m.Equal(name, resp3.Info.Name) @@ -480,7 +480,7 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { ss := strings.Split(resp3.Info.Data["k0"], "-") m.Equal(2, len(ss)) vi, err := strconv.Atoi(ss[1]) - m.Nil(err) + m.NoError(err) m.Equal(true, vi > 0 && vi <= concurrency) } @@ -530,13 +530,13 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { configVersion, failoverVersion, ) - m.Nil(err1) + m.NoError(err1) m.Equal(id, resp1.ID) resp2, err2 := m.GetDomain(id, "") - m.Nil(err2) + m.NoError(err2) metadata, err := m.MetadataManagerV2.GetMetadata() - m.Nil(err) + m.NoError(err) notificationVersion := metadata.NotificationVersion updatedStatus := p.DomainStatusDeprecated @@ -583,10 +583,10 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { updateFailoverNotificationVersion, notificationVersion, ) - m.Nil(err3) + m.NoError(err3) resp4, err4 := m.GetDomain("", name) - m.Nil(err4) + m.NoError(err4) m.NotNil(resp4) m.Equal(id, resp4.Info.ID) m.Equal(name, resp4.Info.Name) @@ -607,7 +607,7 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { m.Equal(notificationVersion, resp4.NotificationVersion) resp5, err5 := m.GetDomain("", name) - m.Nil(err5) + m.NoError(err5) m.NotNil(resp5) m.Equal(id, resp5.Info.ID) m.Equal(name, resp5.Info.Name) @@ -674,23 +674,23 @@ func (m *MetadataPersistenceSuiteV2) TestDeleteDomain() { configVersion, failoverVersion, ) - m.Nil(err1) + m.NoError(err1) m.Equal(id, resp1.ID) resp2, err2 := m.GetDomain("", name) - m.Nil(err2) + m.NoError(err2) m.NotNil(resp2) err3 := m.DeleteDomain("", name) - m.Nil(err3) + m.NoError(err3) resp4, err4 := m.GetDomain("", name) - m.NotNil(err4) + m.Error(err4) m.IsType(&gen.EntityNotExistsError{}, err4) m.Nil(resp4) resp5, err5 := m.GetDomain(id, "") - m.NotNil(err5) + m.Error(err5) m.IsType(&gen.EntityNotExistsError{}, err5) m.Nil(resp5) @@ -716,19 +716,19 @@ func (m *MetadataPersistenceSuiteV2) TestDeleteDomain() { configVersion, failoverVersion, ) - m.Nil(err6) + m.NoError(err6) m.Equal(id, resp6.ID) err7 := m.DeleteDomain(id, "") - m.Nil(err7) + m.NoError(err7) resp8, err8 := m.GetDomain("", name) - m.NotNil(err8) + m.Error(err8) m.IsType(&gen.EntityNotExistsError{}, err8) m.Nil(resp8) resp9, err9 := m.GetDomain(id, "") - m.NotNil(err9) + m.Error(err9) m.IsType(&gen.EntityNotExistsError{}, err9) m.Nil(resp9) } @@ -810,7 +810,7 @@ func (m *MetadataPersistenceSuiteV2) TestListDomains() { domain.ConfigVersion, domain.FailoverVersion, ) - m.Nil(err) + m.NoError(err) } var token []byte @@ -819,7 +819,7 @@ func (m *MetadataPersistenceSuiteV2) TestListDomains() { ListLoop: for { resp, err := m.ListDomains(pageSize, token) - m.Nil(err) + m.NoError(err) token = resp.NextPageToken for _, domain := range resp.Domains { outputDomains[domain.Info.ID] = domain diff --git a/common/persistence/sql/metadataPersistenceV2_test.go b/common/persistence/sql/metadataPersistenceV2_test.go index 425ad1b761a..3bb3244f609 100644 --- a/common/persistence/sql/metadataPersistenceV2_test.go +++ b/common/persistence/sql/metadataPersistenceV2_test.go @@ -29,7 +29,6 @@ import ( ) func TestMetadataPersistenceSuiteV2(t *testing.T) { - t.Skip("Temporary skipping until SQL persistence is fixed") s := new(persistencetests.MetadataPersistenceSuiteV2) sql.InitTestSuite(&s.TestBase) suite.Run(t, s) diff --git a/common/persistence/sql/metadataPersistence_test.go b/common/persistence/sql/metadataPersistence_test.go deleted file mode 100644 index 5375c607f19..00000000000 --- a/common/persistence/sql/metadataPersistence_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package sql_test - -import ( - "github.com/uber/cadence/common/persistence/sql" - "testing" - - "github.com/stretchr/testify/suite" - "github.com/uber/cadence/common/persistence/persistence-tests" -) - -func TestMetadataPersistenceSuite(t *testing.T) { - t.Skip("Temporary skipping until SQL persistence is fixed") - s := new(persistencetests.MetadataPersistenceSuite) - sql.InitTestSuite(&s.TestBase) - suite.Run(t, s) -} diff --git a/common/persistence/sql/sqlMetadataPersistence.go b/common/persistence/sql/sqlMetadataPersistenceV2.go similarity index 75% rename from common/persistence/sql/sqlMetadataPersistence.go rename to common/persistence/sql/sqlMetadataPersistenceV2.go index 35718cf5df7..b38bcdd5f2f 100644 --- a/common/persistence/sql/sqlMetadataPersistence.go +++ b/common/persistence/sql/sqlMetadataPersistenceV2.go @@ -23,6 +23,7 @@ package sql import ( "database/sql" "fmt" + "github.com/go-sql-driver/mysql" "github.com/uber-common/bark" workflow "github.com/uber/cadence/.gen/go/shared" @@ -34,8 +35,10 @@ import ( type ( // Implements MetadataManager - sqlMetadataManager struct { - db *sqlx.DB + sqlMetadataManagerV2 struct { + db *sqlx.DB + activeClusterName string + logger bark.Logger } domainCommon struct { @@ -160,12 +163,26 @@ SET notification_version = :notification_version + 1 WHERE notification_version = :notification_version` ) -func (m *sqlMetadataManager) Close() { +func (m *sqlMetadataManagerV2) Close() { if m.db != nil { m.db.Close() } } +// NewMetadataPersistenceV2 creates an instance of sqlMetadataManagerV2 +func NewMetadataPersistenceV2(host string, port int, username, password, dbName string, currentClusterName string, + logger bark.Logger) (persistence.MetadataManager, error) { + var db, err = newConnection(host, port, username, password, dbName) + if err != nil { + return nil, err + } + return &sqlMetadataManagerV2{ + db: db, + activeClusterName: currentClusterName, + logger: logger, + }, nil +} + func updateMetadata(tx *sqlx.Tx, oldNotificationVersion int64) error { result, err := tx.NamedExec(updateMetadataSQLQuery, struct { @@ -201,99 +218,89 @@ func lockMetadata(tx *sqlx.Tx) error { return nil } -func (m *sqlMetadataManager) CreateDomain(request *persistence.CreateDomainRequest) (*persistence.CreateDomainResponse, error) { - // Disallow creating more than one domain with the same name, even if the UUID is different. - resp, err := m.GetDomain(&persistence.GetDomainRequest{Name: request.Info.Name}) - if err == nil { - // The domain already exists. - return nil, &workflow.DomainAlreadyExistsError{ - Message: fmt.Sprintf("Domain already exists. DomainId: %v", resp.Info.ID), +func (m *sqlMetadataManagerV2) CreateDomain(request *persistence.CreateDomainRequest) (*persistence.CreateDomainResponse, error) { + // Encode request.Info.Data + data, err := gobSerialize(request.Info.Data) + if err != nil { + return nil, &workflow.InternalServiceError{ + Message: fmt.Sprintf("CreateDomain operation failed. Failed to encode DomainInfo.Data. Error: %v", err), } } - switch err.(type) { - case *workflow.EntityNotExistsError: - // Domain does not already exist. Create it. - - // Encode request.Info.Data - data, err := gobSerialize(request.Info.Data) - if err != nil { - return nil, &workflow.InternalServiceError{ - Message: fmt.Sprintf("CreateDomain operation failed. Failed to encode DomainInfo.Data. Error: %v", err), - } - } - - // Encode request.ReplicationConfig.Clusters - clusters, err := gobSerialize(persistence.SerializeClusterConfigs(request.ReplicationConfig.Clusters)) - if err != nil { - return nil, &workflow.InternalServiceError{ - Message: fmt.Sprintf("CreateDomain operation failed. Failed to encode ReplicationConfig.Clusters. Error: %v", err), - } + // Encode request.ReplicationConfig.Clusters + clusters, err := gobSerialize(persistence.SerializeClusterConfigs(request.ReplicationConfig.Clusters)) + if err != nil { + return nil, &workflow.InternalServiceError{ + Message: fmt.Sprintf("CreateDomain operation failed. Failed to encode ReplicationConfig.Clusters. Error: %v", err), } + } - metadata, err := m.GetMetadata() - if err != nil { - return nil, err - } + metadata, err := m.GetMetadata() + if err != nil { + return nil, err + } - tx, err := m.db.Beginx() - if err != nil { - return nil, err + tx, err := m.db.Beginx() + if err != nil { + return nil, err + } + commited := false + defer func() { + if !commited { + tx.Rollback() } - defer tx.Rollback() + }() - if _, err := tx.NamedExec(createDomainSQLQuery, &domainRow{ - domainCommon: domainCommon{ - Name: request.Info.Name, - ID: request.Info.ID, - Status: request.Info.Status, - Description: request.Info.Description, - OwnerEmail: request.Info.OwnerEmail, - Data: &data, + if _, err := tx.NamedExec(createDomainSQLQuery, &domainRow{ + domainCommon: domainCommon{ + Name: request.Info.Name, + ID: request.Info.ID, + Status: request.Info.Status, + Description: request.Info.Description, + OwnerEmail: request.Info.OwnerEmail, + Data: &data, - DomainConfig: *(request.Config), + DomainConfig: *(request.Config), - ActiveClusterName: request.ReplicationConfig.ActiveClusterName, - Clusters: &clusters, + ActiveClusterName: request.ReplicationConfig.ActiveClusterName, + Clusters: &clusters, - ConfigVersion: request.ConfigVersion, - FailoverVersion: request.FailoverVersion, - }, + ConfigVersion: request.ConfigVersion, + FailoverVersion: request.FailoverVersion, + }, - NotificationVersion: metadata.NotificationVersion, - FailoverNotificationVersion: persistence.InitialFailoverNotificationVersion, - IsGlobalDomain: request.IsGlobalDomain, - }); err != nil { - return nil, &workflow.InternalServiceError{ - Message: fmt.Sprintf("CreateDomain operation failed. Inserting into domains table. Error: %v", err), + NotificationVersion: metadata.NotificationVersion, + FailoverNotificationVersion: persistence.InitialFailoverNotificationVersion, + IsGlobalDomain: request.IsGlobalDomain, + }); err != nil { + if sqlErr, ok := err.(*mysql.MySQLError); ok && sqlErr.Number == ErrDupEntry { + return nil, &workflow.DomainAlreadyExistsError{ + Message: fmt.Sprintf("name: %v", request.Info.Name), } } - - if err := lockMetadata(tx); err != nil { - return nil, err - } - - if err := updateMetadata(tx, metadata.NotificationVersion); err != nil { - return nil, err + return nil, &workflow.InternalServiceError{ + Message: fmt.Sprintf("CreateDomain operation failed. Inserting into domains table. Error: %v", err), } + } - if err := tx.Commit(); err != nil { - return nil, &workflow.InternalServiceError{ - Message: fmt.Sprintf("CreateDomain operation failed. Committing transaction. Error: %v", err), - } - } + if err := lockMetadata(tx); err != nil { + return nil, err + } - return &persistence.CreateDomainResponse{ID: request.Info.ID}, nil + if err := updateMetadata(tx, metadata.NotificationVersion); err != nil { + return nil, err + } - default: + if err := tx.Commit(); err != nil { return nil, &workflow.InternalServiceError{ - Message: fmt.Sprintf( - "CreateDomain operation failed. Could not check if domain already existed. Error: %v", err), + Message: fmt.Sprintf("CreateDomain operation failed. Committing transaction. Error: %v", err), } } + commited = true + return &persistence.CreateDomainResponse{ID: request.Info.ID}, nil } -func (m *sqlMetadataManager) GetDomain(request *persistence.GetDomainRequest) (*persistence.GetDomainResponse, error) { +func (m *sqlMetadataManagerV2) GetDomain(request *persistence.GetDomainRequest) (*persistence.GetDomainResponse, error) { var err error var stmt *sqlx.NamedStmt @@ -337,7 +344,7 @@ func (m *sqlMetadataManager) GetDomain(request *persistence.GetDomainRequest) (* } } - response, err := domainRowToGetDomainResponse(&result) + response, err := m.domainRowToGetDomainResponse(&result) if err != nil { return nil, err } @@ -345,7 +352,7 @@ func (m *sqlMetadataManager) GetDomain(request *persistence.GetDomainRequest) (* return response, nil } -func domainRowToGetDomainResponse(result *domainRow) (*persistence.GetDomainResponse, error) { +func (m *sqlMetadataManagerV2) domainRowToGetDomainResponse(result *domainRow) (*persistence.GetDomainResponse, error) { var data map[string]string if result.Data != nil { if err := gobDeserialize(*result.Data, &data); err != nil { @@ -375,9 +382,8 @@ func domainRowToGetDomainResponse(result *domainRow) (*persistence.GetDomainResp }, Config: &result.DomainConfig, ReplicationConfig: &persistence.DomainReplicationConfig{ - ActiveClusterName: persistence.GetOrUseDefaultActiveCluster("active", - result.ActiveClusterName), // TODO TO BE IMPLEMENTED (get rid of "active" placeholder) - Clusters: persistence.GetOrUseDefaultClusters("active", persistence.DeserializeClusterConfigs(clusters)), // TODO same + ActiveClusterName: persistence.GetOrUseDefaultActiveCluster(m.activeClusterName, result.ActiveClusterName), + Clusters: persistence.GetOrUseDefaultClusters(m.activeClusterName, persistence.DeserializeClusterConfigs(clusters)), }, IsGlobalDomain: result.IsGlobalDomain, FailoverVersion: result.FailoverVersion, @@ -387,7 +393,7 @@ func domainRowToGetDomainResponse(result *domainRow) (*persistence.GetDomainResp }, nil } -func (m *sqlMetadataManager) UpdateDomain(request *persistence.UpdateDomainRequest) error { +func (m *sqlMetadataManagerV2) UpdateDomain(request *persistence.UpdateDomainRequest) error { clusters, err := gobSerialize(persistence.SerializeClusterConfigs(request.ReplicationConfig.Clusters)) if err != nil { return &workflow.InternalServiceError{ @@ -464,7 +470,7 @@ func (m *sqlMetadataManager) UpdateDomain(request *persistence.UpdateDomainReque // TODO Find a way to get rid of code repetition without using a type switch -func (m *sqlMetadataManager) DeleteDomain(request *persistence.DeleteDomainRequest) error { +func (m *sqlMetadataManagerV2) DeleteDomain(request *persistence.DeleteDomainRequest) error { tx, err := m.db.Beginx() if err != nil { return &workflow.InternalServiceError{ @@ -488,7 +494,7 @@ func (m *sqlMetadataManager) DeleteDomain(request *persistence.DeleteDomainReque return nil } -func (m *sqlMetadataManager) DeleteDomainByName(request *persistence.DeleteDomainByNameRequest) error { +func (m *sqlMetadataManagerV2) DeleteDomainByName(request *persistence.DeleteDomainByNameRequest) error { tx, err := m.db.Beginx() if err != nil { return &workflow.InternalServiceError{ @@ -512,7 +518,7 @@ func (m *sqlMetadataManager) DeleteDomainByName(request *persistence.DeleteDomai return nil } -func (m *sqlMetadataManager) GetMetadata() (*persistence.GetMetadataResponse, error) { +func (m *sqlMetadataManagerV2) GetMetadata() (*persistence.GetMetadataResponse, error) { var notificationVersion int64 row := m.db.QueryRow(getMetadataSQLQuery) if err := row.Scan(¬ificationVersion); err != nil { @@ -524,18 +530,7 @@ func (m *sqlMetadataManager) GetMetadata() (*persistence.GetMetadataResponse, er return &persistence.GetMetadataResponse{NotificationVersion: notificationVersion}, nil } -// NewMetadataPersistence creates an instance of sqlMetadataManager -func NewMetadataPersistence(host string, port int, username, password, dbName string, logger bark.Logger) (persistence.MetadataManager, error) { - var db, err = newConnection(host, port, username, password, dbName) - if err != nil { - return nil, err - } - return &sqlMetadataManager{ - db: db, - }, nil -} - -func (m *sqlMetadataManager) ListDomains(request *persistence.ListDomainsRequest) (*persistence.ListDomainsResponse, error) { +func (m *sqlMetadataManagerV2) ListDomains(request *persistence.ListDomainsRequest) (*persistence.ListDomainsResponse, error) { rows, err := m.db.Queryx(listDomainsSQLQuery) if err != nil { return nil, &workflow.InternalServiceError{ @@ -553,7 +548,7 @@ func (m *sqlMetadataManager) ListDomains(request *persistence.ListDomainsRequest } } - resp, err := domainRowToGetDomainResponse(&row) + resp, err := m.domainRowToGetDomainResponse(&row) if err != nil { return nil, err } diff --git a/common/persistence/sql/sqlPersistenceTest.go b/common/persistence/sql/sqlPersistenceTest.go index e54615530ef..8f8e419ff6c 100644 --- a/common/persistence/sql/sqlPersistenceTest.go +++ b/common/persistence/sql/sqlPersistenceTest.go @@ -116,22 +116,13 @@ func InitTestSuiteWithMetadata(tb *persistencetests.TestBase, options *persisten if err != nil { log.Fatal(err) } - tb.MetadataManager, err = NewMetadataPersistence(options.DBHost, options.DBPort, options.DBUser, - options.DBPassword, databaseName, log) + tb.MetadataManager, err = NewMetadataPersistenceV2(options.DBHost, options.DBPort, options.DBUser, + options.DBPassword, databaseName, currentClusterName, log) if err != nil { log.Fatal(err) } - // TODO: V2 for sql - //tb.MetadataManagerV2, err = NewMetadataPersistenceV2(options.DBHost, options.DBPort, options.DBUser, - // options.DBPassword, databaseName, log) - //if err != nil { - // log.Fatal(err) - //} - //tb.MetadataProxy, err = NewMetadataManagerProxy(options.DBHost, options.DBPort, options.DBUser, - // options.DBPassword, options.Datacenter, databaseName, currentClusterName, log) - //if err != nil { - // log.Fatal(err) - //} + tb.MetadataProxy = tb.MetadataManager + tb.MetadataManagerV2 = tb.MetadataManager //tb.VisibilityMgr, err = NewVisibilityPersistence(options.DBHost, options.DBPort, // options.DBUser, options.DBPassword, options.Datacenter, databaseName, log) //if err != nil {