Skip to content

Commit

Permalink
session: enable async commit in new clusters (#23274)
Browse files Browse the repository at this point in the history
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
  • Loading branch information
sticnarf authored Mar 12, 2021
1 parent 689a598 commit 088fe75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 6 additions & 0 deletions session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,12 @@ func doDMLWorks(s Session) {
vVal = variable.BoolOn
}
}
if v.Name == variable.TiDBEnableAsyncCommit && config.GetGlobalConfig().Store == "tikv" {
vVal = variable.BoolOn
}
if v.Name == variable.TiDBEnable1PC && config.GetGlobalConfig().Store == "tikv" {
vVal = variable.BoolOn
}
value := fmt.Sprintf(`("%s", "%s")`, strings.ToLower(k), vVal)
values = append(values, value)
}
Expand Down
11 changes: 4 additions & 7 deletions store/tikv/config/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,12 @@ type AsyncCommit struct {
KeysLimit uint `toml:"keys-limit" json:"keys-limit"`
// Use async commit only if the total size of keys does not exceed TotalKeySizeLimit.
TotalKeySizeLimit uint64 `toml:"total-key-size-limit" json:"total-key-size-limit"`
// The following two fields should never be modified by the user, so tags are not provided
// on purpose.
// The duration within which is safe for async commit or 1PC to commit with an old schema.
// It is only changed in tests.
// TODO: 1PC is not part of async commit. These two fields should be moved to a more suitable
// place.
SafeWindow time.Duration
// The following two fields should NOT be modified in most cases. If both async commit
// and 1PC are disabled in the whole cluster, they can be set to zero to avoid waiting in DDLs.
SafeWindow time.Duration `toml:"safe-window" json:"safe-window"`
// The duration in addition to SafeWindow to make DDL safe.
AllowedClockDrift time.Duration
AllowedClockDrift time.Duration `toml:"allowed-clock-drift" json:"allowed-clock-drift"`
}

// CoprocessorCache is the config for coprocessor cache.
Expand Down

0 comments on commit 088fe75

Please sign in to comment.