Skip to content

Commit 3a7d4f8

Browse files
authored
fix small perf regression (#3017)
Undo a small perf regression I accidentally introduced in #3012. I assume >99% of the time `PostgresOIDToQValueKind` does not return an error. O(1) is cheap but not free, and given this function is in the hot path for CDC, I'll be pedantic about it.
1 parent 6a3ef03 commit 3a7d4f8

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

flow/connectors/postgres/qvalue_convert.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ func (c *PostgresConnector) postgresOIDToQValueKind(
5353
customTypeMapping map[uint32]shared.CustomDataType,
5454
) types.QValueKind {
5555
colType, err := postgres.PostgresOIDToQValueKind(recvOID, customTypeMapping, c.typeMap)
56-
_, warned := c.hushWarnOID[recvOID]
57-
if err != nil && !warned {
58-
c.logger.Warn(
59-
"unsupported field type",
60-
slog.Int64("oid", int64(recvOID)),
61-
slog.String("typeName", err.Error()),
62-
slog.String("mapping", string(colType)))
63-
c.hushWarnOID[recvOID] = struct{}{}
56+
if err != nil {
57+
if _, warned := c.hushWarnOID[recvOID]; !warned {
58+
c.logger.Warn(
59+
"unsupported field type",
60+
slog.Int64("oid", int64(recvOID)),
61+
slog.String("typeName", err.Error()),
62+
slog.String("mapping", string(colType)))
63+
c.hushWarnOID[recvOID] = struct{}{}
64+
}
6465
}
6566
return colType
6667
}

0 commit comments

Comments
 (0)