Skip to content

mysql mssql postgresql 中sql语句不填默认读取所有表中的数据 - #480

Merged
wonderflow merged 5 commits into
qiniu:masterfrom
redHJ:pdr-6049
May 19, 2018
Merged

wonderflow merged 5 commits into
qiniu:masterfrom
redHJ:pdr-6049

Conversation

@redHJ

@redHJ redHJ commented May 14, 2018

Copy link
Copy Markdown
Collaborator

No description provided.

@redHJ

redHJ commented May 15, 2018

Copy link
Copy Markdown
Collaborator Author

@wonderflow

Comment thread reader/sql.go Outdated
cronSchedule, _ = conf.GetStringOr(KeyMysqlCron, "")
execOnStart, _ = conf.GetBoolOr(KeyMysqlExecOnStart, true)
encoder, _ = conf.GetStringOr(KeyEncoding, "")
log.Infof("encoder: %v", encoder)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug信息

@redHJ
redHJ force-pushed the pdr-6049 branch 3 times, most recently from a6dc352 to 603c056 Compare May 18, 2018 13:28
Comment thread reader/sql.go Outdated
return errors.New("SqlReader not support readmode")
}

func getHost(datasource, split string) (host string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个函数纯粹通过split拿到的host不一定是对的,还是不要拿host了,直接通过Database和table记录吧

Comment thread reader/meta.go Outdated
}

// WriteDoneFile 将当前文件写入donefiel中
func (m *Meta) WriteDoneFile(currFile string) (err error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来有一个appendDoneFile了,现在这个是不是重复了?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你要再写一个新的,应该换个名字,比如 WriteSqlDoneFile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

函数里面的参数也应该从curlFile改成 finishedTables

Comment thread reader/meta.go Outdated
}

// 读取当前读取的文件和offset
func (m *Meta) ReadDoneFile() (currFile string, err error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像原来就有这么个函数呀

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你要再写一个新的,应该换个名字,比如 ReadSqlDoneFile

Comment thread reader/sql.go Outdated
cronSchedule, _ = conf.GetStringOr(KeyMysqlCron, "")
execOnStart, _ = conf.GetBoolOr(KeyMysqlExecOnStart, true)
encoder, _ = conf.GetStringOr(KeyEncoding, "")
dataSourceArr := strings.Split(dataSource, "(")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataSource这个信息可以不要,感觉这么拿不稳,或者你用各个Database的driver库里面的解析函数去拿,这样写容易出bug,尤其是下面的split

Comment thread reader/sql.go Outdated
mr.offsets = make([]int64, len(mr.syncSQLs))
}

tableDone, omitMeta := restoreTableDone(mr.meta, tables)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 restoreTableDone 只有在exec里面才需要吗,一开始NewSqlReader的时候是不是要

@redHJ
redHJ force-pushed the pdr-6049 branch 2 times, most recently from 6b8740f to f2e81dc Compare May 18, 2018 17:23
@wonderflow

Copy link
Copy Markdown
Contributor

剩下的问题我来改一下
大体上 LGTM

@wonderflow
wonderflow merged commit 33f29fe into qiniu:master May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants