lyft / presto-gateway

A load balancer / proxy / gateway for prestodb
Apache License 2.0
358 stars 156 forks source link

Add plug-able routing rule engine #62

Open puneetjaiswal opened 5 years ago

puneetjaiswal commented 5 years ago

We should supply a dummy routing rule engine that can be plugged into Routing ProxyHandler. A user should be able to override this with a custom rule engine.

theoretical-olive commented 5 years ago

Custom rule engine can be plugged at GatewayProviderModule.getProxyHandler(). The same will evaluate the rules from QueryIdProxyHandler.rewriteTarget()

puneetjaiswal commented 5 years ago

A Presto admin should be able to add/edit routing rules on the fly through an easy admin UI. These routing rules could be of following types:

  1. If user = X, route the query to xyz routing group.
  2. If source.startsWith(“etl”) then route the query to etl routing group
  3. If table = system.jdbc.columns then block the query.
  4. If query.contains (“select *”) and contains a bad table then block the query.

Also we should be able to assign an order of preference among these rule types at the time of RuleEngine instantiation.