Skip to content

Commit

Permalink
Fix a metric-related bug in etcd/client (pingcap#4267)
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCheung96 authored and overvenus committed Feb 21, 2022
1 parent efeedfd commit 3778f0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/etcd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/orchestrator/etcd_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3778f0b

Please sign in to comment.