Class BaseBrokerRequestHandler
- java.lang.Object
-
- org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler
-
- All Implemented Interfaces:
BrokerRequestHandler
- Direct Known Subclasses:
GrpcBrokerRequestHandler,MultiStageBrokerRequestHandler,SingleConnectionBrokerRequestHandler
@ThreadSafe public abstract class BaseBrokerRequestHandler extends Object implements BrokerRequestHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseBrokerRequestHandler.ServerStatsHelper class to pass the per server statistics.
-
Field Summary
Fields Modifier and Type Field Description protected AccessControlFactory_accessControlFactoryprotected String_brokerIdprotected org.apache.pinot.common.metrics.BrokerMetrics_brokerMetricsprotected long_brokerTimeoutMsprotected org.apache.pinot.spi.env.PinotConfiguration_configprotected QueryOptimizer_queryOptimizerprotected QueryQuotaManager_queryQuotaManagerprotected int_queryResponseLimitprotected AtomicLong_requestIdGeneratorprotected BrokerRoutingManager_routingManagerprotected org.apache.pinot.common.config.provider.TableCache_tableCache
-
Constructor Summary
Constructors Constructor Description BaseBrokerRequestHandler(org.apache.pinot.spi.env.PinotConfiguration config, String brokerId, BrokerRoutingManager routingManager, AccessControlFactory accessControlFactory, QueryQuotaManager queryQuotaManager, org.apache.pinot.common.config.provider.TableCache tableCache, org.apache.pinot.common.metrics.BrokerMetrics brokerMetrics)
-
Method Summary
Modifier and Type Method Description protected static voidaugmentStatistics(org.apache.pinot.spi.trace.RequestContext statistics, org.apache.pinot.common.response.BrokerResponse response)booleancancelQuery(long requestId, int timeoutMs, Executor executor, org.apache.commons.httpclient.HttpConnectionManager connMgr, Map<String,Integer> serverResponses)Cancel a query as identified by the queryId.Map<Long,String>getRunningQueries()org.apache.pinot.common.response.BrokerResponsehandleRequest(com.fasterxml.jackson.databind.JsonNode request, org.apache.pinot.sql.parsers.SqlNodeAndOptions sqlNodeAndOptions, RequesterIdentity requesterIdentity, org.apache.pinot.spi.trace.RequestContext requestContext)protected abstract org.apache.pinot.common.response.broker.BrokerResponseNativeprocessBrokerRequest(long requestId, org.apache.pinot.common.request.BrokerRequest originalBrokerRequest, org.apache.pinot.common.request.BrokerRequest serverBrokerRequest, org.apache.pinot.common.request.BrokerRequest offlineBrokerRequest, Map<ServerInstance,List<String>> offlineRoutingTable, org.apache.pinot.common.request.BrokerRequest realtimeBrokerRequest, Map<ServerInstance,List<String>> realtimeRoutingTable, long timeoutMs, BaseBrokerRequestHandler.ServerStats serverStats, org.apache.pinot.spi.trace.RequestContext requestContext)Processes the optimized broker requests for both OFFLINE and REALTIME table.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.broker.requesthandler.BrokerRequestHandler
handleRequest, shutDown, start
-
-
-
-
Field Detail
-
_config
protected final org.apache.pinot.spi.env.PinotConfiguration _config
-
_routingManager
protected final BrokerRoutingManager _routingManager
-
_accessControlFactory
protected final AccessControlFactory _accessControlFactory
-
_queryQuotaManager
protected final QueryQuotaManager _queryQuotaManager
-
_tableCache
protected final org.apache.pinot.common.config.provider.TableCache _tableCache
-
_brokerMetrics
protected final org.apache.pinot.common.metrics.BrokerMetrics _brokerMetrics
-
_requestIdGenerator
protected final AtomicLong _requestIdGenerator
-
_queryOptimizer
protected final QueryOptimizer _queryOptimizer
-
_brokerId
protected final String _brokerId
-
_brokerTimeoutMs
protected final long _brokerTimeoutMs
-
_queryResponseLimit
protected final int _queryResponseLimit
-
-
Constructor Detail
-
BaseBrokerRequestHandler
public BaseBrokerRequestHandler(org.apache.pinot.spi.env.PinotConfiguration config, String brokerId, BrokerRoutingManager routingManager, AccessControlFactory accessControlFactory, QueryQuotaManager queryQuotaManager, org.apache.pinot.common.config.provider.TableCache tableCache, org.apache.pinot.common.metrics.BrokerMetrics brokerMetrics)
-
-
Method Detail
-
getRunningQueries
public Map<Long,String> getRunningQueries()
- Specified by:
getRunningQueriesin interfaceBrokerRequestHandler
-
cancelQuery
public boolean cancelQuery(long requestId, int timeoutMs, Executor executor, org.apache.commons.httpclient.HttpConnectionManager connMgr, Map<String,Integer> serverResponses) throws ExceptionDescription copied from interface:BrokerRequestHandlerCancel a query as identified by the queryId. This method is non-blocking so the query may still run for a while after calling this method. This cancel method can be called multiple times.- Specified by:
cancelQueryin interfaceBrokerRequestHandler- Parameters:
requestId- the unique Id assigned to the query by the brokertimeoutMs- timeout to wait for servers to respond the cancel requestsexecutor- to send cancel requests to servers in parallelconnMgr- to provide the http connectionsserverResponses- to collect cancel responses from all servers if a map is provided- Returns:
- true if there is a running query for the given queryId.
- Throws:
Exception
-
handleRequest
public org.apache.pinot.common.response.BrokerResponse handleRequest(com.fasterxml.jackson.databind.JsonNode request, @Nullable org.apache.pinot.sql.parsers.SqlNodeAndOptions sqlNodeAndOptions, @Nullable RequesterIdentity requesterIdentity, org.apache.pinot.spi.trace.RequestContext requestContext) throws Exception- Specified by:
handleRequestin interfaceBrokerRequestHandler- Throws:
Exception
-
processBrokerRequest
protected abstract org.apache.pinot.common.response.broker.BrokerResponseNative processBrokerRequest(long requestId, org.apache.pinot.common.request.BrokerRequest originalBrokerRequest, org.apache.pinot.common.request.BrokerRequest serverBrokerRequest, @Nullable org.apache.pinot.common.request.BrokerRequest offlineBrokerRequest, @Nullable Map<ServerInstance,List<String>> offlineRoutingTable, @Nullable org.apache.pinot.common.request.BrokerRequest realtimeBrokerRequest, @Nullable Map<ServerInstance,List<String>> realtimeRoutingTable, long timeoutMs, BaseBrokerRequestHandler.ServerStats serverStats, org.apache.pinot.spi.trace.RequestContext requestContext) throws ExceptionProcesses the optimized broker requests for both OFFLINE and REALTIME table. TODO: Directly take PinotQuery- Throws:
Exception
-
augmentStatistics
protected static void augmentStatistics(org.apache.pinot.spi.trace.RequestContext statistics, org.apache.pinot.common.response.BrokerResponse response)
-
-