From 9a155f7e0e252940a624827ae38bce1ec119d4be Mon Sep 17 00:00:00 2001 From: yuanruji Date: Wed, 18 Sep 2024 12:15:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(dbm-services):=20=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E6=97=A7=E7=B3=BB=E7=BB=9F=E5=BA=93db=5Finfobase=20#6966?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbactuator/pkg/components/computil/mysql_operate.go | 2 ++ .../pkg/components/mysql/semantic_dump_schema.go | 7 ++++++- dbm-services/mysql/db-tools/dbactuator/pkg/native/types.go | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dbm-services/mysql/db-tools/dbactuator/pkg/components/computil/mysql_operate.go b/dbm-services/mysql/db-tools/dbactuator/pkg/components/computil/mysql_operate.go index c6bbe4daa2..a5f7872ceb 100644 --- a/dbm-services/mysql/db-tools/dbactuator/pkg/components/computil/mysql_operate.go +++ b/dbm-services/mysql/db-tools/dbactuator/pkg/components/computil/mysql_operate.go @@ -350,6 +350,7 @@ func GetGcsSystemDatabases(version string) []string { DBs := GetMysqlSystemDatabases(version) DBs = append(DBs, native.INFODBA_SCHEMA) DBs = append(DBs, native.TEST_DB) + DBs = append(DBs, native.OLD_INFO_DBA_SCHEMA) return DBs } @@ -357,5 +358,6 @@ func GetGcsSystemDatabases(version string) []string { func GetGcsSystemDatabasesIgnoreTest(version string) []string { DBs := GetMysqlSystemDatabases(version) DBs = append(DBs, native.INFODBA_SCHEMA) + DBs = append(DBs, native.OLD_INFO_DBA_SCHEMA) return DBs } diff --git a/dbm-services/mysql/db-tools/dbactuator/pkg/components/mysql/semantic_dump_schema.go b/dbm-services/mysql/db-tools/dbactuator/pkg/components/mysql/semantic_dump_schema.go index 27e4c940f5..5171362327 100644 --- a/dbm-services/mysql/db-tools/dbactuator/pkg/components/mysql/semantic_dump_schema.go +++ b/dbm-services/mysql/db-tools/dbactuator/pkg/components/mysql/semantic_dump_schema.go @@ -134,12 +134,17 @@ func (c *SemanticDumpSchemaComp) Init() (err error) { } finaldbs := []string{} reg := regexp.MustCompile(`^bak_cbs`) - for _, db := range util.FilterOutStringSlice(alldbs, computil.GetGcsSystemDatabasesIgnoreTest(version)) { + ignoreDBs := computil.GetGcsSystemDatabasesIgnoreTest(version) + if c.isSpider { + ignoreDBs = computil.GetGcsSystemDatabases(version) + } + for _, db := range util.FilterOutStringSlice(alldbs, ignoreDBs) { if reg.MatchString(db) { continue } finaldbs = append(finaldbs, db) } + if len(finaldbs) == 0 { return fmt.Errorf("变更实例排除系统库后,再也没有可以变更的库") } diff --git a/dbm-services/mysql/db-tools/dbactuator/pkg/native/types.go b/dbm-services/mysql/db-tools/dbactuator/pkg/native/types.go index 68cdeaf07f..71e0239ad5 100644 --- a/dbm-services/mysql/db-tools/dbactuator/pkg/native/types.go +++ b/dbm-services/mysql/db-tools/dbactuator/pkg/native/types.go @@ -21,6 +21,8 @@ const NotRowFound = "not row found" const ( // INFODBA_SCHEMA TODO INFODBA_SCHEMA = "infodba_schema" + // old info_dba_schema old platform db + OLD_INFO_DBA_SCHEMA = "db_infobase" // TEST_DB TODO TEST_DB = "test" // INFO_SCHEMA TODO