-
Notifications
You must be signed in to change notification settings - Fork 2
Description
In:
Line 16 in 7225b1c
| uniqueKey string |
Line 106 in 7225b1c
| this.uniqueKey = fName |
Does this imply you're limiting to a single UNIQUE key for a table?
I'd advise against using DESC / SHOW COLUMNS output, and instead go deep into INFORMATION_SCHEMA.
In:
Lines 104 to 106 in 7225b1c
| query := fmt.Sprintf("SELECT TABLE_SCHEMA, TABLE_NAME "+ | |
| "FROM information_schema.TABLES WHERE TABLE_SCHEMA IN('%s') AND TABLE_TYPE ='BASE TABLE' AND "+ | |
| "NOT (TABLE_SCHEMA = 'mysql' AND TABLE_NAME NOT IN ( 'slow_log' , 'general_log'))", strings.Join(databases, "','")) |
Don't use "something" + " something " + " something"
Instead, use backticks for multi line strings.
A session can only lock multiple tables in a single statement. Multiple statements won't work:
go-dump/go/utils/taskmanager.go
Line 88 in 7225b1c
| if err := task.Table.Lock(this.DB); err != nil { |
https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html
A session that requires locks must acquire all the locks that it needs in a single LOCK TABLES statement.
go-dump/go/utils/taskmanager.go
Line 136 in 7225b1c
| if len(cols) == 5 { |
try an avoid assumptions like this. Maybe tomorrow, or in MariaDB, or in PerconaServer, there will be 6 columns.
go-dump/go/utils/taskmanager.go
Line 204 in 7225b1c
| if lockTables == true { |
if lockTables {
go-dump/go/cmd/go-dump/main.go
Line 43 in 7225b1c
| func GetMySQLConnection(host *MySQLHost, credentials *MySQLCredentials) (*sql.DB, error) { |
avoid having such function in the main file. Move this to some utils.