From 4fc565e203a99400d0b080a25a93fb860b3b6fd6 Mon Sep 17 00:00:00 2001 From: lysu Date: Thu, 2 Sep 2021 14:23:07 +0800 Subject: [PATCH] config: move resolve-lock-lite-threshold to tikv-client segment (#297) --- config/client.go | 5 ++++- config/config.go | 40 ++++++++++++++++------------------ txnkv/txnlock/lock_resolver.go | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/config/client.go b/config/client.go index 40fa1571..93417350 100644 --- a/config/client.go +++ b/config/client.go @@ -82,7 +82,8 @@ type TiKVClient struct { StoreLivenessTimeout string `toml:"store-liveness-timeout" json:"store-liveness-timeout"` CoprCache CoprocessorCache `toml:"copr-cache" json:"copr-cache"` // 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. @@ -149,6 +150,8 @@ func DefaultTiKVClient() TiKVClient { AdmissionMaxResultMB: 10, AdmissionMinProcessMs: 5, }, + + ResolveLockLiteThreshold: 16, } } diff --git a/config/config.go b/config/config.go index fbaae568..a48fecc9 100644 --- a/config/config.go +++ b/config/config.go @@ -71,32 +71,30 @@ type Config struct { PessimisticTxn PessimisticTxn TxnLocalLatches TxnLocalLatches // StoresRefreshInterval indicates the interval of refreshing stores info, the unit is second. - StoresRefreshInterval uint64 - OpenTracingEnable bool - Path string - EnableForwarding bool - TxnScope string - EnableAsyncCommit bool - Enable1PC bool - ResolveLockLiteThreshold uint64 + StoresRefreshInterval uint64 + OpenTracingEnable bool + Path string + EnableForwarding bool + TxnScope string + EnableAsyncCommit bool + Enable1PC bool } // DefaultConfig returns the default configuration. func DefaultConfig() Config { return Config{ - CommitterConcurrency: 128, - MaxTxnTTL: 60 * 60 * 1000, // 1hour - TiKVClient: DefaultTiKVClient(), - PDClient: DefaultPDClient(), - TxnLocalLatches: DefaultTxnLocalLatches(), - StoresRefreshInterval: DefStoresRefreshInterval, - OpenTracingEnable: false, - Path: "", - EnableForwarding: false, - TxnScope: "", - EnableAsyncCommit: false, - Enable1PC: false, - ResolveLockLiteThreshold: 16, + CommitterConcurrency: 128, + MaxTxnTTL: 60 * 60 * 1000, // 1hour + TiKVClient: DefaultTiKVClient(), + PDClient: DefaultPDClient(), + TxnLocalLatches: DefaultTxnLocalLatches(), + StoresRefreshInterval: DefStoresRefreshInterval, + OpenTracingEnable: false, + Path: "", + EnableForwarding: false, + TxnScope: "", + EnableAsyncCommit: false, + Enable1PC: false, } } diff --git a/txnkv/txnlock/lock_resolver.go b/txnkv/txnlock/lock_resolver.go index 16c5b093..d3b0621e 100644 --- a/txnkv/txnlock/lock_resolver.go +++ b/txnkv/txnlock/lock_resolver.go @@ -70,7 +70,7 @@ type LockResolver struct { func NewLockResolver(store storage) *LockResolver { r := &LockResolver{ store: store, - resolveLockLiteThreshold: config.GetGlobalConfig().ResolveLockLiteThreshold, + resolveLockLiteThreshold: config.GetGlobalConfig().TiKVClient.ResolveLockLiteThreshold, } r.mu.resolved = make(map[uint64]TxnStatus) r.mu.recentResolved = list.New()