Skip to content

Commit 6e5db08

Browse files
author
Shlomi Noach
committed
supporting onRowCountComplete hook
1 parent b78c502 commit 6e5db08

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

go/logic/migrator.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,24 @@ func (this *Migrator) countTableRows() (err error) {
379379
log.Debugf("Noop operation; not really counting table rows")
380380
return nil
381381
}
382+
383+
countRowsFunc := func() error {
384+
if err := this.inspector.CountTableRows(); err != nil {
385+
return err
386+
}
387+
if err := this.hooksExecutor.onRowCountComplete(); err != nil {
388+
return err
389+
}
390+
return nil
391+
}
392+
382393
if this.migrationContext.ConcurrentCountTableRows {
383-
go this.inspector.CountTableRows()
384394
log.Infof("As instructed, counting rows in the background; meanwhile I will use an estimated count, and will update it later on")
395+
go countRowsFunc()
385396
// and we ignore errors, because this turns to be a background job
386397
return nil
387398
}
388-
return this.inspector.CountTableRows()
399+
return countRowsFunc()
389400
}
390401

391402
// Migrate executes the complete migration logic. This is *the* major gh-ost function.

0 commit comments

Comments
 (0)