Skip to content

Commit

Permalink
update 4
Browse files Browse the repository at this point in the history
Signed-off-by: liuyehcf <[email protected]>
  • Loading branch information
liuyehcf committed Oct 30, 2023
1 parent f8bb94c commit c9dc0c8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void register() {
public static void init(ConnectContext context, Mode mode, String moduleStr) {
Tracers tracers = THREAD_LOCAL.get();
boolean enableProfile =
context.getSessionVariable().isEnableProfile() || context.getSessionVariable().isEnableRuntimeProfile();
context.getSessionVariable().isEnableProfile() || context.getSessionVariable().isEnableBigQueryProfile();
boolean checkMV = context.getSessionVariable().isEnableMaterializedViewRewriteOrError();

Module module = getTraceModule(moduleStr);
Expand Down
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/com/starrocks/qe/ConnectContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,11 @@ public boolean isProfileEnabled() {
if (sessionVariable.isEnableProfile()) {
return true;
}
if (!sessionVariable.isEnableRuntimeProfile()) {
if (!sessionVariable.isEnableBigQueryProfile()) {
return false;
}
return System.currentTimeMillis() - getStartTime() >
1000L * sessionVariable.getRuntimeProfileReportInterval();
1000L * sessionVariable.getBigQueryProfileSecondThreshold();
}

public boolean needMergeProfile() {
Expand Down
20 changes: 14 additions & 6 deletions fe/fe-core/src/main/java/com/starrocks/qe/SessionVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public class SessionVariable implements Serializable, Writable, Cloneable {
public static final String PROFILE_LIMIT_FOLD = "profile_limit_fold";
public static final String PIPELINE_PROFILE_LEVEL = "pipeline_profile_level";
public static final String ENABLE_ASYNC_PROFILE = "enable_async_profile";
public static final String ENABLE_RUNTIME_PROFILE = "enable_runtime_profile";

public static final String RESOURCE_GROUP_ID = "workgroup_id";
public static final String RESOURCE_GROUP_ID_V2 = "resource_group_id";
Expand Down Expand Up @@ -462,6 +461,8 @@ public static MaterializedViewRewriteMode parse(String str) {
public static final String BIG_QUERY_LOG_CPU_SECOND_THRESHOLD = "big_query_log_cpu_second_threshold";
public static final String BIG_QUERY_LOG_SCAN_BYTES_THRESHOLD = "big_query_log_scan_bytes_threshold";
public static final String BIG_QUERY_LOG_SCAN_ROWS_THRESHOLD = "big_query_log_scan_rows_threshold";
public static final String ENABLE_BIG_QUERY_PROFILE = "enable_big_query_profile";
public static final String BIG_QUERY_PROFILE_SECOND_THRESHOLD = "big_query_profile_second_threshold";

public static final String SQL_DIALECT = "sql_dialect";

Expand Down Expand Up @@ -847,8 +848,11 @@ public static MaterializedViewRewriteMode parse(String str) {
@VariableMgr.VarAttr(name = ENABLE_ASYNC_PROFILE, flag = VariableMgr.INVISIBLE)
private boolean enableAsyncProfile = true;

@VariableMgr.VarAttr(name = ENABLE_RUNTIME_PROFILE)
private boolean enableRuntimeProfile = false;
@VariableMgr.VarAttr(name = ENABLE_BIG_QUERY_PROFILE)
private boolean enableBigQueryProfile = false;

@VariableMgr.VarAttr(name = BIG_QUERY_PROFILE_SECOND_THRESHOLD)
private int bigQueryProfileSecondThreshold = 30;

@VariableMgr.VarAttr(name = RESOURCE_GROUP_ID, alias = RESOURCE_GROUP_ID_V2,
show = RESOURCE_GROUP_ID_V2, flag = VariableMgr.INVISIBLE)
Expand Down Expand Up @@ -1654,8 +1658,12 @@ public void setEnableLoadProfile(boolean enableLoadProfile) {
this.enableLoadProfile = enableLoadProfile;
}

public boolean isEnableRuntimeProfile() {
return enableRuntimeProfile;
public boolean isEnableBigQueryProfile() {
return enableBigQueryProfile;
}

public int getBigQueryProfileSecondThreshold() {
return bigQueryProfileSecondThreshold;
}

public int getWaitTimeoutS() {
Expand Down Expand Up @@ -2782,7 +2790,7 @@ public TQueryOptions toThrift() {
// Avoid integer overflow
tResult.setQuery_timeout(Math.min(Integer.MAX_VALUE / 1000, queryTimeoutS));
tResult.setQuery_delivery_timeout(Math.min(Integer.MAX_VALUE / 1000, queryDeliveryTimeoutS));
tResult.setEnable_profile(enableProfile || enableRuntimeProfile);
tResult.setEnable_profile(enableProfile || enableBigQueryProfile);
tResult.setRuntime_profile_report_interval(runtimeProfileReportInterval);
tResult.setBatch_size(chunkSize);
tResult.setLoad_mem_limit(loadMemLimit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static JobSpec fromQuerySpec(ConnectContext context,
.enableStreamPipeline(false)
.isBlockQuery(false)
.needReport(context.getSessionVariable().isEnableProfile() ||
context.getSessionVariable().isEnableRuntimeProfile())
context.getSessionVariable().isEnableBigQueryProfile())
.queryGlobals(queryGlobals)
.queryOptions(queryOptions)
.commonProperties(context)
Expand Down

0 comments on commit c9dc0c8

Please sign in to comment.