config: move resolve-lock-lite-threshold to tikv-client segment (#297)

This commit is contained in:
lysu 2021-09-02 14:23:07 +08:00 committed by GitHub
parent c7f8168472
commit 4fc565e203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 23 deletions

View File

@ -82,7 +82,8 @@ type TiKVClient struct {
StoreLivenessTimeout string `toml:"store-liveness-timeout" json:"store-liveness-timeout"` StoreLivenessTimeout string `toml:"store-liveness-timeout" json:"store-liveness-timeout"`
CoprCache CoprocessorCache `toml:"copr-cache" json:"copr-cache"` CoprCache CoprocessorCache `toml:"copr-cache" json:"copr-cache"`
// TTLRefreshedTxnSize controls whether a transaction should update its TTL or not. // TTLRefreshedTxnSize controls whether a transaction should update its TTL or not.
TTLRefreshedTxnSize int64 `toml:"ttl-refreshed-txn-size" json:"ttl-refreshed-txn-size"` TTLRefreshedTxnSize int64 `toml:"ttl-refreshed-txn-size" json:"ttl-refreshed-txn-size"`
ResolveLockLiteThreshold uint64 `toml:"resolve-lock-lite-threshold" json:"resolve-lock-lite-threshold"`
} }
// AsyncCommit is the config for the async commit feature. The switch to enable it is a system variable. // AsyncCommit is the config for the async commit feature. The switch to enable it is a system variable.
@ -149,6 +150,8 @@ func DefaultTiKVClient() TiKVClient {
AdmissionMaxResultMB: 10, AdmissionMaxResultMB: 10,
AdmissionMinProcessMs: 5, AdmissionMinProcessMs: 5,
}, },
ResolveLockLiteThreshold: 16,
} }
} }

View File

@ -71,32 +71,30 @@ type Config struct {
PessimisticTxn PessimisticTxn PessimisticTxn PessimisticTxn
TxnLocalLatches TxnLocalLatches TxnLocalLatches TxnLocalLatches
// StoresRefreshInterval indicates the interval of refreshing stores info, the unit is second. // StoresRefreshInterval indicates the interval of refreshing stores info, the unit is second.
StoresRefreshInterval uint64 StoresRefreshInterval uint64
OpenTracingEnable bool OpenTracingEnable bool
Path string Path string
EnableForwarding bool EnableForwarding bool
TxnScope string TxnScope string
EnableAsyncCommit bool EnableAsyncCommit bool
Enable1PC bool Enable1PC bool
ResolveLockLiteThreshold uint64
} }
// DefaultConfig returns the default configuration. // DefaultConfig returns the default configuration.
func DefaultConfig() Config { func DefaultConfig() Config {
return Config{ return Config{
CommitterConcurrency: 128, CommitterConcurrency: 128,
MaxTxnTTL: 60 * 60 * 1000, // 1hour MaxTxnTTL: 60 * 60 * 1000, // 1hour
TiKVClient: DefaultTiKVClient(), TiKVClient: DefaultTiKVClient(),
PDClient: DefaultPDClient(), PDClient: DefaultPDClient(),
TxnLocalLatches: DefaultTxnLocalLatches(), TxnLocalLatches: DefaultTxnLocalLatches(),
StoresRefreshInterval: DefStoresRefreshInterval, StoresRefreshInterval: DefStoresRefreshInterval,
OpenTracingEnable: false, OpenTracingEnable: false,
Path: "", Path: "",
EnableForwarding: false, EnableForwarding: false,
TxnScope: "", TxnScope: "",
EnableAsyncCommit: false, EnableAsyncCommit: false,
Enable1PC: false, Enable1PC: false,
ResolveLockLiteThreshold: 16,
} }
} }

View File

@ -70,7 +70,7 @@ type LockResolver struct {
func NewLockResolver(store storage) *LockResolver { func NewLockResolver(store storage) *LockResolver {
r := &LockResolver{ r := &LockResolver{
store: store, store: store,
resolveLockLiteThreshold: config.GetGlobalConfig().ResolveLockLiteThreshold, resolveLockLiteThreshold: config.GetGlobalConfig().TiKVClient.ResolveLockLiteThreshold,
} }
r.mu.resolved = make(map[uint64]TxnStatus) r.mu.resolved = make(map[uint64]TxnStatus)
r.mu.recentResolved = list.New() r.mu.recentResolved = list.New()