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

chore: reduce insertion size of fuzz test #4243

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

WenyXu
Copy link
Member

@WenyXu WenyXu commented Jul 2, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

Reduce data insertion size of fuzz_insert & fuzz_insert_logical_table targets.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

Summary by CodeRabbit

  • New Features

    • Enhanced fuzz testing customization by allowing maximum values for columns, rows, tables, and actions to be set via environment variables.
  • Refactor

    • Updated multiple fuzz testing scripts to utilize a new utility function for retrieving values from environment variables, improving flexibility and consistency.
  • Chores

    • Added new constants and utility functions to support environment variable-based configurations.

@WenyXu WenyXu requested a review from a team as a code owner July 2, 2024 02:57
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Warning

Rate limit exceeded

@WenyXu has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 5 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 5544797 and 034c4de.

Walkthrough

The updates primarily involve integrating a new utility function, get_from_env_or_default_value, which fetches configuration values from environment variables or defaults them to predefined values. This function and several associated constants have been employed across various fuzz testing target files to customize parameters such as column and row limits, enhancing flexibility and robustness in fuzz tests' execution.

Changes

Files / Groups Change Summary
tests-fuzz/targets/fuzz_insert.rs Updated imports and added environment-based configuration for column and row limits.
tests-fuzz/targets/fuzz_insert_logical_table.rs Added rows to FuzzInput, environment-based tables, and rows values, and updated insert_values function.
tests-fuzz/targets/fuzz_alter_logical_table.rs Modified imports, added a new utility function and constant, and used them in arbitrary implementation.
tests-fuzz/targets/fuzz_alter_table.rs Changed column generation in generate_create_table_expr to use new utility function and environment variable.
tests-fuzz/targets/fuzz_create_table.rs Added new utility function and constant, updated FuzzInput struct to use environment-based column generation.
tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs Used new utility function for initializing fuzz testing parameters from environment variables.
tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs Updated FuzzInput to include tables field, generated number of tables based on environment variable.

Sequence Diagram(s)

  • Silent.

Poem

In the realm of fuzz, where bits do play,
We've crafted a tune for variables' sway.
With columns and rows from the env they derive,
Our tests now dance, alive, alive!
Tables and actions, dynamic, robust,
In this code-tale, our trust we entrust. 🌟🐇


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Jul 2, 2024
@WenyXu WenyXu changed the title chore: reduce size of fuzz test chore: reduce insertion size of fuzz test Jul 2, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ea081c9 and bdd4e02.

Files selected for processing (2)
  • tests-fuzz/targets/fuzz_insert.rs (1 hunks)
  • tests-fuzz/targets/fuzz_insert_logical_table.rs (3 hunks)
Additional comments not posted (4)
tests-fuzz/targets/fuzz_insert.rs (1)

67-67: LGTM!

The reduction in the upper limit of the rows range from 4096 to 2048 should help optimize the fuzz testing process by decreasing the volume of data being inserted during tests.

tests-fuzz/targets/fuzz_insert_logical_table.rs (3)

63-63: LGTM!

The addition of the rows field to the FuzzInput struct and its generation in the arbitrary implementation are consistent with the objective of reducing the data insertion size for fuzz testing.

Also applies to: 70-72


209-209: LGTM!

The addition of the rows parameter to the insert_values function aligns with the objective of reducing the data insertion size for fuzz testing.


262-263: LGTM!

The update to pass the rows parameter when calling insert_values aligns with the objective of reducing the data insertion size for fuzz testing.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.69%. Comparing base (e531326) to head (034c4de).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4243      +/-   ##
==========================================
- Coverage   84.84%   84.69%   -0.15%     
==========================================
  Files        1049     1054       +5     
  Lines      186267   186956     +689     
==========================================
+ Hits       158029   158340     +311     
- Misses      28238    28616     +378     

@WenyXu WenyXu force-pushed the chore/reduce-fuzz-test-size branch from bdd4e02 to 6d0a979 Compare July 2, 2024 03:17
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bdd4e02 and 6d0a979.

Files selected for processing (2)
  • tests-fuzz/targets/fuzz_insert.rs (1 hunks)
  • tests-fuzz/targets/fuzz_insert_logical_table.rs (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • tests-fuzz/targets/fuzz_insert.rs
  • tests-fuzz/targets/fuzz_insert_logical_table.rs

@WenyXu WenyXu marked this pull request as draft July 2, 2024 03:31
@WenyXu WenyXu force-pushed the chore/reduce-fuzz-test-size branch from 6d0a979 to 1a1087e Compare July 2, 2024 04:40
@evenyag evenyag mentioned this pull request Jul 2, 2024
3 tasks
@WenyXu WenyXu marked this pull request as ready for review July 2, 2024 06:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6d0a979 and 1a1087e.

Files selected for processing (2)
  • tests-fuzz/targets/fuzz_insert.rs (1 hunks)
  • tests-fuzz/targets/fuzz_insert_logical_table.rs (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • tests-fuzz/targets/fuzz_insert.rs
  • tests-fuzz/targets/fuzz_insert_logical_table.rs

@fengjiachun
Copy link
Collaborator

Could you explain why we need to reduce the size of data insertion? @WenyXu

@killme2008
Copy link
Contributor

It's better to be configured by environment variables, and we can configure it larger in release ci and a smaller value for every PR.

@killme2008
Copy link
Contributor

Could you explain why we need to reduce the size of data insertion? @WenyXu

Just want to speed up the CI.

@WenyXu WenyXu marked this pull request as draft July 2, 2024 07:53
@WenyXu
Copy link
Member Author

WenyXu commented Jul 2, 2024

It's better to be configured by environment variables, and we can configure it larger in release ci and a smaller value for every PR.

Good point, I'm going to add this feature.

@WenyXu WenyXu marked this pull request as ready for review July 2, 2024 11:49
@WenyXu WenyXu force-pushed the chore/reduce-fuzz-test-size branch from de66b7b to 06ed793 Compare July 2, 2024 11:49
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1a1087e and 06ed793.

Files selected for processing (9)
  • .env.example (1 hunks)
  • tests-fuzz/src/utils.rs (1 hunks)
  • tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs (2 hunks)
  • tests-fuzz/targets/fuzz_alter_logical_table.rs (2 hunks)
  • tests-fuzz/targets/fuzz_alter_table.rs (2 hunks)
  • tests-fuzz/targets/fuzz_create_table.rs (2 hunks)
  • tests-fuzz/targets/fuzz_insert.rs (2 hunks)
  • tests-fuzz/targets/fuzz_insert_logical_table.rs (4 hunks)
  • tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs (3 hunks)
Files skipped from review due to trivial changes (1)
  • .env.example
Additional comments not posted (18)
tests-fuzz/targets/fuzz_create_table.rs (2)

60-61: LGTM!

The use of get_from_env_or_default_value to retrieve GT_FUZZ_INPUT_MAX_COLUMNS with a default value of 30 is a good addition. This makes the code more flexible and configurable.


Line range hint 73-74: LGTM!

The use of get_from_env_or_default_value to retrieve GT_FUZZ_INPUT_MAX_COLUMNS with a default value of 30 is consistent with the changes made in the FuzzInput::arbitrary function. This ensures that the number of columns is configurable via an environment variable.

tests-fuzz/src/utils.rs (1)

127-136: LGTM!

The function get_from_env_or_default_value correctly retrieves a value from an environment variable or returns a default value if the environment variable is not set. This function enhances the configurability of the fuzz tests.

tests-fuzz/targets/fuzz_alter_table.rs (2)

73-74: LGTM!

The use of get_from_env_or_default_value to retrieve GT_FUZZ_INPUT_MAX_COLUMNS with a default value of 30 is a good addition. This makes the code more flexible and configurable.


43-46: LGTM!

The import statements for get_from_env_or_default_value and GT_FUZZ_INPUT_MAX_COLUMNS are correct and necessary for the changes made in the file. These imports ensure that the code can retrieve the maximum number of columns from an environment variable.

tests-fuzz/targets/fuzz_insert.rs (2)

69-72: LGTM!

The use of get_from_env_or_default_value to retrieve GT_FUZZ_INPUT_MAX_COLUMNS and GT_FUZZ_INPUT_MAX_ROWS with default values of 30 and 2048, respectively, is a good addition. This makes the code more flexible and configurable.


42-45: LGTM!

The import statements for get_from_env_or_default_value, flush_memtable, GT_FUZZ_INPUT_MAX_COLUMNS, and GT_FUZZ_INPUT_MAX_ROWS are correct and necessary for the changes made in the file. These imports ensure that the code can retrieve the maximum number of columns and rows from environment variables and perform the required operations.

tests-fuzz/targets/fuzz_alter_logical_table.rs (2)

45-48: LGTM!

The changes to import get_from_env_or_default_value and GT_FUZZ_INPUT_MAX_ALTER_ACTIONS are correct and align with the PR objective.


71-72: LGTM!

The changes to use get_from_env_or_default_value for GT_FUZZ_INPUT_MAX_ALTER_ACTIONS are correct and align with the PR objective.

tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs (3)

47-49: LGTM!

The changes to import get_from_env_or_default_value and GT_FUZZ_INPUT_MAX_TABLES are correct and align with the PR objective.


66-66: LGTM!

The addition of the tables field to the FuzzInput struct is correct and aligns with the PR objective.


73-74: LGTM!

The changes to use get_from_env_or_default_value for GT_FUZZ_INPUT_MAX_TABLES are correct and align with the PR objective.

tests-fuzz/targets/fuzz_insert_logical_table.rs (4)

46-48: LGTM!

The changes to import get_from_env_or_default_value, GT_FUZZ_INPUT_MAX_ROWS, and GT_FUZZ_INPUT_MAX_TABLES are correct and align with the PR objective.


65-65: LGTM!

The addition of the rows field to the FuzzInput struct is correct and aligns with the PR objective.


72-76: LGTM!

The changes to use get_from_env_or_default_value for GT_FUZZ_INPUT_MAX_TABLES and GT_FUZZ_INPUT_MAX_ROWS are correct and align with the PR objective.


213-213: LGTM!

The addition of the rows parameter to the insert_values function call is correct and aligns with the PR objective.

tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs (2)

54-57: LGTM!

The changes to import get_from_env_or_default_value, GT_FUZZ_INPUT_MAX_COLUMNS, GT_FUZZ_INPUT_MAX_INSERT_ACTIONS, GT_FUZZ_INPUT_MAX_ROWS, and GT_FUZZ_INPUT_MAX_TABLES are correct and align with the PR objective.


88-95: LGTM!

The changes to use get_from_env_or_default_value for GT_FUZZ_INPUT_MAX_COLUMNS, GT_FUZZ_INPUT_MAX_ROWS, GT_FUZZ_INPUT_MAX_TABLES, and GT_FUZZ_INPUT_MAX_INSERT_ACTIONS are correct and align with the PR objective.

@WenyXu WenyXu enabled auto-merge July 2, 2024 12:22
@WenyXu WenyXu force-pushed the chore/reduce-fuzz-test-size branch from 06ed793 to 5544797 Compare July 2, 2024 12:29
@WenyXu WenyXu requested a review from evenyag July 2, 2024 12:31
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 06ed793 and 5544797.

Files selected for processing (9)
  • .env.example (1 hunks)
  • tests-fuzz/src/utils.rs (1 hunks)
  • tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs (2 hunks)
  • tests-fuzz/targets/fuzz_alter_logical_table.rs (2 hunks)
  • tests-fuzz/targets/fuzz_alter_table.rs (2 hunks)
  • tests-fuzz/targets/fuzz_create_table.rs (2 hunks)
  • tests-fuzz/targets/fuzz_insert.rs (2 hunks)
  • tests-fuzz/targets/fuzz_insert_logical_table.rs (4 hunks)
  • tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs (3 hunks)
Files skipped from review as they are similar to previous changes (9)
  • .env.example
  • tests-fuzz/src/utils.rs
  • tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs
  • tests-fuzz/targets/fuzz_alter_logical_table.rs
  • tests-fuzz/targets/fuzz_alter_table.rs
  • tests-fuzz/targets/fuzz_create_table.rs
  • tests-fuzz/targets/fuzz_insert.rs
  • tests-fuzz/targets/fuzz_insert_logical_table.rs
  • tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs

@WenyXu WenyXu force-pushed the chore/reduce-fuzz-test-size branch from 5544797 to 034c4de Compare July 2, 2024 12:45
@WenyXu WenyXu added this pull request to the merge queue Jul 2, 2024
Merged via the queue into GreptimeTeam:main with commit be29e48 Jul 2, 2024
34 of 50 checks passed
@WenyXu WenyXu deleted the chore/reduce-fuzz-test-size branch July 2, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants