From 3778f0b638a34c7396f3af4be679e0713b311199 Mon Sep 17 00:00:00 2001 From: CharlesCheung <61726649+CharlesCheung96@users.noreply.github.com> Date: Wed, 12 Jan 2022 10:59:42 +0800 Subject: [PATCH] Fix a metric-related bug in etcd/client (#4267) 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 de287e6c39e..0b859960940 100644 --- a/pkg/etcd/client.go +++ b/pkg/etcd/client.go @@ -114,10 +114,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 edb53c4c49e..f5d47146445 100644 --- a/pkg/orchestrator/etcd_worker.go +++ b/pkg/orchestrator/etcd_worker.go @@ -39,8 +39,8 @@ const ( // etcdTxnTimeoutDuration represents the timeout duration for committing a // transaction to Etcd etcdTxnTimeoutDuration = 30 * time.Second - // 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 12c2f69d6c8..fb1143c901d 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