Skip to content

feat(allocation_policies): pardon rejections when the cluster is idle - #8431

Open
pbhandari wants to merge 4 commits into
masterfrom
feat/dynamic-allocation-policies
Open

feat(allocation_policies): pardon rejections when the cluster is idle#8431
pbhandari wants to merge 4 commits into
masterfrom
feat/dynamic-allocation-policies

Conversation

@pbhandari

@pbhandari pbhandari commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Linear: EAP-692

Summary

When the cluster is idle, pardon allocation-policy rejections (can_run=False) so the query still runs. Policies stay attached; we still record what they would have done.

Idle = cluster_load < T_load and concurrent_queries < T_conc. Missing/stale loadinfo (-1) is not idle.

Off by default:

  • storage_routing.enable_get_cluster_loadinfo (existing kill switch, still false)
  • storage_routing.idle_cluster_load_threshold default 0
  • storage_routing.idle_concurrent_queries_threshold default 0

A pardoned rejector gets can_run=True, max_threads=MAX_THRESHOLD, max_bytes_to_read=0. Caps from policies that already allowed are unchanged.

Applies to classic db_query (query’s storage set) and RPC routing (still EAP default get_cluster_loadinfo()).

Notes

  • is_pardonable is currently always True (not an automator knob yet).
  • Classic first-reject break is unchanged: if the first rejector is pardoned, later policies still run.
  • Observability: allocation_policy.db_request_pardoned + explanation["idle_pardon"] with loadinfo.

Testing

  • tests/query/allocation_policies/test_allocation_policy_base.py
  • tests/web/test_db_query.py
  • tests/web/rpc/v1/test_storage_routing.py
  • tests/web/rpc/v1/routing_strategies/test_cluster_loadinfo.py

@pbhandari
pbhandari force-pushed the feat/dynamic-allocation-policies branch from 88e896e to ae1a2d8 Compare September 8, 2026 17:51
@pbhandari
pbhandari marked this pull request as ready for review September 8, 2026 17:51
@pbhandari
pbhandari requested review from a team as code owners September 8, 2026 17:51

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ae1a2d8. Configure here.

"type": "boolean",
"default": false,
"description": "When true, the storage routing strategy fetches ClickHouse cluster load info to inform routing decisions."
"description": "When true, the storage routing strategy fetches ClickHouse cluster load info to inform routing decisions. Also the kill switch for idle allocation-policy pardons."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Idle pardon options missing from schema

High Severity

is_idle reads storage_routing.idle_cluster_load_threshold and storage_routing.idle_concurrent_queries_threshold, but those keys are not declared in the snuba sentry-options schema. get_option then always falls back to 0, so cluster_load &lt; 0 and concurrent_queries &lt; 0 never hold for real loadinfo, and the idle pardon path cannot be enabled.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ae1a2d8. Configure here.

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.

1 participant