supporting onRowCountComplete hook
This commit is contained in:
parent
b78c50237b
commit
6e5db089c8
@ -379,13 +379,24 @@ func (this *Migrator) countTableRows() (err error) {
|
|||||||
log.Debugf("Noop operation; not really counting table rows")
|
log.Debugf("Noop operation; not really counting table rows")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
countRowsFunc := func() error {
|
||||||
|
if err := this.inspector.CountTableRows(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := this.hooksExecutor.onRowCountComplete(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if this.migrationContext.ConcurrentCountTableRows {
|
if this.migrationContext.ConcurrentCountTableRows {
|
||||||
go this.inspector.CountTableRows()
|
|
||||||
log.Infof("As instructed, counting rows in the background; meanwhile I will use an estimated count, and will update it later on")
|
log.Infof("As instructed, counting rows in the background; meanwhile I will use an estimated count, and will update it later on")
|
||||||
|
go countRowsFunc()
|
||||||
// and we ignore errors, because this turns to be a background job
|
// and we ignore errors, because this turns to be a background job
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return this.inspector.CountTableRows()
|
return countRowsFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate executes the complete migration logic. This is *the* major gh-ost function.
|
// Migrate executes the complete migration logic. This is *the* major gh-ost function.
|
||||||
|
Loading…
Reference in New Issue
Block a user