Skip to content

Support Backend Cluster Based Pinning #789

@Peiyingy

Description

@Peiyingy

Background

Currently, routing rules in Trino Gateway only support directing traffic to a routing group. In environments where a routing group contains multiple backend clusters, there’s no straightforward way to route queries to a specific backend when needed (for example, for testing, debugging, or gradual rollout purposes). Currently, the only workaround would be registering a cluster multiple times under different routing groups, which is really hacky and complicates configuration management.

Supporting direct routing to a backend cluster would provide finer control and flexibility in query distribution without requiring redundant backend registrations or workarounds.

Proposal

Extend the routing rule framework to allow rules to specify either:

  • routingGroup or
  • backendCluster

We can still rely on the priority mechanism to determine which setting takes precedence when both are defined. This feature would enable targeted query routing to a specific backend cluster while maintaining compatibility with the existing routing group based design.


Example YAML rule

---
name: "user1_pinning_rule"
description: "Pin user1 directly to adhoc01 backend"
priority: 1
condition: "request.getHeader(\"X-Trino-User\") == \"user1\""
actions:
  - "result.put(\"backendCluster\", \"adhoc01\")"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions