From f5ebaf2f0e859ea88be82d5cde1f9e890c691bbe Mon Sep 17 00:00:00 2001 From: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com> Date: Fri, 18 Jun 2021 11:38:38 +0800 Subject: [PATCH] cherry pick #25470 to release-5.1 Signed-off-by: ti-srebot --- config/config.go | 3 ++- config/config.toml.example | 3 +++ config/config_test.go | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 90725ff40ed88..5641c347baffb 100644 --- a/config/config.go +++ b/config/config.go @@ -494,7 +494,8 @@ type Binlog struct { // PessimisticTxn is the config for pessimistic transaction. type PessimisticTxn struct { // The max count of retry for a single statement in a pessimistic transaction. - MaxRetryCount uint `toml:"max-retry-count" json:"max-retry-count"` + MaxRetryCount uint `toml:"max-retry-count" json:"max-retry-count"` + // The max count of deadlock events that will be recorded in the information_schema.deadlocks table. DeadlockHistoryCapacity uint `toml:"deadlock-history-capacity" json:"deadlock-history-capacity"` } diff --git a/config/config.toml.example b/config/config.toml.example index 1cc2674d01727..d5fd2437e3b74 100644 --- a/config/config.toml.example +++ b/config/config.toml.example @@ -440,6 +440,9 @@ strategy = "range" # max retry count for a statement in a pessimistic transaction. max-retry-count = 256 +# The max count of deadlock events that will be recorded in the information_schema.deadlocks table. +deadlock-history-capacity = 10 + [stmt-summary] # enable statement summary. enable = true diff --git a/config/config_test.go b/config/config_test.go index 9533b8bf52975..f4092e1c7584c 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -230,6 +230,8 @@ group= "abc" zone= "dc-1" [security] spilled-file-encryption-method = "plaintext" +[pessimistic-txn] +deadlock-history-capacity = 123 `) c.Assert(err, IsNil) @@ -284,6 +286,7 @@ spilled-file-encryption-method = "plaintext" c.Assert(conf.EnableEnumLengthLimit, Equals, false) c.Assert(conf.EnableForwarding, Equals, true) c.Assert(conf.StoresRefreshInterval, Equals, uint64(30)) + c.Assert(conf.PessimisticTxn.DeadlockHistoryCapacity, Equals, uint(123)) _, err = f.WriteString(` [log.file]