Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session: enable async commit in new clusters #23274

Merged
merged 10 commits into from
Mar 12, 2021
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