Github user sudheeshkatkam commented on a diff in the pull request:
https://github.com/apache/drill/pull/310#discussion_r48306314
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java ---
@@ -458,49 +467,46 @@ private void setupSortMemoryAllocations(final
PhysicalPlan plan) {
*/
private void acquireQuerySemaphore(final PhysicalPlan plan) throws
ForemanSetupException {
final OptionManager optionManager = queryContext.getOptions();
- final boolean queuingEnabled =
optionManager.getOption(ExecConstants.ENABLE_QUEUE);
- if (queuingEnabled) {
- final long queueThreshold =
optionManager.getOption(ExecConstants.QUEUE_THRESHOLD_SIZE);
- double totalCost = 0;
- for (final PhysicalOperator ops : plan.getSortedOperators()) {
- totalCost += ops.getCost();
- }
-
- final long queueTimeout =
optionManager.getOption(ExecConstants.QUEUE_TIMEOUT);
- final String queueName;
-
- try {
- @SuppressWarnings("resource")
- final ClusterCoordinator clusterCoordinator =
drillbitContext.getClusterCoordinator();
- final DistributedSemaphore distributedSemaphore;
-
- // get the appropriate semaphore
- if (totalCost > queueThreshold) {
- final int largeQueue = (int)
optionManager.getOption(ExecConstants.LARGE_QUEUE_SIZE);
- distributedSemaphore =
clusterCoordinator.getSemaphore("query.large", largeQueue);
- queueName = "large";
- } else {
- final int smallQueue = (int)
optionManager.getOption(ExecConstants.SMALL_QUEUE_SIZE);
- distributedSemaphore =
clusterCoordinator.getSemaphore("query.small", smallQueue);
- queueName = "small";
- }
+ final long queueThreshold =
optionManager.getOption(ExecConstants.QUEUE_THRESHOLD_SIZE);
+ double totalCost = 0;
+ for (final PhysicalOperator ops : plan.getSortedOperators()) {
+ totalCost += ops.getCost();
+ }
+ final long queueTimeout =
optionManager.getOption(ExecConstants.QUEUE_TIMEOUT);
+ final String queueName;
- lease = distributedSemaphore.acquire(queueTimeout,
TimeUnit.MILLISECONDS);
- } catch (final Exception e) {
- throw new ForemanSetupException("Unable to acquire slot for
query.", e);
+ try {
+ @SuppressWarnings("resource")
+ final ClusterCoordinator clusterCoordinator =
drillbitContext.getClusterCoordinator();
+ final DistributedSemaphore distributedSemaphore;
+
+ // get the appropriate semaphore
+ if (totalCost > queueThreshold) {
+ final int largeQueue = (int)
optionManager.getOption(ExecConstants.LARGE_QUEUE_SIZE);
+ distributedSemaphore =
clusterCoordinator.getSemaphore("query.large", largeQueue);
+ queueName = "large";
+ } else {
+ final int smallQueue = (int)
optionManager.getOption(ExecConstants.SMALL_QUEUE_SIZE);
+ distributedSemaphore =
clusterCoordinator.getSemaphore("query.small", smallQueue);
+ queueName = "small";
}
- if (lease == null) {
- throw UserException
- .resourceError()
- .message(
- "Unable to acquire queue resources for query within
timeout. Timeout for %s queue was set at %d seconds.",
- queueName, queueTimeout / 1000)
- .build(logger);
- }
+ recordNewState(QueryState.ENQUEUED);
--- End diff --
Since the current "state" is ENQUEUED, is this required?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---