Skip to content
New issue

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

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

Already on GitHub? # to your account

changefeedccl/kvfeed: pass consumer id correctly #138939

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

wenyihu6
Copy link
Contributor

@wenyihu6 wenyihu6 commented Jan 13, 2025

Previously, we introduced the concept of a consumer ID to prevent a single
changefeed job from over-consuming the catch-up scan quota and blocking other
consumers from making progress on the server side. However, the changefeed
client-side code requires the consumer ID to be passed again in the rangefeed
options during rangefeedFactory.Run. This was missing in the previous
PR, causing the changefeed job ID to default to zero. This patch fixes
the issue by ensuring the consumer ID is correctly passed in the
rangefeed options.

Related: #133789
Release note: none
Epic: none

Previously, we introduced the concept of a consumer ID to prevent a single
changefeed job from over-consuming the catch-up scan quota and blocking other
consumers from making progress on the server side. However, the changefeed
client-side code requires the consumer ID to be passed again in the rangefeed
options during rangefeedFactory.Run. This was missing in the previous
PR, causing the changefeed job ID to default to zero. This patch fixes
the issue by ensuring the consumer ID is correctly passed in the
rangefeed options.

Related: cockroachdb#133789
Release note: None
Copy link

blathers-crl bot commented Jan 13, 2025

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

@wenyihu6 wenyihu6 marked this pull request as ready for review January 13, 2025 17:13
@wenyihu6 wenyihu6 requested a review from a team as a code owner January 13, 2025 17:13
@wenyihu6 wenyihu6 requested review from andyyang890 and stevendanna and removed request for a team January 13, 2025 17:13
@@ -97,6 +97,7 @@ func (p rangefeedFactory) Run(ctx context.Context, sink kvevent.Writer, cfg rang
if cfg.RangeObserver != nil {
rfOpts = append(rfOpts, kvcoord.WithRangeObserver(cfg.RangeObserver))
}
rfOpts = append(rfOpts, kvcoord.WithConsumerID(cfg.ConsumerID))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this have a != 0 check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default value should be zero, so setting it shouldn't make a difference

var cfg rangeFeedConfig
for _, opt := range opts {
opt.set(&cfg)
}
. It matches with what DR is doing as well
rangefeedOpts = append(rangefeedOpts, kvcoord.WithConsumerID(f.consumerID))
. How do you feel about it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd still be nice to not pass the functional option if we know it's not going to have an effect but no strong feelings either way.

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Thanks :D Sorry about that.

@wenyihu6
Copy link
Contributor Author

TFTR!

bors r=andyyang890, stevendanna

@craig craig bot merged commit 2857e2b into cockroachdb:master Jan 14, 2025
22 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants