From d593b568bca47e2e842343aaa40f4b03c778b956 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Wed, 13 Apr 2022 15:38:36 +0800 Subject: [PATCH] Fix a metric-related bug in etcd/client (#4267) (#4284) close pingcap/tiflow#4266 --- pkg/etcd/client.go | 4 ++-- pkg/orchestrator/etcd_worker.go | 4 ++-- pkg/pipeline/context.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/etcd/client.go b/pkg/etcd/client.go index 3d128f7a77a..ac4e0003f2c 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -127,10 +127,10 @@ func (c *Client) Get(ctx context.Context, key string, opts ...clientv3.OpOption) // Delete delegates request to clientv3.KV.Delete func (c *Client) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (resp *clientv3.DeleteResponse, err error) { - if metric, ok := c.metrics[EtcdTxn]; ok { + if metric, ok := c.metrics[EtcdDel]; ok { metric.Inc() } - // We don't retry on delete operatoin. It's dangerous. + // We don't retry on delete operation. It's dangerous. return c.cli.Delete(ctx, key, opts...) } diff --git a/pkg/orchestrator/etcd_worker.go b/pkg/orchestrator/etcd_worker.go index 866a20cbc1e..d334ca12c1e 100644 --- a/pkg/orchestrator/etcd_worker.go +++ b/pkg/orchestrator/etcd_worker.go @@ -37,8 +37,8 @@ import ( ) const ( - // etcdWorkerLogsWarnDuration when EtcdWorker commits a txn to etcd or ticks - // it reactor takes more than etcdWorkerLogsWarnDuration, it will print a log + // When EtcdWorker commits a txn to etcd or ticks its reactor + // takes more than etcdWorkerLogsWarnDuration, it will print a log etcdWorkerLogsWarnDuration = 1 * time.Second deletionCounterKey = "/meta/ticdc-delete-etcd-key-count" ) diff --git a/pkg/pipeline/context.go b/pkg/pipeline/context.go index 49b3214adb7..eca933b5009 100644 --- a/pkg/pipeline/context.go +++ b/pkg/pipeline/context.go @@ -15,7 +15,7 @@ package pipeline import "github.com/pingcap/tiflow/pkg/context" -// NodeContext adds two functions from `coutext.Context` and created by pipeline +// NodeContext adds two functions to `context.Context` and is created by pipeline type NodeContext interface { context.Context