Skip to content

Allow partial response #79014

Closed
Closed

Description

@byte-sourcerer

Company or project name

N/A

Use case

In ClickHouse clusters operating without replicas, individual shards may become unavailable or overloaded, potentially causing distributed queries to fail when encountering compromised nodes.

The current implementation provides the skip_unavailable_shards configuration parameter to silently exclude non-responsive shards from query execution. However, this mechanism lacks the capability to handle other types of shard-level errors such as TOO_MANY_SIMULTANEOUS_QUERIES, which typically indicates temporary resource constraints.

This limitation becomes particularly relevant in logging implementations and other time-series use cases where system resilience benefits from gracefully ignoring transient node failures. A more comprehensive error-handling approach could improve query continuity while maintaining data consistency across operational shards.

Describe the solution you'd like

Introduce a configuration parameter skip_failed_shards_mode (disabled by default) to enable granular control over error handling in distributed queries. This parameter accepts a comma-separated list of error codes that should be non-fatally ignored during query execution.

e.g. skip_failed_shards_mode=TOO_MANY_SIMULTANEOUS_QUERIES,MEMORY_LIMIT_EXCEEDED

Describe alternatives you've considered

No response

Additional context

No response

Version info

Activity

  1. byte-sourcerer commented on Apr 11, 2025

    @byte-sourcerer
    ContributorAuthor

    If this approach makes sense, I’d love to work on implementing it.

    Just need:

    • A quick 👍 if this aligns with CH’s direction
    • Any special considerations I should know about
  2. alexey-milovidov commented on Apr 11, 2025

    @alexey-milovidov
    Member

    Yes, this makes sense.

    Let's not allow listing every error code, but, instead, make

    skip_unavailable_shards_mode = 'unavailable' | 'unavailable_or_exception'

  3. byte-sourcerer commented on Apr 12, 2025

    @byte-sourcerer
    ContributorAuthor

    Yes, this makes sense.

    Let's not allow listing every error code, but, instead, make

    skip_unavailable_shards_mode = 'unavailable' | 'unavailable_or_exception'

    Thanks for confirming! Just to clarify:

    1. If skip_unavailable_shards_mode = 'unavailable':
    • Keep current behavior
    1. If 'unavailable_or_exception':
    • Should this skip shards for any exception?
    • Or only exceptions matching specific criteria?

    Testing strategy question:

    For multi-instance testing for this feature, any approach you recommend?

  4. alexey-milovidov commented on Apr 12, 2025

    @alexey-milovidov
    Member
    1. Yes.
    2. Any exception.

    For testing, we can use integration tests (they are in the tests/integration directory). You will find ways how to spin up a cluster with multiple nodes, and then do some operations on a particular node. The easiest way for testing will be - damage the table on one of the nodes, so it will have an incorrect structure, or something like throwIf in an ALIAS column.

  5. byte-sourcerer commented on Apr 30, 2025

    @byte-sourcerer
    ContributorAuthor

    Hi @alexey-milovidov

    Could you please spare some time to review this PR when you have a chance? Your feedback would be greatly appreciated!

    Link to PR: PR #79091

    Thank you! 😊

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions