Class BaseBrokerRequestHandler

    • Field Detail

      • _config

        protected final org.apache.pinot.spi.env.PinotConfiguration _config
      • _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
      • _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

      • cancelQuery

        public boolean cancelQuery​(long requestId,
                                   int timeoutMs,
                                   Executor executor,
                                   org.apache.commons.httpclient.HttpConnectionManager connMgr,
                                   Map<String,​Integer> serverResponses)
                            throws Exception
        Description copied from interface: BrokerRequestHandler
        Cancel 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:
        cancelQuery in interface BrokerRequestHandler
        Parameters:
        requestId - the unique Id assigned to the query by the broker
        timeoutMs - timeout to wait for servers to respond the cancel requests
        executor - to send cancel requests to servers in parallel
        connMgr - to provide the http connections
        serverResponses - 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:
        handleRequest in interface BrokerRequestHandler
        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 Exception
        Processes 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)