From 6d2462f986e83d3ab03644b0dfa7f8d30756a570 Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Thu, 2 Feb 2023 19:38:48 +0800 Subject: [PATCH 1/2] revoke db timeout --- br/pkg/lightning/common/util.go | 4 ---- br/pkg/lightning/config/config_test.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/br/pkg/lightning/common/util.go b/br/pkg/lightning/common/util.go index fbf275a99bfe1..b9bdf564403de 100644 --- a/br/pkg/lightning/common/util.go +++ b/br/pkg/lightning/common/util.go @@ -44,8 +44,6 @@ const ( retryTimeout = 3 * time.Second defaultMaxRetry = 3 - - dbTimeout = 30 * time.Second ) // MySQLConnectParam records the parameters needed to connect to a MySQL database. @@ -76,8 +74,6 @@ func (param *MySQLConnectParam) ToDriverConfig() *mysql.Config { cfg.Params["charset"] = "utf8mb4" cfg.Params["sql_mode"] = fmt.Sprintf("'%s'", param.SQLMode) cfg.MaxAllowedPacket = int(param.MaxAllowedPacket) - cfg.ReadTimeout = dbTimeout - cfg.WriteTimeout = dbTimeout cfg.TLS = param.TLSConfig cfg.AllowFallbackToPlaintext = param.AllowFallbackToPlaintext diff --git a/br/pkg/lightning/config/config_test.go b/br/pkg/lightning/config/config_test.go index 91edd8aa46c12..98635ba4674e9 100644 --- a/br/pkg/lightning/config/config_test.go +++ b/br/pkg/lightning/config/config_test.go @@ -764,7 +764,7 @@ func TestLoadConfig(t *testing.T) { err = taskCfg.Adjust(context.Background()) require.NoError(t, err) equivalentDSN := taskCfg.Checkpoint.MySQLParam.ToDriverConfig().FormatDSN() - expectedDSN := "guest:12345@tcp(172.16.30.11:4001)/?readTimeout=30s&writeTimeout=30s&maxAllowedPacket=67108864&charset=utf8mb4&sql_mode=%27ONLY_FULL_GROUP_BY%2CSTRICT_TRANS_TABLES%2CNO_ZERO_IN_DATE%2CNO_ZERO_DATE%2CERROR_FOR_DIVISION_BY_ZERO%2CNO_AUTO_CREATE_USER%2CNO_ENGINE_SUBSTITUTION%27" + expectedDSN := "guest:12345@tcp(172.16.30.11:4001)/?maxAllowedPacket=67108864&charset=utf8mb4&sql_mode=%27ONLY_FULL_GROUP_BY%2CSTRICT_TRANS_TABLES%2CNO_ZERO_IN_DATE%2CNO_ZERO_DATE%2CERROR_FOR_DIVISION_BY_ZERO%2CNO_AUTO_CREATE_USER%2CNO_ENGINE_SUBSTITUTION%27" require.Equal(t, expectedDSN, equivalentDSN) result := taskCfg.String() From fb761b65d80ffb587a656870411dffef98d65b7a Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Thu, 2 Feb 2023 20:01:38 +0800 Subject: [PATCH 2/2] cut default keepalive param loose --- br/pkg/lightning/config/const.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/br/pkg/lightning/config/const.go b/br/pkg/lightning/config/const.go index e114eafd8ea88..767b7a3a06c89 100644 --- a/br/pkg/lightning/config/const.go +++ b/br/pkg/lightning/config/const.go @@ -41,8 +41,8 @@ const ( var ( DefaultGrpcKeepaliveParams = grpc.WithKeepaliveParams(keepalive.ClientParameters{ - Time: 10 * time.Second, - Timeout: 20 * time.Second, + Time: 1 * time.Minute, + Timeout: 2 * time.Minute, PermitWithoutStream: false, }) )