extracted onApplyEventStruct()
This commit is contained in:
parent
8d0faa55e3
commit
645af21d03
@ -1024,30 +1024,15 @@ func (this *Migrator) iterateChunks() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// executeWriteFuncs writes data via applier: both the rowcopy and the events backlog.
|
||||
// This is where the ghost table gets the data. The function fills the data single-threaded.
|
||||
// Both event backlog and rowcopy events are polled; the backlog events have precedence.
|
||||
func (this *Migrator) executeWriteFuncs() error {
|
||||
if this.migrationContext.Noop {
|
||||
log.Debugf("Noop operation; not really executing write funcs")
|
||||
return nil
|
||||
}
|
||||
for {
|
||||
this.throttler.throttle(nil)
|
||||
|
||||
// We give higher priority to event processing, then secondary priority to
|
||||
// rowcopy
|
||||
select {
|
||||
case applyEventStruct := <-this.applyEventsQueue:
|
||||
{
|
||||
if applyEventStruct.writeFunc != nil {
|
||||
if err := this.retryOperation(*applyEventStruct.writeFunc); err != nil {
|
||||
func (this *Migrator) onApplyEventStruct(eventStruct *applyEventStruct) error {
|
||||
if eventStruct.writeFunc != nil {
|
||||
if err := this.retryOperation(*eventStruct.writeFunc); err != nil {
|
||||
return log.Errore(err)
|
||||
}
|
||||
}
|
||||
if applyEventStruct.dmlEvent != nil {
|
||||
if eventStruct.dmlEvent != nil {
|
||||
dmlEvents := [](*binlog.BinlogDMLEvent){}
|
||||
dmlEvents = append(dmlEvents, applyEventStruct.dmlEvent)
|
||||
dmlEvents = append(dmlEvents, eventStruct.dmlEvent)
|
||||
|
||||
availableEvents := len(this.applyEventsQueue)
|
||||
batchSize := int(atomic.LoadInt64(&this.migrationContext.DMLBatchSize))
|
||||
@ -1070,6 +1055,26 @@ func (this *Migrator) executeWriteFuncs() error {
|
||||
return log.Errore(err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// executeWriteFuncs writes data via applier: both the rowcopy and the events backlog.
|
||||
// This is where the ghost table gets the data. The function fills the data single-threaded.
|
||||
// Both event backlog and rowcopy events are polled; the backlog events have precedence.
|
||||
func (this *Migrator) executeWriteFuncs() error {
|
||||
if this.migrationContext.Noop {
|
||||
log.Debugf("Noop operation; not really executing write funcs")
|
||||
return nil
|
||||
}
|
||||
for {
|
||||
this.throttler.throttle(nil)
|
||||
|
||||
// We give higher priority to event processing, then secondary priority to
|
||||
// rowcopy
|
||||
select {
|
||||
case eventStruct := <-this.applyEventsQueue:
|
||||
{
|
||||
this.onApplyEventStruct(eventStruct)
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user