From 93d5e20f4b57ad48e95b4b9c8b3c5857486be5e5 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Sun, 24 Feb 2019 08:06:14 +0200 Subject: [PATCH] removed legacy code --- go/logic/applier.go | 57 --------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/go/logic/applier.go b/go/logic/applier.go index baf7c40..f36cda4 100644 --- a/go/logic/applier.go +++ b/go/logic/applier.go @@ -1000,63 +1000,6 @@ func (this *Applier) buildDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) (result return append(results, newDmlBuildResultError(fmt.Errorf("Unknown dml event type: %+v", dmlEvent.DML))) } -// ApplyDMLEventQuery writes an entry to the ghost table, in response to an intercepted -// original-table binlog event -func (this *Applier) ApplyDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) error { - for _, buildResult := range this.buildDMLEventQuery(dmlEvent) { - if buildResult.err != nil { - return buildResult.err - } - // TODO The below is in preparation for transactional writes on the ghost tables. - // Such writes would be, for example: - // - prepended with sql_mode setup - // - prepended with time zone setup - // - prepended with SET SQL_LOG_BIN=0 - // - prepended with SET FK_CHECKS=0 - // etc. - // - // a known problem: https://github.com/golang/go/issues/9373 -- bitint unsigned values, not supported in database/sql - // is solved by silently converting unsigned bigints to string values. - // - - err := func() error { - tx, err := this.db.Begin() - if err != nil { - return err - } - rollback := func(err error) error { - tx.Rollback() - return err - } - sessionQuery := `SET - SESSION time_zone = '+00:00', - sql_mode = CONCAT(@@session.sql_mode, ',STRICT_ALL_TABLES') - ` - if _, err := tx.Exec(sessionQuery); err != nil { - return rollback(err) - } - if _, err := tx.Exec(buildResult.query, buildResult.args...); err != nil { - return rollback(err) - } - if err := tx.Commit(); err != nil { - return err - } - return nil - }() - - if err != nil { - err = fmt.Errorf("%s; query=%s; args=%+v", err.Error(), buildResult.query, buildResult.args) - return log.Errore(err) - } - // no error - atomic.AddInt64(&this.migrationContext.TotalDMLEventsApplied, 1) - if this.migrationContext.CountTableRows { - atomic.AddInt64(&this.migrationContext.RowsDeltaEstimate, buildResult.rowsDelta) - } - } - return nil -} - // ApplyDMLEventQueries applies multiple DML queries onto the _ghost_ table func (this *Applier) ApplyDMLEventQueries(dmlEvents [](*binlog.BinlogDMLEvent)) error {