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

docs: query cache with more settings avoid query crashes #403

Merged
merged 2 commits into from
Nov 9, 2024
Merged

Conversation

duyet
Copy link
Owner

@duyet duyet commented Nov 9, 2024

Related #400
Related #401

Summary by Sourcery

Enhance query cache configuration by adding settings for system table and nondeterministic function handling to prevent query crashes and update relevant documentation.

Enhancements:

  • Add new query cache settings 'query_cache_system_table_handling' and 'query_cache_nondeterministic_function_handling' to improve query stability.

Documentation:

  • Update documentation to include new query cache settings for system table and nondeterministic function handling.

Copy link
Contributor

sourcery-ai bot commented Nov 9, 2024

Reviewer's Guide by Sourcery

This PR enhances query caching configuration by adding additional settings to prevent query crashes. The changes include adding new query cache parameters in the ClickHouse configuration and updating the query settings in React components to handle system tables and nondeterministic functions properly.

Class diagram for updated query settings

classDiagram
    class ClickHouseSettings {
        +int use_query_cache
        +int query_cache_ttl
        +int query_cache_max_entries
        +String query_cache_system_table_handling
        +String query_cache_nondeterministic_function_handling
    }

    class ChartQueryDuration {
        +ClickHouseSettings clickhouse_settings
    }

    class CountBadge {
        +ClickHouseSettings clickhouse_settings
    }

    ClickHouseSettings <|-- ChartQueryDuration
    ClickHouseSettings <|-- CountBadge

    note for ClickHouseSettings "New settings added for system table and nondeterministic function handling"
Loading

File-Level Changes

Change Details Files
Added new query cache configuration parameters in ClickHouse settings
  • Added query_cache_system_table_handling with 'save' value
  • Added query_cache_nondeterministic_function_handling with 'save' value
README.md
docs/pages/getting-started/clickhouse-requirements.mdx
Updated React components with enhanced query cache settings
  • Added system table handling parameter to query settings
  • Added nondeterministic function handling parameter to query settings
  • Maintained existing cache TTL settings
components/charts/query-duration.tsx
components/menu/count-badge.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

vercel bot commented Nov 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clickhouse-monitoring ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 9, 2024 10:49am

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @duyet - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 1 issue found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -46,6 +46,8 @@ Suggested role for "monitoring" user must have these privileges on `system` data
<use_query_cache>1</use_query_cache>
<query_cache_ttl>50</query_cache_ttl>
<query_cache_max_entries>0</query_cache_max_entries>
Copy link
Contributor

Choose a reason for hiding this comment

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

question (bug_risk): Could you clarify if setting query_cache_max_entries to 0 is intentional?

A value of 0 might indicate unlimited entries, but it would be helpful to confirm this is the desired behavior and won't cause any memory management issues.

Comment on lines +105 to +106
<query_cache_system_table_handling>save</query_cache_system_table_handling>
<query_cache_nondeterministic_function_handling>save</query_cache_nondeterministic_function_handling>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (documentation): Consider adding brief descriptions for the new cache handling parameters

It would be helpful to document the available options for these parameters and their implications for query caching behavior.

      <!-- Options: save|skip - Controls whether queries with system tables are cached -->
      <query_cache_system_table_handling>save</query_cache_system_table_handling>
      <!-- Options: save|skip - Controls caching of queries with non-deterministic functions -->
      <query_cache_nondeterministic_function_handling>save</query_cache_nondeterministic_function_handling>

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@c090278). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #403   +/-   ##
=======================================
  Coverage        ?   78.34%           
=======================================
  Files           ?        5           
  Lines           ?      157           
  Branches        ?       58           
=======================================
  Hits            ?      123           
  Misses          ?       31           
  Partials        ?        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-commenter
Copy link

Bundle Report

Changes will increase total bundle size by 95 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
clickhouse-monitoring-bundle-server-cjs 2.37MB 95 bytes (0.0%) ⬆️

@duyet duyet merged commit 8a63aa4 into main Nov 9, 2024
22 checks passed
@duyet duyet deleted the chore/docs branch November 9, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants