Skip to content

Commit 52d8a01

Browse files
committed
don't warn on the same event type twice
1 parent 71770d4 commit 52d8a01

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

flow/connectors/mysql/cdc.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,12 @@ func (c *MySqlConnector) PullRecords(
579579
}
580580
}
581581
recordUnsupportedEvent := func(ctx context.Context, event *replication.BinlogEvent, prefix string) {
582-
c.logger.Warn("unsupported rows event", slog.Any("type", event.Header.EventType))
583582
otelManager.Metrics.UnsupportedBinlogEventCounter.Add(ctx, 1, metric.WithAttributeSet(attribute.NewSet(
584583
attribute.String(otel_metrics.BinlogEventTypeKey, fmt.Sprintf("%s_%d", prefix, int(event.Header.EventType))),
585584
)))
585+
if _, loaded := c.warnedUnsupportedEventTypes.LoadOrStore(event.Header.EventType, struct{}{}); !loaded {
586+
c.logger.Warn("unsupported rows event", slog.Any("type", event.Header.EventType))
587+
}
586588
}
587589

588590
lastEventAt := time.Now()

flow/connectors/mysql/mysql.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@ import (
3131

3232
type MySqlConnector struct {
3333
*metadataStore.PostgresMetadata
34-
config *protos.MySqlConfig
35-
ssh *utils.SSHTunnel
36-
conn atomic.Pointer[client.Conn] // atomic used for internal concurrency, connector interface is not threadsafe
37-
contexts atomic.Pointer[chan context.Context]
38-
logger log.Logger
39-
rdsAuth *utils.RDSAuth
40-
serverVersion string
41-
collationCharset atomic.Pointer[map[uint64]string]
42-
warnedCharsets sync.Map
43-
binlogHeartbeatPeriod time.Duration
44-
totalBytesRead atomic.Int64
45-
deltaBytesRead atomic.Int64
34+
config *protos.MySqlConfig
35+
ssh *utils.SSHTunnel
36+
conn atomic.Pointer[client.Conn] // atomic used for internal concurrency, connector interface is not threadsafe
37+
contexts atomic.Pointer[chan context.Context]
38+
logger log.Logger
39+
rdsAuth *utils.RDSAuth
40+
serverVersion string
41+
collationCharset atomic.Pointer[map[uint64]string]
42+
warnedUnsupportedEventTypes sync.Map
43+
warnedCharsets sync.Map
44+
binlogHeartbeatPeriod time.Duration
45+
totalBytesRead atomic.Int64
46+
deltaBytesRead atomic.Int64
4647
}
4748

4849
func NewMySqlConnector(ctx context.Context, config *protos.MySqlConfig) (*MySqlConnector, error) {

0 commit comments

Comments
 (0)