diff --git a/pkg/proxy/proxy.go b/pkg/proxy/proxy.go index f9c8203f..7176ac1a 100644 --- a/pkg/proxy/proxy.go +++ b/pkg/proxy/proxy.go @@ -72,6 +72,7 @@ func NewSQLServer(logger *zap.Logger, cfg config.ProxyServer, certMgr *cert.Cert mu: serverState{ connID: 0, clients: make(map[uint64]*client.ClientConnection), + status: statusNormal, }, } diff --git a/pkg/proxy/proxy_test.go b/pkg/proxy/proxy_test.go index 8c5c52ae..f4117c2b 100644 --- a/pkg/proxy/proxy_test.go +++ b/pkg/proxy/proxy_test.go @@ -178,11 +178,11 @@ func TestWatchCfg(t *testing.T) { cfg := &config.Config{ Proxy: config.ProxyServer{ ProxyServerOnline: config.ProxyServerOnline{ - RequireBackendTLS: true, - MaxConnections: 100, - ConnBufferSize: 1024 * 1024, - ProxyProtocol: "v2", - GracefulWaitBeforeShutdown: 100, + RequireBackendTLS: true, + MaxConnections: 100, + ConnBufferSize: 1024 * 1024, + ProxyProtocol: "v2", + GracefulCloseConnTimeout: 100, }, }, } diff --git a/pkg/server/api/config_test.go b/pkg/server/api/config_test.go index 90aad046..fd957b0f 100644 --- a/pkg/server/api/config_test.go +++ b/pkg/server/api/config_test.go @@ -24,6 +24,7 @@ func TestConfig(t *testing.T) { addr = '0.0.0.0:6000' pd-addrs = '127.0.0.1:2379' require-backend-tls = true +graceful-close-conn-timeout = 15 [proxy.frontend-keepalive] enabled = true @@ -75,7 +76,7 @@ max-backups = 3 doHTTP(t, http.MethodGet, "/api/admin/config?format=json", nil, func(t *testing.T, r *http.Response) { all, err := io.ReadAll(r.Body) require.NoError(t, err) - require.Equal(t, `{"proxy":{"addr":"0.0.0.0:6000","pd-addrs":"127.0.0.1:2379","require-backend-tls":true,"frontend-keepalive":{"enabled":true},"backend-healthy-keepalive":{"enabled":true,"idle":60000000000,"cnt":5,"intvl":3000000000,"timeout":15000000000},"backend-unhealthy-keepalive":{"enabled":true,"idle":10000000000,"cnt":5,"intvl":1000000000,"timeout":5000000000}},"api":{"addr":"0.0.0.0:3080"},"advance":{"ignore-wrong-namespace":true},"security":{"server-tls":{"min-tls-version":"1.1"},"peer-tls":{"min-tls-version":"1.1"},"cluster-tls":{"min-tls-version":"1.1"},"sql-tls":{"min-tls-version":"1.1"}},"metrics":{"metrics-addr":"","metrics-interval":0},"log":{"encoder":"tidb","level":"info","log-file":{"max-size":300,"max-days":3,"max-backups":3}}}`, + require.Equal(t, `{"proxy":{"addr":"0.0.0.0:6000","pd-addrs":"127.0.0.1:2379","require-backend-tls":true,"frontend-keepalive":{"enabled":true},"backend-healthy-keepalive":{"enabled":true,"idle":60000000000,"cnt":5,"intvl":3000000000,"timeout":15000000000},"backend-unhealthy-keepalive":{"enabled":true,"idle":10000000000,"cnt":5,"intvl":1000000000,"timeout":5000000000},"graceful-close-conn-timeout":15},"api":{"addr":"0.0.0.0:3080"},"advance":{"ignore-wrong-namespace":true},"security":{"server-tls":{"min-tls-version":"1.1"},"peer-tls":{"min-tls-version":"1.1"},"cluster-tls":{"min-tls-version":"1.1"},"sql-tls":{"min-tls-version":"1.1"}},"metrics":{"metrics-addr":"","metrics-interval":0},"log":{"encoder":"tidb","level":"info","log-file":{"max-size":300,"max-days":3,"max-backups":3}}}`, string(regexp.MustCompile(`"workdir":"[^"]+",`).ReplaceAll(all, nil))) require.Equal(t, http.StatusOK, r.StatusCode) })