applying IsResurrected flag

This commit is contained in:
Shlomi Noach 2016-12-24 10:07:59 +02:00
parent 6128076485
commit 45b63f6500
2 changed files with 7 additions and 4 deletions

View File

@ -162,7 +162,7 @@ type MigrationContext struct {
UserCommandedUnpostponeFlag int64
CutOverCompleteFlag int64
InCutOverCriticalSectionFlag int64
IsResurrected bool
IsResurrected int64
OriginalTableColumnsOnApplier *sql.ColumnList
OriginalTableColumns *sql.ColumnList

View File

@ -301,6 +301,7 @@ func (this *Migrator) readResurrectedContext() error {
func (this *Migrator) applyResurrectedContext() error {
this.migrationContext.ApplyResurrectedContext(this.resurrectedContext)
atomic.StoreInt64(&this.migrationContext.IsResurrected, 1)
return nil
}
@ -1094,12 +1095,14 @@ func (this *Migrator) executeWriteFuncs() error {
for {
this.throttler.throttle(nil)
// We give higher priority to event processing, then secondary priority to
// rowcopy
// We give higher priority to event processing, then secondary priority to rowcopy
select {
case <-contextDumpTick:
{
if !this.migrationContext.Resurrect || this.migrationContext.IsResurrected {
if !(this.migrationContext.Resurrect && atomic.LoadInt64(&this.migrationContext.IsResurrected) == 0) {
// Not dumping context if we're _in the process of resurrecting_...
// otherwise, we dump the context. Note that this operation works sequentially to any row copy or
// event handling. There is no concurrency issue here.
if jsonString, err := this.migrationContext.ToJSON(); err == nil {
this.applier.WriteChangelog("context", jsonString)
log.Debugf("Context dumped. Applied coordinates: %+v", this.migrationContext.AppliedBinlogCoordinates)