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

feature/separate-wal-storage #605

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

klinch0
Copy link
Contributor

@klinch0 klinch0 commented Jan 24, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added dedicated Write-Ahead Log (WAL) storage configuration for PostgreSQL clusters across multiple services
    • WAL storage size set to 1Gi by default
  • Version Updates

    • Updated PostgreSQL Helm chart version from 0.8.0 to 0.8.1
  • Infrastructure Changes

    • Updated Cozystack component image reference

@klinch0 klinch0 requested a review from kvaps as a code owner January 24, 2025 10:48
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 24, 2025
Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Walkthrough

This pull request introduces a consistent configuration for Write-Ahead Logging (WAL) storage across multiple PostgreSQL deployments. The changes involve adding a new walStorage parameter with a default size of 1Gi to various PostgreSQL cluster configurations in different system components, including FerretDB, monitoring tools, Keycloak, and SeaweedFS. Alongside these configuration updates, the PostgreSQL chart version has been incremented from 0.8.0 to 0.8.1, and the versions map has been updated accordingly.

Changes

File Change Summary
packages/apps/postgres/Chart.yaml Version bumped from 0.8.0 to 0.8.1
packages/apps/postgres/values.yaml Added new walSize: 1Gi parameter
packages/apps/versions_map Updated PostgreSQL version references
Multiple PostgreSQL template files Added walStorage: size: 1Gi configuration

Possibly related PRs

Suggested Labels

enhancement, lgtm

Suggested Reviewers

  • kvaps
  • themoriarti
  • xy2

Poem

🐰 Whiskers twitch, configs align,
WAL storage grows, a design so fine!
Gigabyte of logs, neat and clear,
PostgreSQL dancing without a fear.
A rabbit's touch, version takes flight! 🚀


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

@dosubot dosubot bot added the enhancement New feature or request label Jan 24, 2025
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

🧹 Nitpick comments (6)
packages/system/keycloak/templates/db.yaml (1)

9-10: Parameterize the new WAL storage size.

The addition of a dedicated walStorage section with a hard-coded size: 1Gi is correct and beneficial for performance. However, consider allowing this value to be overridden via Helm values if different environments have diverse storage requirements.

packages/system/seaweedfs/templates/database.yaml (1)

10-11: Align WAL storage size with environment-specific settings.

Adding a separate WAL storage is a sound approach for production reliability. Similar to the Keycloak configuration, consider making this size configurable in order to support environments that might need more or less capacity.

packages/extra/monitoring/templates/grafana/db.yaml (1)

9-10: Unify WAL storage sizing with existing Helm values.

While storage.size is controlled by .Values.grafana.db.size, the WAL storage is defined as a fixed 1Gi. For consistency, consider introducing a .Values.grafana.db.walSize parameter to align these configurations and allow flexible sizing across different deployments.

packages/extra/monitoring/templates/alerta/alerta-db.yaml (1)

13-14: Consider parameterizing the WAL storage size

While adding WAL storage configuration is good, consider making the size configurable through values for consistency with other storage parameters.

   walStorage:
-    size: 1Gi
+    size: {{ .Values.alerta.walSize | default "1Gi" }}
packages/apps/ferretdb/templates/postgres.yaml (1)

19-20: Align WAL storage configuration with main postgres template

For consistency with the main postgres template, consider parameterizing the WAL size through values.

   walStorage:
-    size: 1Gi
+    size: {{ .Values.walSize | default "1Gi" }}
packages/apps/postgres/values.yaml (1)

10-10: Add documentation for the walSize parameter

Please add parameter documentation following the existing style:

 ## @param size Persistent Volume size
 ## @param replicas Number of Postgres replicas
 ## @param storageClass StorageClass used to store the data
+## @param walSize Write-Ahead Log storage size
 ##
 external: false
 size: 10Gi
 walSize: 1Gi
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 05857b9 and 319f9ea.

📒 Files selected for processing (10)
  • packages/apps/ferretdb/templates/postgres.yaml (1 hunks)
  • packages/apps/postgres/Chart.yaml (1 hunks)
  • packages/apps/postgres/templates/db.yaml (1 hunks)
  • packages/apps/postgres/values.yaml (1 hunks)
  • packages/apps/versions_map (1 hunks)
  • packages/core/installer/values.yaml (1 hunks)
  • packages/extra/monitoring/templates/alerta/alerta-db.yaml (1 hunks)
  • packages/extra/monitoring/templates/grafana/db.yaml (1 hunks)
  • packages/system/keycloak/templates/db.yaml (1 hunks)
  • packages/system/seaweedfs/templates/database.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/apps/postgres/Chart.yaml
  • packages/core/installer/values.yaml
🔇 Additional comments (2)
packages/apps/versions_map (1)

70-71: Confirm the version references.

Switching from a HEAD pointer to a specific commit (cb7b8158) for postgres 0.8.0 and adding a new version entry 0.8.1 HEAD helps differentiate stable vs. development versions. Ensure that the new references are properly tested and that any code referencing postgres 0.8.0 or 0.8.1 is updated accordingly.

packages/apps/postgres/templates/db.yaml (1)

26-27: LGTM! Well-structured WAL storage configuration

The implementation correctly uses templating with a default value, allowing for customization while maintaining consistency.

@@ -7,6 +7,7 @@
##
external: false
size: 10Gi
walSize: 1Gi
Copy link

Choose a reason for hiding this comment

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

The name walSize may be confusing with max_wal_size, min_wal_size in postgresql.conf.

I'd go for walStorageSize here.

storage:
size: {{ required ".Values.size is required" .Values.size }}
{{- with .Values.storageClass }}
storageClass: {{ . }}
{{- end }}

walStorage:
size: 1Gi
Copy link

Choose a reason for hiding this comment

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

But default value of max_wal_size is also 1GB. This means postgresql will hit out-of-space on first full WAL file that wasn't closed by the checkpoint that occurred before the file size limit.

Max WAL file size needs to be decreased for proper operation. I'd suggest 256MB. This will allow having at least two full WALs, and also preserve some room for replica startup operations.

Ex:

  postgresql:
    parameters:
      max_wal_size: "256MB"

This is applicable here and in other places where walStorage.size was introduced.

@kvaps kvaps marked this pull request as draft January 27, 2025 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants