-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Description
Description
When using file-based routing rules, the gateway executes actions for all rules whose conditions evaluate to true, rather than stopping at the first matching rule. This leads to unexpected behavior where later rules can silently overwrite the routing decisions of earlier rules.
Expected Behavior
When a rule's condition matches, its actions should be executed and rule evaluation should stop (similar to most rule engines like Drools, Easy Rules, etc.).
Actual Behavior
All rules are evaluated, and all matching rules' actions are executed in priority order. The last matching rule's routingGroup value wins.
Steps to Reproduce
- Configure routing rules:
---
name: "specific-user"
priority: 1
condition: |
request.getHeader("X-Trino-User") == "admin"
actions:
- |
result.put("routingGroup", "admin-cluster")
---
name: "default"
priority: 100
condition: "true"
actions:
- |
result.put("routingGroup", "default-cluster") - Send request with
X-Trino-User: admin - Request is routed to
default-clusterinstead ofadmin-cluster
Workaround
Make all rule conditions mutually exclusive:
condition: |
request.getHeader("X-Trino-User") != "admin" This becomes unwieldy as the number of rules grows.
Environment
- Trino Gateway version: 16
- Helm chart: trino-gateway-1.16.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels