Skip to content

Commit

Permalink
fix(mysql): webconsole导出时mysqldump参数问题 #8435
Browse files Browse the repository at this point in the history
  • Loading branch information
xfwduke committed Dec 6, 2024
1 parent 77499c2 commit 49e4c92
Showing 1 changed file with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,40 @@ func (c *DbConsoleDumpComp) Run() (err error) {
dumpOption.GtidPurgedOff = true
}

dumper = mysqlutil.MySQLDumper{
DumpDir: c.backupDir,
Ip: c.Params.Host,
Port: c.Params.Port,
DbBackupUser: c.GeneralParam.RuntimeAccountParam.AdminUser,
DbBackupPwd: c.GeneralParam.RuntimeAccountParam.AdminPwd,
DbNames: c.dbs,
Tables: c.realTables,
IgnoreTables: c.realIgnoreTables,
Where: c.Params.DumpDetail.Where,
DumpCmdFile: c.dumpCmd,
Charset: c.charset,
MySQLDumpOption: dumpOption,
if len(c.realTables) > 0 && len(c.dbs) > 1 {
err := fmt.Errorf("mysqldump only support one database if --tables not empty")
logger.Error(err.Error())
return err
}

if len(c.realTables) > 0 {
dumper = mysqlutil.MySQLDumper{
DumpDir: c.backupDir,
Ip: c.Params.Host,
Port: c.Params.Port,
DbBackupUser: c.GeneralParam.RuntimeAccountParam.AdminUser,
DbBackupPwd: c.GeneralParam.RuntimeAccountParam.AdminPwd,
Tables: append(c.dbs, c.realTables...),
IgnoreTables: c.realIgnoreTables,
Where: c.Params.DumpDetail.Where,
DumpCmdFile: c.dumpCmd,
Charset: c.charset,
MySQLDumpOption: dumpOption,
}
} else {
dumper = mysqlutil.MySQLDumper{
DumpDir: c.backupDir,
Ip: c.Params.Host,
Port: c.Params.Port,
DbBackupUser: c.GeneralParam.RuntimeAccountParam.AdminUser,
DbBackupPwd: c.GeneralParam.RuntimeAccountParam.AdminPwd,
DbNames: c.dbs,
IgnoreTables: c.realIgnoreTables,
Where: c.Params.DumpDetail.Where,
DumpCmdFile: c.dumpCmd,
Charset: c.charset,
MySQLDumpOption: dumpOption,
}
}

for _, db := range c.dbs {
Expand Down

0 comments on commit 49e4c92

Please sign in to comment.