Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changefeedccl: fix flush_hist_nanos callback #128991

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rharding6373
Copy link
Collaborator

The flush_hist_nanos metric is calculated in a metrics callback. Before this change, the cloud storage and webhook v1 sinks would immediately call the callback before performing flush logic, which led to unexpectedly small flush_hist_nanos. This change moves the callback out of sink-specific logic so that the callback is correctly deferred for all sinks.

Epic: CRDB-37337
Fixes: #121248

Release note (bug fix): The changefeed.flush_hist_nanos metric now tracks the time it takes to flush for the cloud storage and old webhook sinks. Before this change, changefeed.flush_hist_nanos would appear erroneously as near 0 for these sinks.

The flush_hist_nanos metric is calculated in a metrics callback. Before
this change, the cloud storage and webhook v1 sinks would immediately
call the callback before performing flush logic, which led to
unexpectedly small flush_hist_nanos. This change moves the callback
out of sink-specific logic so that the callback is correctly deferred
for all sinks.

Epic: CRDB-37337
Fixes: cockroachdb#121248

Release note (bug fix): The changefeed.flush_hist_nanos metric now
tracks the time it takes to flush for the cloud storage and old webhook
sinks. Before this change, changefeed.flush_hist_nanos would appear
erroneously as near 0 for these sinks.
@rharding6373 rharding6373 requested a review from a team as a code owner August 14, 2024 17:55
@rharding6373 rharding6373 requested review from wenyihu6 and removed request for a team August 14, 2024 17:55
Copy link

blathers-crl bot commented Aug 14, 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
Member

This change is Reviewable

@rharding6373 rharding6373 added backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 labels Aug 14, 2024
Copy link
Contributor

@wenyihu6 wenyihu6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rharding6373)


pkg/ccl/changefeedccl/batching_sink.go line 120 at r1 (raw file):

// Flush implements the Sink interface, returning the first error that has
// occured in the past EmitRow calls.
func (s *batchingSink) Flush(ctx context.Context) error {

It seems that batchingSink.Flush is called during `EmitResolvedTimestamp` https://github.com/cockroachdb/cockroach/blob/17a0dc8a17f1bf3c00ffe62deb1caef03faac946/pkg/ccl/changefeedccl/batching\_sink.go#L230 as well. I see similar inconsistencies for pulsar, sql sinks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

changefeedccl: fix flush_hist_nanos callback in cloud storage and webhook sinks
3 participants