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 18 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 two new optional configuration options: parameters.innodb_buffer_pool_size and mariadb_server_args for enhanced server control and performance optimization.
    • Updated version to 2.7.2, providing greater flexibility in MariaDB server parameters.
  • Documentation

    • Enhanced documentation with detailed guidance on the new configuration options and their 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 and added mariadb_server_args for additional configuration flexibility.

Copy link
Contributor

coderabbitai bot commented Sep 15, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request update the MariaDB add-on to version 2.7.2, introducing new optional configuration parameters, parameters.innodb_buffer_pool_size and mariadb_server_args, which allow users to adjust server settings. These enhancements aim 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 and mariadb_server_args.
mariadb/config.yaml Updated version to 2.7.2, added innodb_buffer_pool_size: 128M in options, defined it in schema, and added mariadb_server_args.
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)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c1a4ef and 42d9520.

📒 Files selected for processing (1)
  • mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run

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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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=#).

mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run Outdated Show resolved Hide resolved
@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)
`

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

🧹 Outside diff range and nitpick comments (2)
mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run (1)

16-16: Execution command looks good, consider adding quotes for robustness.

The modified execution command correctly incorporates the additional arguments into the MariaDB startup process. The use of exec is appropriate for process management in this context.

For improved robustness, consider quoting the ${MARIADB_DATA} variable:

exec mysqld --datadir="${MARIADB_DATA}" --user=root "${extra_args[@]}" < /dev/null

This ensures correct handling of the data directory path even if it contains spaces or special characters.

mariadb/DOCS.md (1)

77-83: Improve clarity and formatting in the new section.

The new section on mariadb_server_args is informative but could be improved for clarity and adherence to guidelines:

  1. Use bold for UI strings:
    Change "Option: mariadb_server_args (optional)" to "Option: mariadb_server_args (optional)"

  2. Be more direct in the instruction:
    Change "Defining the recommended parameters can help if there is RAM available." to "Define the recommended parameters if sufficient RAM is available."

  3. Provide more context for the example:
    Add a brief explanation of what the example parameter does.

Apply these changes to improve the section:

-### Option: `mariadb_server_args` (optional)
+### Option: **mariadb_server_args** (optional)

 Some users have experienced [errors][migration-issues] during Home Assistant schema updates on large databases.
-Defining the recommended parameters can help if there is RAM available.
+Define the recommended parameters if sufficient RAM is available.

-Example: `--innodb_buffer_pool_size=512M`
+Example: `--innodb_buffer_pool_size=512M` (Increases the InnoDB buffer pool size to 512 MB)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 98e04aa and 5ea053b.

📒 Files selected for processing (3)
  • mariadb/DOCS.md (2 hunks)
  • mariadb/config.yaml (2 hunks)
  • mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
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.

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.

🔇 Additional comments (3)
mariadb/config.yaml (2)

2-2: Version bump to 2.7.2

The version update from 2.7.1 to 2.7.2 aligns with the PR objectives to add support for MariaDB server config parameters. This minor version increment suggests the introduction of new features or improvements without breaking changes.


41-42: New configuration option: mariadb_server_args

The addition of the mariadb_server_args option is a good implementation to address the PR objectives. It allows users to specify additional MariaDB server arguments, including the innodb_buffer_pool_size parameter.

Some considerations:

  1. The implementation is flexible, allowing for multiple arguments to be specified.
  2. Using an array of strings is a good choice for maintaining readability in the YAML configuration.
  3. The ? indicates that this option is optional, which is appropriate for advanced configuration settings.

To ensure this new option is properly integrated, let's verify its usage in the add-on script:

mariadb/DOCS.md (1)

Line range hint 77-111: LGTM with minor suggestions.

The addition of the mariadb_server_args option is a valuable improvement to the documentation. It provides users with a solution for potential schema update errors on large databases. The new section is well-placed and includes helpful context and an example.

The minor suggestions provided will further enhance clarity and adherence to documentation guidelines. Overall, this change will be beneficial for users experiencing issues with large databases during Home Assistant schema updates.

mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run Outdated Show resolved Hide resolved
mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run Outdated Show resolved Hide resolved
@danielszilagyi danielszilagyi requested a review from agners October 14, 2024 19:38
@samtygier
Copy link

Is someone able to reopen the issue #3754 ?

@danielszilagyi
Copy link
Author

Is there anything blocking the approval of this PR?

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
3 participants