From 32f9604345e7b176ef8b003a02516c96b511636e Mon Sep 17 00:00:00 2001 From: tangenta Date: Tue, 27 Dec 2022 21:04:16 +0800 Subject: [PATCH] ddl: ignore internal http client goroutine in leak tests (#40190) close pingcap/tidb#40183 --- ddl/index.go | 13 ++++++++----- ddl/main_test.go | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ddl/index.go b/ddl/index.go index 7c9fc1d083ff4..929a86b08321b 100644 --- a/ddl/index.go +++ b/ddl/index.go @@ -703,15 +703,18 @@ func pickBackfillType(w *worker, job *model.Job) model.ReorgType { return job.ReorgMeta.ReorgTp } if IsEnableFastReorg() { - canUseIngest := canUseIngest(w) - if ingest.LitInitialized && canUseIngest { - job.ReorgMeta.ReorgTp = model.ReorgTypeLitMerge - return model.ReorgTypeLitMerge + var useIngest bool + if ingest.LitInitialized { + useIngest = canUseIngest(w) + if useIngest { + job.ReorgMeta.ReorgTp = model.ReorgTypeLitMerge + return model.ReorgTypeLitMerge + } } // The lightning environment is unavailable, but we can still use the txn-merge backfill. logutil.BgLogger().Info("[ddl] fallback to txn-merge backfill process", zap.Bool("lightning env initialized", ingest.LitInitialized), - zap.Bool("can use ingest", canUseIngest)) + zap.Bool("can use ingest", useIngest)) job.ReorgMeta.ReorgTp = model.ReorgTypeTxnMerge return model.ReorgTypeTxnMerge } diff --git a/ddl/main_test.go b/ddl/main_test.go index 3418d16a23ece..6a8642ae34380 100644 --- a/ddl/main_test.go +++ b/ddl/main_test.go @@ -64,6 +64,8 @@ func TestMain(m *testing.M) { goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), + goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), + goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), } goleak.VerifyTestMain(m, opts...)