Class EmbeddedQueryQueue

java.lang.Object
org.apache.drill.exec.work.foreman.rm.EmbeddedQueryQueue
All Implemented Interfaces:
QueryQueue

public class EmbeddedQueryQueue extends Object implements QueryQueue
Query queue to be used in an embedded Drillbit. This queue has scope of only the one Drillbit (not even multiple Drillbits in the same process.) Primarily intended for testing, but may possibly be useful for other embedded applications.

Configuration is via config parameters (not via system options as for the distributed queue.)

drill.queue.embedded.enabled
Set to true to enable the embedded queue. But, this setting has effect only if the Drillbit is, in fact, embedded.
drill.queue.embedded.size
The number of active queries, all others queue. There is no upper limit on the number of queued entries.
drill.queue.embedded.timeout_ms
The maximum time a query will wait in the queue before failing.
  • Field Details

    • EMBEDDED_QUEUE

      public static String EMBEDDED_QUEUE
    • ENABLED

      public static String ENABLED
    • QUEUE_SIZE

      public static String QUEUE_SIZE
    • TIMEOUT_MS

      public static String TIMEOUT_MS
  • Constructor Details

  • Method Details

    • enabled

      public boolean enabled()
      Description copied from interface: QueryQueue
      Determine if the queue is enabled.
      Specified by:
      enabled in interface QueryQueue
      Returns:
      true if the query is enabled, false otherwise.
    • setMemoryPerNode

      public void setMemoryPerNode(long memoryPerNode)
      Specified by:
      setMemoryPerNode in interface QueryQueue
    • defaultQueryMemoryPerNode

      public long defaultQueryMemoryPerNode(double cost)
      Description copied from interface: QueryQueue
      Return the amount of memory per node when creating a EXPLAIN query plan. Plans to be executed should get the query memory from the lease, as the lease may adjust the default amount on a per-query basis. This means that the memory used to execute the query may differ from the amount shown in an EXPLAIN plan.
      Specified by:
      defaultQueryMemoryPerNode in interface QueryQueue
      Returns:
      assumed memory per node, in bytes, to use when creating an EXPLAIN plan
    • enqueue

      Description copied from interface: QueryQueue
      Queue a query. The method returns only when the query is admitted for execution. As a result, the calling thread may block up to the configured wait time.
      Specified by:
      enqueue in interface QueryQueue
      Parameters:
      queryId - the query ID
      cost - the cost of the query used for cost-based queueing
      Returns:
      the query lease which must be passed to #release(QueueLease) upon query completion
      Throws:
      QueryQueue.QueueTimeoutException - if the query times out waiting to be admitted.
      QueryQueue.QueryQueueException - for any other error condition.
    • close

      public void close()
      Specified by:
      close in interface QueryQueue
    • minimumOperatorMemory

      public long minimumOperatorMemory()
      Description copied from interface: QueryQueue
      Optional floor on the amount of memory assigned per operator. This ensures that operators receive a certain amount, separate from any memory slicing. This can oversubscribe node memory if used incorrectly.
      Specified by:
      minimumOperatorMemory in interface QueryQueue
      Returns:
      minimum per-operator memory, in bytes