-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Problem
In RoutingManager.findBackendForUnknownQueryId()
, after checking all backends by issuing HEAD requests, the fallback logic is hardcoded to use the first active backend with routing_group = 'adhoc'
:
gatewayBackendManager.getActiveAdhocBackends().get(0).getProxyTo()
This breaks in trino gateway environments where no backend is designated with routing_group = 'adhoc'
, because:
-
getActiveAdhocBackends()
executes:SELECT * FROM gateway_backend WHERE active = true AND routing_group = 'adhoc'
-
If no row matches, the results list is empty →
.get(0)
throwsIndexOutOfBoundsException
, causing a500 Internal Server Error
for/v1/query/{nonexistent-id}
requests.
Proposed fix
Modify the fallback logic to be more robust and generic:
- After failing to locate a backend by query ID, select fallback from any active backend, not just
adhoc
.
This ensures:
- No crash even if no
adhoc
routing_group exists - Consistent behavior across environments
Metadata
Metadata
Assignees
Labels
No labels