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

Add support for mariadb server config parameter #3763

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

danielszilagyi
Copy link

@danielszilagyi danielszilagyi commented Sep 15, 2024

Fixes #3754

Summary by CodeRabbit

  • New Features

    • Introduced a new optional configuration option: parameters.innodb_buffer_pool_size for improved server control.
    • Updated version to 2.7.2, enhancing flexibility in MariaDB server parameters.
  • Documentation

    • Enhanced documentation with guidance on the new innodb_buffer_pool_size option and its implications for Home Assistant schema updates.
  • Configuration Changes

    • Updated config.yaml to include the new parameter innodb_buffer_pool_size with a default value of 128M.

Copy link
Contributor

coderabbitai bot commented Sep 15, 2024

Walkthrough

Walkthrough

The changes in this pull request update the MariaDB add-on to version 2.7.2, introducing a new optional configuration parameter, parameters.innodb_buffer_pool_size, which allows users to adjust the InnoDB buffer pool size. This enhancement aims to address issues encountered during Home Assistant schema updates, particularly for users with large databases. The documentation and configuration files have been updated accordingly to reflect these changes.

Changes

Files Change Summary
mariadb/CHANGELOG.md, mariadb/DOCS.md Added new version 2.7.2 with optional configuration for parameters.innodb_buffer_pool_size.
mariadb/config.yaml Updated version to 2.7.2, added innodb_buffer_pool_size: 128M in options and defined it in schema.
mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run Modified startup script to dynamically include command line parameters from configuration.

Assessment against linked issues

Objective Addressed Explanation
Add option to persistently configure innodb_buffer_pool_size via UI (3754)

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>, please review it.
    -- 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 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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

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: 1

Outside diff range and nitpick comments (2)
mariadb/config.yaml (1)

26-27: Approve the addition of the innodb_buffer_pool_size parameter.

The addition of the innodb_buffer_pool_size parameter aligns with the PR objective and will allow users to optimize the performance of their MariaDB database by adjusting the buffer pool size. The default value of 128M is a reasonable starting point, but users with larger databases may need to adjust this value based on their specific requirements.

Consider adding guidance in the documentation to help users determine the appropriate value for their use case. Factors to consider include:

  • The size of the database
  • The available memory on the system
  • The expected workload and query patterns

Additionally, ensure that the documentation clearly explains the impact of this parameter on performance and provides instructions for monitoring and adjusting the value as needed.

Also applies to: 43-44

mariadb/DOCS.md (1)

79-79: Explanation looks good! Consider a minor rephrasing.

The explanation provides clear context and rationale for introducing the new parameters.innodb_buffer_pool_size parameter. It helpfully mentions the RAM availability caveat and includes a reference link to the related migration issues.

Consider rephrasing the first sentence slightly to improve clarity:

-During Home Assistant schema updates some people experienced [errors][migration-issues] on large databases.
+Some users have experienced [errors][migration-issues] during Home Assistant schema updates on large databases.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1bb2ba9 and d858279.

Files selected for processing (4)
  • mariadb/CHANGELOG.md (1 hunks)
  • mariadb/DOCS.md (2 hunks)
  • mariadb/config.yaml (3 hunks)
  • mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run (1 hunks)
Additional context used
Path-based instructions (3)
mariadb/config.yaml (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

mariadb/CHANGELOG.md (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

mariadb/DOCS.md (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

Markdownlint
mariadb/CHANGELOG.md

5-5: null
Bare URL used

(MD034, no-bare-urls)

Additional comments not posted (6)
mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run (4)

7-8: LGTM!

Initializing an empty string to hold the concatenated parameters is a good approach. The variable name param_string clearly conveys its purpose.


10-15: LGTM!

The code segment correctly fetches the parameters using bashio::config and processes them with a while loop. The format --parameter is a common convention for command line parameters.


17-17: LGTM!

Removing the trailing whitespace from param_string using sed is a good practice to ensure clean and consistent strings.


20-22: LGTM!

The changes to the logging statement and the execution command for mysqld are beneficial:

  • Including the command line parameters in the logging statement enhances visibility into the startup process.
  • Modifying the execution command to include param_string allows for greater flexibility in the service's configuration at runtime.
mariadb/config.yaml (1)

2-2: LGTM!

The version update to 2.7.2 aligns with the PR objective and is expected to be backward compatible.

mariadb/DOCS.md (1)

77-78: LGTM!

The new optional configuration parameter parameters.innodb_buffer_pool_size is introduced correctly without breaking existing configurations. The parameter name is clear and follows the existing naming convention.

mariadb/CHANGELOG.md Outdated Show resolved Hide resolved
@danielszilagyi
Copy link
Author

@coderabbitai review

Copy link
Author

@danielszilagyi danielszilagyi left a comment

Choose a reason for hiding this comment

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

Hello @agners
I saw that you were the last committer in the MariaDB addon, I'm not sure if anything else is to be done with this pull request for acceptance? The recommended edits by CodeRabbit were pushed, but seems there is no update to the PR.

Copy link
Member

@agners agners left a comment

Choose a reason for hiding this comment

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

Hm, I see you came up with a somewhat generic approach, which is kinda interesting.

Does this work really? I wonder since the options according to mysqld --help --verbose uses dashes and a equal sign (--innodb-buffer-pool-size=#).

@@ -4,7 +4,19 @@
# Start MariaDB service
# ==============================================================================

# Initialize an empty string to hold the concatenated parameters
param_string=""
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be an array? I wonder if your approach of simply concatenating parameters would work with an argument which contains spaces.

Copy link
Author

Choose a reason for hiding this comment

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

I do not have any more parameters in mind that should be adjustable as this was seemingly the one that caused the migration issues.

Copy link
Author

Choose a reason for hiding this comment

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

The conversion to the required format is done in line 15

@danielszilagyi
Copy link
Author

Hm, I see you came up with a somewhat generic approach, which is kinda interesting.

Does this work really? I wonder since the options according to mysqld --help --verbose uses dashes and a equal sign (--innodb-buffer-pool-size=#).

It worked in dev container:

[19:24:05] INFO: Starting MariaDB with command line parameters: --innodb_buffer_pool_size=512M

116 root      0:11 mysqld --datadir=/data/databases --user=root --innodb_buffer_pool_size=512M

MariaDB [(none)]> show variables like '%innodb_buffer_pool_size%';
+-------------------------+-----------+
| Variable_name           | Value     |
+-------------------------+-----------+
| innodb_buffer_pool_size | 536870912 |
+-------------------------+-----------+
1 row in set (0.006 sec)
`

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

Successfully merging this pull request may close these issues.

MariaDB: Add option to persistently configure innodb_buffer_pool_size via UI
2 participants