Skip to content

Some review notes #1

@shlomi-noach

Description

@shlomi-noach

In:

uniqueKey string

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:

go-dump/go/utils/utils.go

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:

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.


if len(cols) == 5 {

try an avoid assumptions like this. Maybe tomorrow, or in MariaDB, or in PerconaServer, there will be 6 columns.


if lockTables == true {

  if lockTables {

func GetMySQLConnection(host *MySQLHost, credentials *MySQLCredentials) (*sql.DB, error) {

avoid having such function in the main file. Move this to some utils.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions