extracted parsing of ChangelogState

This commit is contained in:
Shlomi Noach 2016-11-17 15:56:59 +01:00
parent ef874b8551
commit 8d987b5aaf

View File

@ -31,6 +31,10 @@ const (
AllEventsUpToLockProcessed = "AllEventsUpToLockProcessed"
)
func ReadChangelogState(s string) ChangelogState {
return ChangelogState(strings.Split(s, ":")[0])
}
type tableWriteFunc func() error
const (
@ -182,7 +186,7 @@ func (this *Migrator) onChangelogStateEvent(dmlEvent *binlog.BinlogDMLEvent) (er
return nil
}
changelogStateString := dmlEvent.NewColumnValues.StringColumn(3)
changelogState := ChangelogState(strings.Split(changelogStateString, ":")[0])
changelogState := ReadChangelogState(changelogStateString)
log.Infof("Intercepted changelog state %s", changelogState)
switch changelogState {
case GhostTableMigrated: