-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x
- Loading branch information
Showing
47 changed files
with
1,277 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
dbm-services/mysql/db-tools/mysql-dbbackup/pkg/src/precheck/check_backup_type.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package precheck | ||
|
||
import ( | ||
"dbm-services/mysql/db-tools/mysql-dbbackup/pkg/config" | ||
"dbm-services/mysql/db-tools/mysql-dbbackup/pkg/cst" | ||
"dbm-services/mysql/db-tools/mysql-dbbackup/pkg/src/logger" | ||
"dbm-services/mysql/db-tools/mysql-dbbackup/pkg/util" | ||
) | ||
|
||
// CheckBackupType check and fix backup type | ||
func CheckBackupType(cnf *config.BackupConfig, storageEngine string) error { | ||
backupSize, err := util.CalServerDataSize(cnf.Public.MysqlPort) | ||
if err != nil { | ||
return err | ||
} | ||
if cnf.Public.BackupType == cst.BackupTypeAuto { | ||
if storageEngine == cst.StorageEngineTokudb || storageEngine == cst.StorageEngineRocksdb { | ||
logger.Log.Infof("BackupType auto with engine=%s, use physical", storageEngine) | ||
cnf.Public.BackupType = cst.BackupPhysical | ||
return nil | ||
} | ||
// report 时需要用真实的 backup type | ||
if backupSize > cst.BackupTypeAutoDataSizeGB*1024*1024*1024 { | ||
logger.Log.Infof("data size %d for port %d is larger than %d GB, use physical", | ||
backupSize, cnf.Public.MysqlPort, cst.BackupTypeAutoDataSizeGB) | ||
cnf.Public.BackupType = cst.BackupPhysical | ||
} else { | ||
cnf.Public.BackupType = cst.BackupLogical | ||
} | ||
if glibcVer, err := util.GetGlibcVersion(); err != nil { | ||
logger.Log.Warn("failed to glibc version, err:", err) | ||
} else if glibcVer < "2.14" { | ||
// mydumper need glibc version >= 2.14 | ||
logger.Log.Infof("BackupType auto with glibc version %s < 2.14, use physical", glibcVer) | ||
cnf.Public.BackupType = cst.BackupPhysical | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.