Skip to content

Conversation

@3AceShowHand
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jan 13, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 13, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tenfyzhong for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 13, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @3AceShowHand, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a mechanism to enhance the dynamic stream's batching performance by allowing individual sinks to report their optimal batch sizes, both in terms of event count and byte volume. This change provides greater flexibility and efficiency in how data is processed and delivered to various downstream targets, especially benefiting cloud storage operations with byte-aware batching.

Highlights

  • Interface Extension for Batching: The Sink interface has been extended to include BatchCount() and BatchBytes() methods, enabling dynamic stream components to query the preferred batching characteristics of different downstream sinks.
  • Configurable Batching per Sink Type: Implementations for BatchCount() and BatchBytes() have been added to various sink types, including blackhole, cloudstorage, kafka, mysql, and pulsar, allowing each sink to define its specific batching behavior.
  • Byte-based Batching for Cloud Storage: The cloudstorage sink now utilizes its FileSize configuration for BatchBytes(), facilitating byte-based batching which is particularly relevant for optimizing cloud storage writes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces BatchCount() and BatchBytes() methods to the Sink interface, aiming to allow dynamicstream to configure batching. The implementations for various sinks are provided. While the goal is to make batching configurable, most implementations currently use hardcoded values. I assume this is a first step and configurability will be added in a subsequent change. My review includes suggestions to improve maintainability by replacing magic numbers with constants, fixing a typo, and addressing inconsistencies in batch size definitions.

Comment on lines +557 to +559
func (s *sink) BatchCount() int {
return 4096
}

Choose a reason for hiding this comment

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

high

This method returns a hardcoded value of 4096, but the existing batchSize constant in this file is 2048. This inconsistency can be confusing and may lead to suboptimal batching behavior. It would be better to use the existing batchSize constant. If 4096 is intentional, a comment explaining the difference is needed.

Suggested change
func (s *sink) BatchCount() int {
return 4096
}
func (s *sink) BatchCount() int {
return batchSize
}

Comment on lines +542 to +544
func (s *sink) BatchCount() int {
return 4096
}

Choose a reason for hiding this comment

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

high

This method returns a hardcoded value of 4096, while the batchSize constant in this file is 2048. This inconsistency can be confusing and might affect batching efficiency. Please consider using the batchSize constant here for consistency. If 4096 is the correct value, please add a comment explaining why it differs from batchSize.

Suggested change
func (s *sink) BatchCount() int {
return 4096
}
func (s *sink) BatchCount() int {
return batchSize
}

Comment on lines +88 to +90
func (s *sink) BatchCount() int {
return 4096
}

Choose a reason for hiding this comment

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

medium

The magic number 4096 is used here and also for the size of eventCh on line 33. To improve readability and maintainability, it would be better to define this value as a named constant, for example: const defaultBatchCount = 4096.

Comment on lines +436 to +438
func (s *sink) BatchCount() int {
return 4096
}

Choose a reason for hiding this comment

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

medium

The magic number 4096 is hardcoded here. It's recommended to define it as a named constant to clarify its purpose and make it easier to manage in the future. For example: const defaultBatchCount = 4096.

Close(removeChangefeed bool)
Run(ctx context.Context) error

// BatchCount and BatchBytes are used by the dynamic stream to achive better batch performance.

Choose a reason for hiding this comment

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

medium

There's a typo in the comment. achive should be achieve.

Suggested change
// BatchCount and BatchBytes are used by the dynamic stream to achive better batch performance.
// BatchCount and BatchBytes are used by the dynamic stream to achieve better batch performance.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 13, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 13, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 13, 2026

@3AceShowHand: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-build 7a9604a link true /test pull-build
pull-build-next-gen 7a9604a link false /test pull-build-next-gen
pull-unit-test-next-gen 7a9604a link false /test pull-unit-test-next-gen
pull-unit-test 7a9604a link true /test pull-unit-test

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant