Skip to content

Commit 462cc89

Browse files
committed
chore: fix first review
1 parent 9f305b7 commit 462cc89

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

doc/command-line-flags.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ Defaults to 1000 (1 second). Configures the HTTP throttler check timeout in mill
286286

287287
Makes the _old_ table include a timestamp value. The _old_ table is what the original table is renamed to at the end of a successful migration. For example, if the table is `gh_ost_test`, then the _old_ table would normally be `_gh_ost_test_del`. With `--timestamp-old-table` it would be, for example, `_gh_ost_test_20170221103147_del`.
288288

289+
### optimizer-switch
290+
291+
Default is "", this allow to override a `SET GLOBAL optimizer_switch=key=value` by one set on the session with `SET SESSION optimizer_switch=key=value`.
292+
You can find values on https://dev.mysql.com/doc/refman/8.0/en/switchable-optimizations.html for example.
293+
289294
### tungsten
290295

291296
See [`tungsten`](cheatsheet.md#tungsten) on the cheatsheet.

go/logic/applier.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func newDmlBuildResultError(err error) *dmlBuildResult {
4949
}
5050
}
5151

52-
func (this *Applier) setOptimizer(tx *gosql.Tx) error {
52+
func (this *Applier) setOptimizerSwitch(tx *gosql.Tx) error {
5353
if this.migrationContext.OptimizerSwitch == "" {
5454
return nil
5555
}
@@ -486,11 +486,6 @@ func (this *Applier) readMigrationMinValues(tx *gosql.Tx, uniqueKey *sql.UniqueK
486486
return err
487487
}
488488

489-
err = this.setOptimizer(tx)
490-
if err != nil {
491-
return err
492-
}
493-
494489
rows, err := tx.Query(query)
495490
if err != nil {
496491
return err
@@ -516,11 +511,6 @@ func (this *Applier) readMigrationMaxValues(tx *gosql.Tx, uniqueKey *sql.UniqueK
516511
return err
517512
}
518513

519-
err = this.setOptimizer(tx)
520-
if err != nil {
521-
return err
522-
}
523-
524514
rows, err := tx.Query(query)
525515
if err != nil {
526516
return err
@@ -566,6 +556,11 @@ func (this *Applier) ReadMigrationRangeValues() error {
566556
}
567557
defer tx.Rollback()
568558

559+
err = this.setOptimizerSwitch(tx)
560+
if err != nil {
561+
return err
562+
}
563+
569564
if err := this.readMigrationMinValues(tx, this.migrationContext.UniqueKey); err != nil {
570565
return err
571566
}

0 commit comments

Comments
 (0)