Skip to content

Commit

Permalink
Embed version in scheduler stacktraces
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 10, 2024
1 parent 03f3315 commit 30575d0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class QueryExecutionMBean
private final ThreadPoolExecutorMBean executorMBean;

@Inject
public QueryExecutionMBean(@ForQueryExecution ExecutorService executor)
public QueryExecutionMBean(@QueryExecutorInternal ExecutorService executor)
{
this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) executor);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.execution;

import com.google.inject.BindingAnnotation;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Retention(RUNTIME)
@Target({FIELD, PARAMETER, METHOD})
@BindingAnnotation
public @interface QueryExecutorInternal {}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import io.trino.execution.ForQueryExecution;
import io.trino.execution.QueryExecution;
import io.trino.execution.QueryExecutionMBean;
import io.trino.execution.QueryExecutorInternal;
import io.trino.execution.QueryIdGenerator;
import io.trino.execution.QueryManager;
import io.trino.execution.QueryManagerConfig;
Expand Down Expand Up @@ -105,6 +106,7 @@
import io.trino.server.remotetask.RemoteTaskStats;
import io.trino.server.ui.WebUiModule;
import io.trino.server.ui.WorkerResource;
import io.trino.spi.VersionEmbedder;
import io.trino.spi.memory.ClusterMemoryPoolManager;
import io.trino.sql.PlannerContext;
import io.trino.sql.analyzer.AnalyzerFactory;
Expand Down Expand Up @@ -141,6 +143,7 @@
import static io.airlift.json.JsonCodecBinder.jsonCodecBinder;
import static io.airlift.units.DataSize.Unit.MEGABYTE;
import static io.trino.server.InternalCommunicationHttpClientModule.internalHttpClientModule;
import static io.trino.util.Executors.decorateWithVersion;
import static java.util.concurrent.Executors.newCachedThreadPool;
import static java.util.concurrent.Executors.newScheduledThreadPool;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
Expand Down Expand Up @@ -379,7 +382,7 @@ public static ResourceGroupManager<?> getResourceGroupManager(@SuppressWarnings(

@Provides
@Singleton
@ForQueryExecution
@QueryExecutorInternal
public static ExecutorService createQueryExecutor(QueryManagerConfig queryManagerConfig)
{
ThreadPoolExecutor queryExecutor = new ThreadPoolExecutor(
Expand All @@ -392,6 +395,14 @@ public static ExecutorService createQueryExecutor(QueryManagerConfig queryManage
return queryExecutor;
}

@Provides
@Singleton
@ForQueryExecution
public static ExecutorService createQueryExecutor(@QueryExecutorInternal ExecutorService queryExecutor, VersionEmbedder versionEmbedder)
{
return decorateWithVersion(queryExecutor, versionEmbedder);
}

@Provides
@Singleton
public static QueryPerformanceFetcher createQueryPerformanceFetcher(QueryManager queryManager)
Expand Down

0 comments on commit 30575d0

Please sign in to comment.