Skip to content

Commit

Permalink
chore: fix first review
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrinux committed Dec 27, 2022
1 parent 9f305b7 commit 66211ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 6 additions & 0 deletions doc/command-line-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ Defaults to 1000 (1 second). Configures the HTTP throttler check timeout in mill

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`.

### optimizer-switch

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`.
You can find values on https://dev.mysql.com/doc/refman/8.0/en/switchable-optimizations.html.
Example: `--optimizer-switch="prefer_ordering_index=on"`.

### tungsten

See [`tungsten`](cheatsheet.md#tungsten) on the cheatsheet.
17 changes: 6 additions & 11 deletions go/logic/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func newDmlBuildResultError(err error) *dmlBuildResult {
}
}

func (this *Applier) setOptimizer(tx *gosql.Tx) error {
func (this *Applier) setOptimizerSwitch(tx *gosql.Tx) error {
if this.migrationContext.OptimizerSwitch == "" {
return nil
}
Expand Down Expand Up @@ -486,11 +486,6 @@ func (this *Applier) readMigrationMinValues(tx *gosql.Tx, uniqueKey *sql.UniqueK
return err
}

err = this.setOptimizer(tx)
if err != nil {
return err
}

rows, err := tx.Query(query)
if err != nil {
return err
Expand All @@ -516,11 +511,6 @@ func (this *Applier) readMigrationMaxValues(tx *gosql.Tx, uniqueKey *sql.UniqueK
return err
}

err = this.setOptimizer(tx)
if err != nil {
return err
}

rows, err := tx.Query(query)
if err != nil {
return err
Expand Down Expand Up @@ -566,6 +556,11 @@ func (this *Applier) ReadMigrationRangeValues() error {
}
defer tx.Rollback()

err = this.setOptimizerSwitch(tx)
if err != nil {
return err
}

if err := this.readMigrationMinValues(tx, this.migrationContext.UniqueKey); err != nil {
return err
}
Expand Down

0 comments on commit 66211ee

Please sign in to comment.