kafka: share one claimcheck instance across encoders#5718
Conversation
📝 WalkthroughWalkthroughClaim-check ownership moves to sink setup, codec constructors accept shared instances, and encoder-level cleanup methods are removed. Kafka and codec tests update constructor calls, while claim-check closure and concurrent writes gain coverage. ChangesClaim-check lifecycle
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/test all |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@downstreamadapter/sink/pulsar/helper.go`:
- Around line 133-138: The Pulsar component setup around NewEncoderGroup and
NewEventEncoder must preserve claim-check support instead of always passing nil.
Create and retain a claim-check handler in the Pulsar component when
encoderConfig enables it, pass the same handler to both constructors, and close
it on setup failure and component shutdown; alternatively, explicitly reject
claim-check configuration for Pulsar.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8c5d2079-de1e-4c1f-b227-42287faee569
📒 Files selected for processing (19)
downstreamadapter/sink/kafka/helper.godownstreamadapter/sink/kafka/sink.godownstreamadapter/sink/kafka/sink_test.godownstreamadapter/sink/pulsar/helper.gopkg/sink/codec/avro/arvo.gopkg/sink/codec/bootstraper.gopkg/sink/codec/builder.gopkg/sink/codec/canal/canal_json_encoder.gopkg/sink/codec/canal/canal_json_encoder_test.gopkg/sink/codec/canal/canal_json_test.gopkg/sink/codec/common/encoder.gopkg/sink/codec/debezium/encoder.gopkg/sink/codec/encoder_group.gopkg/sink/codec/open/encoder.gopkg/sink/codec/open/encoder_test.gopkg/sink/codec/simple/encoder.gopkg/sink/codec/simple/encoder_test.gopkg/sink/kafka/claimcheck/claim_check.gopkg/sink/kafka/claimcheck/claim_check_test.go
💤 Files with no reviewable changes (4)
- pkg/sink/codec/common/encoder.go
- pkg/sink/codec/avro/arvo.go
- pkg/sink/codec/bootstraper.go
- pkg/sink/codec/debezium/encoder.go
|
/test all |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: asddongmen, lidezhu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/unhold |
What problem does this PR solve?
When Kafka claim-check handling is enabled, every event encoder creates its own
ClaimCheckand external storage client. Because an encoder group contains multiple encoders, the number of storage clients grows with encoder concurrency even though they all use the same configuration and storage URI.Issue Number: close #5719
What is changed and how it works?
ClaimCheckat the Kafka sink component level.Pulsar does not enable claim-check handling and continues to pass no
ClaimCheckto its encoders.Check List
Tests
Unit test
Questions
Will it cause performance regression or break compatibility?
It reduces external storage client and connection usage when Kafka claim-check is enabled. It changes exported Go encoder constructor signatures to accept a sink-owned
ClaimCheck, but does not change sink configuration, encoded message formats, or runtime protocol compatibility.Do you need to update user documentation, design documentation or monitoring documentation?
No user-facing documentation or monitoring changes are required because configuration and behavior remain unchanged.
Release note
Summary by CodeRabbit
New Features
Bug Fixes
Tests