From 717e9a9bacd2c83f92eca28bd121aea926b9e34f Mon Sep 17 00:00:00 2001 From: SimFG Date: Mon, 12 Aug 2024 17:03:28 +0800 Subject: [PATCH] add the config to control the deadlock detection Signed-off-by: SimFG --- core/go.mod | 2 +- core/go.sum | 4 ++-- server/config.go | 1 + server/configs/cdc.yaml | 1 + server/go.mod | 4 ++-- server/go.sum | 4 ++-- server/main/main.go | 2 ++ 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/go.mod b/core/go.mod index 64a71a9b..1d33d976 100644 --- a/core/go.mod +++ b/core/go.mod @@ -10,7 +10,7 @@ require ( github.com/milvus-io/milvus/pkg v0.0.2-0.20240712081735-d8e68cbb973d github.com/prometheus/client_golang v1.14.0 github.com/samber/lo v1.27.0 - github.com/sasha-s/go-deadlock v0.3.1 + github.com/sasha-s/go-deadlock v0.3.2-0.20240530143741-ed6f7f6d979c github.com/stretchr/testify v1.8.4 go.etcd.io/etcd/client/v3 v3.5.5 go.uber.org/zap v1.21.0 diff --git a/core/go.sum b/core/go.sum index b367cff4..ab650927 100644 --- a/core/go.sum +++ b/core/go.sum @@ -636,8 +636,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/samber/lo v1.27.0 h1:GOyDWxsblvqYobqsmUuMddPa2/mMzkKyojlXol4+LaQ= github.com/samber/lo v1.27.0/go.mod h1:it33p9UtPMS7z72fP4gw/EIfQB2eI8ke7GR2wc6+Rhg= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.2-0.20240530143741-ed6f7f6d979c h1:rCY9BXit3Ody7aRFkT+q/OOGvNk9TVG2une4Xgemid4= +github.com/sasha-s/go-deadlock v0.3.2-0.20240530143741-ed6f7f6d979c/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= diff --git a/server/config.go b/server/config.go index 2854f86a..a274bed9 100644 --- a/server/config.go +++ b/server/config.go @@ -34,6 +34,7 @@ type CDCServerConfig struct { MaxNameLength int Retry config.RetrySettings LogLevel string + DetectDeadLock bool } type CDCMetaStoreConfig struct { diff --git a/server/configs/cdc.yaml b/server/configs/cdc.yaml index b39376f5..eadf49e6 100644 --- a/server/configs/cdc.yaml +++ b/server/configs/cdc.yaml @@ -43,3 +43,4 @@ sourceConfig: # address: 127.0.0.1:9092 maxNameLength: 256 logLevel: info +detectDeadLock: false diff --git a/server/go.mod b/server/go.mod index c3df44db..af85dd38 100644 --- a/server/go.mod +++ b/server/go.mod @@ -15,9 +15,11 @@ require ( github.com/pingcap/log v1.1.1-0.20221015072633-39906604fb81 github.com/prometheus/client_golang v1.14.0 github.com/samber/lo v1.27.0 + github.com/sasha-s/go-deadlock v0.3.2-0.20240530143741-ed6f7f6d979c github.com/stretchr/testify v1.8.4 github.com/zilliztech/milvus-cdc/core v0.0.1 go.etcd.io/etcd/client/v3 v3.5.5 + go.uber.org/atomic v1.10.0 go.uber.org/zap v1.21.0 google.golang.org/grpc v1.57.1 sigs.k8s.io/yaml v1.3.0 @@ -96,7 +98,6 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil/v3 v3.22.9 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/soheilhy/cmux v0.1.5 // indirect @@ -136,7 +137,6 @@ require ( go.opentelemetry.io/otel/sdk v1.13.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - go.uber.org/atomic v1.10.0 // indirect go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.22.0 // indirect diff --git a/server/go.sum b/server/go.sum index 2d8dbc4f..e255b813 100644 --- a/server/go.sum +++ b/server/go.sum @@ -643,8 +643,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/samber/lo v1.27.0 h1:GOyDWxsblvqYobqsmUuMddPa2/mMzkKyojlXol4+LaQ= github.com/samber/lo v1.27.0/go.mod h1:it33p9UtPMS7z72fP4gw/EIfQB2eI8ke7GR2wc6+Rhg= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.2-0.20240530143741-ed6f7f6d979c h1:rCY9BXit3Ody7aRFkT+q/OOGvNk9TVG2une4Xgemid4= +github.com/sasha-s/go-deadlock v0.3.2-0.20240530143741-ed6f7f6d979c/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= diff --git a/server/main/main.go b/server/main/main.go index 2f300884..f8e45cea 100644 --- a/server/main/main.go +++ b/server/main/main.go @@ -21,6 +21,7 @@ package main import ( "os" + "github.com/sasha-s/go-deadlock" "go.uber.org/zap" "go.uber.org/zap/zapcore" "sigs.k8s.io/yaml" @@ -53,5 +54,6 @@ func main() { logLevel = zap.InfoLevel } log.SetLevel(logLevel) + deadlock.Opts.Disable = !serverConfig.DetectDeadLock s.Run(&serverConfig) }