Skip to content

changefeedccl: match nil metrics behaviour#118421

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
wenyihu6:changed-to-nil-
Jan 30, 2024
Merged

changefeedccl: match nil metrics behaviour#118421
craig[bot] merged 1 commit intocockroachdb:masterfrom
wenyihu6:changed-to-nil-

Conversation

@wenyihu6
Copy link
Copy Markdown
Contributor

@wenyihu6 wenyihu6 commented Jan 29, 2024

Previously, validateExternalConnectionSinkURI would validate the changefeed
sink URI by creating a fake sink and passing nil for metricsRecorder. This
is usually not problematic since the sink is never used. A new patch, #117693,
is now changing this and calling metricsBuilder interface method inside
makeKafkaSink. To resolve this, this patch changes getSink in
validateExternalConnectionSinkURI to pass in (*sliMetrics)(nil) to avoid
calling methods on a nil interface.

See also: #117693
Release note: none
Epic: none

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Jan 29, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@wenyihu6 wenyihu6 force-pushed the changed-to-nil- branch 4 times, most recently from 3dd9a40 to 6660cd8 Compare January 30, 2024 14:47
Previously, `validateExternalConnectionSinkURI` would validate the changefeed
sink URI by creating a fake sink and passing `nil` for `metricsRecorder`. This
is usually not problematic since the sink is never used. A new patch, cockroachdb#117693,
is now changing this and calling `metricsBuilder` interface method inside
`makeKafkaSink`. To resolve this, this patch changes getSink in
`validateExternalConnectionSinkURI` to pass in `(*sliMetrics)(nil)` to avoid
calling methods on a nil interface.

See also: cockroachdb#117693
Release note: none
Epic: none
@wenyihu6
Copy link
Copy Markdown
Contributor Author

Alternatively, we can check if m is nil here and return nilMetricsRecorderBuilder(recordingRequired) if it is. wdyt?

metricsBuilder := func(recordingRequired bool) metricsRecorder {
if recordingRequired {
return maybeWrapMetrics(ctx, m, serverCfg.ExternalIORecorder)
}
return m
}

@wenyihu6 wenyihu6 marked this pull request as ready for review January 30, 2024 14:52
@wenyihu6 wenyihu6 requested a review from a team as a code owner January 30, 2024 14:52
@wenyihu6 wenyihu6 requested review from rharding6373 and removed request for a team and rharding6373 January 30, 2024 14:52
@wenyihu6
Copy link
Copy Markdown
Contributor Author

TFTR!!

bors r=miretskiy

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 30, 2024

Build succeeded:

@craig craig bot merged commit 815e757 into cockroachdb:master Jan 30, 2024
@wenyihu6 wenyihu6 deleted the changed-to-nil- branch January 30, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants