Skip to content

Commit 1ecce1d

Browse files
authored
Revert "cdc: log slow conflict detect every 60s (#11251) (#11287)" (#11324)
close #11323
1 parent ffbe6f8 commit 1ecce1d

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

cdc/sinkv2/eventsink/txn/worker.go

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020

2121
"github.com/pingcap/log"
2222
"github.com/pingcap/tiflow/cdc/contextutil"
23-
"github.com/pingcap/tiflow/cdc/model"
2423
"github.com/pingcap/tiflow/cdc/sinkv2/metrics/txn"
2524
"github.com/pingcap/tiflow/cdc/sinkv2/tablesink/state"
2625
"github.com/pingcap/tiflow/pkg/causality"
@@ -47,8 +46,6 @@ type worker struct {
4746
flushInterval time.Duration
4847
hasPending bool
4948
postTxnExecutedCallbacks []func()
50-
51-
lastSlowConflictDetectLog map[model.TableID]time.Time
5249
}
5350

5451
func newWorker(ctx context.Context, ID int, backend backend, workerCount int) *worker {
@@ -71,8 +68,6 @@ func newWorker(ctx context.Context, ID int, backend backend, workerCount int) *w
7168
flushInterval: backend.MaxFlushInterval(),
7269
hasPending: false,
7370
postTxnExecutedCallbacks: make([]func(), 0, 1024),
74-
75-
lastSlowConflictDetectLog: make(map[model.TableID]time.Time),
7671
}
7772
}
7873

@@ -90,9 +85,6 @@ func (w *worker) run(txnCh <-chan causality.TxnWithNotifier[*txnEvent]) error {
9085
zap.String("changefeedID", w.changefeed),
9186
zap.Int("workerID", w.ID))
9287

93-
cleanSlowLogHistory := time.NewTicker(time.Hour)
94-
defer cleanSlowLogHistory.Stop()
95-
9688
start := time.Now()
9789
for {
9890
select {
@@ -101,15 +93,6 @@ func (w *worker) run(txnCh <-chan causality.TxnWithNotifier[*txnEvent]) error {
10193
zap.String("changefeedID", w.changefeed),
10294
zap.Int("workerID", w.ID))
10395
return nil
104-
case <-cleanSlowLogHistory.C:
105-
lastSlowConflictDetectLog := w.lastSlowConflictDetectLog
106-
w.lastSlowConflictDetectLog = make(map[model.TableID]time.Time)
107-
now := time.Now()
108-
for tableID, lastLog := range lastSlowConflictDetectLog {
109-
if now.Sub(lastLog) <= time.Minute {
110-
w.lastSlowConflictDetectLog[tableID] = lastLog
111-
}
112-
}
11396
case txn := <-txnCh:
11497
// we get the data from txnCh.out until no more data here or reach the state that can be flushed.
11598
// If no more data in txnCh.out, and also not reach the state that can be flushed,
@@ -166,24 +149,8 @@ func (w *worker) onEvent(txn *txnEvent, postTxnExecuted func()) bool {
166149
return false
167150
}
168151

169-
conflictDetectTime := txn.conflictResolved.Sub(txn.start).Seconds()
170-
w.metricConflictDetectDuration.Observe(conflictDetectTime)
152+
w.metricConflictDetectDuration.Observe(txn.conflictResolved.Sub(txn.start).Seconds())
171153
w.metricQueueDuration.Observe(time.Since(txn.start).Seconds())
172-
173-
// Log tables which conflict detect time larger than 1 minute.
174-
if conflictDetectTime > float64(60) {
175-
now := time.Now()
176-
// Log slow conflict detect tables every minute.
177-
if lastLog, ok := w.lastSlowConflictDetectLog[txn.Event.TableInfo.ID]; !ok || now.Sub(lastLog) > time.Minute {
178-
log.Warn("Transaction dmlSink finds a slow transaction in conflict detector",
179-
zap.String("changefeedID", w.changefeed),
180-
zap.Int("workerID", w.ID),
181-
zap.Int64("TableID", txn.Event.TableInfo.ID),
182-
zap.Float64("seconds", conflictDetectTime))
183-
w.lastSlowConflictDetectLog[txn.Event.Table.TableID] = now
184-
}
185-
}
186-
187154
w.metricTxnWorkerHandledRows.Add(float64(len(txn.Event.Rows)))
188155
w.postTxnExecutedCallbacks = append(w.postTxnExecutedCallbacks, postTxnExecuted)
189156
return w.backend.OnTxnEvent(txn.TxnCallbackableEvent)

0 commit comments

Comments
 (0)