Skip to content

workload: add bank3 workload #4132

Draft
wk989898 wants to merge 8 commits intopingcap:masterfrom
wk989898:workload-bank
Draft

workload: add bank3 workload #4132
wk989898 wants to merge 8 commits intopingcap:masterfrom
wk989898:workload-bank

Conversation

@wk989898
Copy link
Collaborator

@wk989898 wk989898 commented Feb 4, 2026

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`.

Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 4, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 4, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 4, 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 wk989898 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 4, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @wk989898, 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 significantly enhances the workload generation tool by integrating DDL operation capabilities. It allows for more comprehensive testing scenarios by enabling concurrent DDL and DML, or isolated DDL testing. The addition of the 'bank3' workload provides a more complex schema for testing, making the tool more versatile for performance and replication validation.

Highlights

  • DDL Workload Support: Introduced the capability to run DDL (Data Definition Language) operations as part of the workload, either concurrently with DML or as a standalone workload. This includes new configuration options for DDL threads and intervals.
  • New 'bank3' Workload: Added a new workload type named 'bank3' which features a more complex, partitioned table schema and implements DDL, insert, update, and delete operations.
  • DDL Worker Implementation: A new file ddl.go was added to manage DDL worker execution, including robust connection handling, error retries, and logic to ignore specific DDL errors like duplicate index creation or dropping a non-existent index.
  • Workload Configuration and Interface Extensions: The WorkloadConfig now includes DDLThread and DDLInterval settings, and a new DDLWorkload interface was defined to allow workloads to generate DDL statements.
  • Documentation Updates: The readme.md has been updated with examples demonstrating how to run DML-only, DML + DDL, and DDL-only workloads using the new flags.

🧠 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.

Changelog
  • tools/workload/app.go
    • Added ddlConcurrency variable to manage DDL worker count.
    • Modified handleWorkloadExecution to accept ddlConcurrency and initiate executeDDLWorkers.
    • Included ddlConcurrency and ddlInterval in workload logging for better visibility.
    • Extended workload action conditions to include 'ddl' for DDL worker execution.
  • tools/workload/config.go
    • Imported the time package for duration handling.
    • Added DDLThread (int) and DDLInterval (time.Duration) fields to WorkloadConfig.
    • Initialized DDLThread to 0 and DDLInterval to 5 seconds by default.
    • Introduced command-line flags --ddl-thread and --ddl-interval for configuration.
    • Updated the --action flag description to include 'ddl' as a valid action.
    • Added validation to ensure DDLThread and DDLInterval are non-negative.
  • tools/workload/ddl.go
    • New file created to encapsulate DDL worker logic.
    • Implemented executeDDLWorkers to manage DDL concurrency and worker lifecycle.
    • Includes doDDL for executing individual DDL statements with retry mechanisms.
    • Provides sleepAfterDDL to pause between DDL operations based on DDLInterval.
    • Features executeDDL for executing SQL commands and handling specific errors.
    • Contains isIgnorableDDLError to identify and suppress common, non-critical DDL errors (e.g., duplicate index, missing index).
  • tools/workload/readme.md
    • Added a note clarifying that DML is the default behavior and DDL is disabled by default.
    • Included new usage examples for running DML-only, DML + DDL, and DDL-only workloads.
  • tools/workload/schema/bank/bank.go
    • Implemented the BuildDDLSql method to generate DDL statements for the bank workload, specifically toggling an index on col4.
  • tools/workload/schema/bank3/bank.go
    • New file defining the BankWorkload for the bank3 type.
    • Includes a createBankTable constant for a complex, partitioned table schema.
    • Implemented BuildCreateTableStatement, BuildInsertSql, BuildUpdateSql, BuildDeleteSql, and BuildDDLSql methods.
    • The BuildDDLSql method for bank3 toggles an index on col30.
    • Added helper functions getBankTableName, randomBankDatetime, and randomBankMonthRange for data generation.
  • tools/workload/schema/interface.go
    • Defined a new DDLOption struct to pass parameters for DDL generation.
    • Introduced the DDLWorkload interface, which includes the BuildDDLSql method for workloads that support DDL operations.
  • tools/workload/schema/sysbench/sysbench.go
    • Implemented the BuildDDLSql method to generate DDL statements for the sysbench workload, specifically toggling an index on k.
Activity
  • The pull request was created by wk989898.
  • The pull request introduces new DDL workload capabilities and a new 'bank3' workload type.
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.

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 DDL execution capabilities to the workload generator, which is a great feature. It adds a new DDLWorkload interface, implements it for existing workloads (bank, sysbench), and adds a new bank3 workload. The changes are well-structured.

I've left a few comments for improvement:

  • A critical bug in a for loop in ddl.go.
  • Some suggestions to improve logging consistency and error handling robustness.
  • Naming conventions in the new bank3 workload package should be improved to avoid confusion.

Additionally, the new bank3 workload is defined but not yet integrated into app.go. This will need to be done to make it usable.

wk989898 and others added 7 commits February 4, 2026 09:39
Signed-off-by: wk989898 <nhsmwk@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: wk989898 <nhsmwk@gmail.com>
Signed-off-by: wk989898 <nhsmwk@gmail.com>
Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 4, 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.

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant