Skip to content

Commit

Permalink
fix(dbm-services): dump schema ignore gtid #8355
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq authored and iSecloud committed Dec 2, 2024
1 parent 60b5c9a commit 40b115f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,20 @@ func (c *SemanticDumpSchemaComp) Init() (err error) {
logger.Error("获取version failed %s", err.Error())
return err
}
if cmutil.MySQLVersionParse(version) > cmutil.MySQLVersionParse("5.6.9") {
c.gtidPurgedOff = true
enableGtid, err := conn.IsEnableGtid()
if err != nil {
logger.Warn("获取gtid模式失败 %s", err.Error())
enableGtid = true
}
c.gtidPurgedOff = enableGtid

c.isSpider = strings.Contains(version, "tdbctl")
// 临时方案
if cmutil.FileExists("/home/mysql/dbbackup/mysqldump_x86_64") {
c.dumpCmd = path.Join(cst.MysqldInstallPath, "bin", "mysqldump")
if c.gtidPurgedOff {
c.useTmysqldump = false
} else if cmutil.FileExists("/home/mysql/dbbackup/mysqldump_x86_64") {
c.dumpCmd = "/home/mysql/dbbackup/mysqldump_x86_64"
c.useTmysqldump = true
} else {
c.dumpCmd = path.Join(cst.MysqldInstallPath, "bin", "mysqldump")
}
// to export the table structure from the central control
// you need to use the mysqldump that comes with the central control
Expand Down
10 changes: 10 additions & 0 deletions dbm-services/mysql/db-tools/dbactuator/pkg/native/dbworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ func (h *DbWorker) SelectVersion() (version string, err error) {
return
}

// IsEnableGtid just enable gtid
func (h *DbWorker) IsEnableGtid() (enables bool, err error) {
val, err := h.GetSingleGlobalVar("gtid_mode")
if err != nil {
return false, err
}
return strings.ToUpper(strings.TrimSpace(val)) == "ON", err
}

// HasTokudb 判断是否安装tokudb引擎
func (h *DbWorker) HasTokudb() (has bool, err error) {
var engine string
Expand Down Expand Up @@ -598,6 +607,7 @@ type TableColumnDef struct {
ColType string
}

// TableColumnInfo TODO
type TableColumnInfo map[string]TableColumnDef

// TableSchema TODO
Expand Down

0 comments on commit 40b115f

Please sign in to comment.