[fix](session variables) Make default value of max_execution_time same to query_timeout #28474
Current problem, UNSET global VARIABLE ALL will write an oplog, which makes query_timeout = 0 when we replay it in a future time-stamp. So we change default value of max_execution_time to 90000 which is consistent to query_timeout default value.
This commit is contained in:
@ -56,7 +56,9 @@ public class AcceptListener implements ChannelListener<AcceptingChannel<StreamCo
|
||||
// connection has been established, so need to call context.cleanup()
|
||||
// if exception happens.
|
||||
ConnectContext context = new ConnectContext(connection);
|
||||
LOG.info("Connection query timeout: {}", context.getSessionVariable().getQueryTimeoutS());
|
||||
if (context.getSessionVariable().getQueryTimeoutS() <= 0) {
|
||||
LOG.warn("Connection query timeout is invalid: {}", context.getSessionVariable().getQueryTimeoutS());
|
||||
}
|
||||
context.setEnv(Env.getCurrentEnv());
|
||||
connectScheduler.submit(context);
|
||||
|
||||
@ -79,10 +81,12 @@ public class AcceptListener implements ChannelListener<AcceptingChannel<StreamCo
|
||||
throw new AfterConnectedException("Reach limit of connections");
|
||||
}
|
||||
context.setStartTime();
|
||||
context.setUserQueryTimeout(
|
||||
context.getEnv().getAuth().getQueryTimeout(context.getQualifiedUser()));
|
||||
LOG.info("Connection set query timeout {}",
|
||||
int userQueryTimeout = context.getEnv().getAuth().getQueryTimeout(context.getQualifiedUser());
|
||||
if (userQueryTimeout <= 0) {
|
||||
LOG.warn("Connection set query timeout to {}",
|
||||
context.getSessionVariable().getQueryTimeoutS());
|
||||
}
|
||||
context.setUserQueryTimeout(userQueryTimeout);
|
||||
context.setUserInsertTimeout(
|
||||
context.getEnv().getAuth().getInsertTimeout(context.getQualifiedUser()));
|
||||
ConnectProcessor processor = new MysqlConnectProcessor(context);
|
||||
|
||||
@ -542,8 +542,9 @@ public class SessionVariable implements Serializable, Writable {
|
||||
// no MAX_EXECUTION_TIME(N) optimizer hint or for which N is 0.
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
|
||||
// So that it is == query timeout in doris
|
||||
@VariableMgr.VarAttr(name = MAX_EXECUTION_TIME, fuzzy = true, setter = "setMaxExecutionTimeMS")
|
||||
public int maxExecutionTimeMS = -1;
|
||||
@VariableMgr.VarAttr(name = MAX_EXECUTION_TIME, checker = "checkMaxExecutionTimeMSValid",
|
||||
setter = "setMaxExecutionTimeMS")
|
||||
public int maxExecutionTimeMS = 900000;
|
||||
|
||||
@VariableMgr.VarAttr(name = INSERT_TIMEOUT)
|
||||
public int insertTimeoutS = 14400;
|
||||
@ -2527,8 +2528,23 @@ public class SessionVariable implements Serializable, Writable {
|
||||
public void checkQueryTimeoutValid(String newQueryTimeout) {
|
||||
int value = Integer.valueOf(newQueryTimeout);
|
||||
if (value <= 0) {
|
||||
LOG.warn("Setting invalid query timeout {}", value, new RuntimeException(""));
|
||||
throw new UnsupportedOperationException("Query timeout must be greater than 0");
|
||||
UnsupportedOperationException exception =
|
||||
new UnsupportedOperationException(
|
||||
"query_timeout can not be set to " + newQueryTimeout + ", it must be greater than 0");
|
||||
LOG.warn("Check query_timeout failed", exception);
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkMaxExecutionTimeMSValid(String newValue) {
|
||||
int value = Integer.valueOf(newValue);
|
||||
if (value < 1000) {
|
||||
UnsupportedOperationException exception =
|
||||
new UnsupportedOperationException(
|
||||
"max_execution_time can not be set to " + newValue
|
||||
+ ", it must be greater or equal to 1000, the time unit is millisecond");
|
||||
LOG.warn("Check max_execution_time failed", exception);
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -470,7 +470,12 @@ public class VariableMgr {
|
||||
LOG.error("failed to get global variable {} when replaying", (String) varName);
|
||||
continue;
|
||||
}
|
||||
setValue(varContext.getObj(), varContext.getField(), root.get((String) varName).toString());
|
||||
try {
|
||||
setValue(varContext.getObj(), varContext.getField(), root.get((String) varName).toString());
|
||||
} catch (Exception exception) {
|
||||
LOG.warn("Exception during replay global variabl {} oplog, {}, THIS EXCEPTION WILL BE IGNORED.",
|
||||
(String) varName, exception.getMessage());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
wlock.unlock();
|
||||
|
||||
Reference in New Issue
Block a user