mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-2174 SQL query execute timeout
This commit is contained in:
@@ -160,6 +160,10 @@ public class WebSession extends AbstractSessionPersistent implements SMSession,
|
||||
return id;
|
||||
}
|
||||
|
||||
public WebApplication getApplication() {
|
||||
return application;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicationSession() {
|
||||
return false;
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ public class WebSQLConstants {
|
||||
public static final String QUOTA_PROP_ROW_LIMIT = "sqlResultSetRowsLimit";
|
||||
public static final String QUOTA_PROP_MEMORY_LIMIT = "sqlResultSetMemoryLimit";
|
||||
public static final String QUOTA_PROP_QUERY_LIMIT = "sqlMaxRunningQueries";
|
||||
public static final String QUOTA_PROP_SQL_QUERY_TIMEOUT = "sqlQueryTimeout";
|
||||
public static final String QUOTA_PROP_TEXT_PREVIEW_MAX_LENGTH = "sqlTextPreviewMaxLength";
|
||||
public static final String QUOTA_PROP_BINARY_PREVIEW_MAX_LENGTH = "sqlBinaryPreviewMaxLength";
|
||||
public static final String QUOTA_PROP_RM_FILE_SIZE_LIMIT = "resourceManagerFileSizeLimit";
|
||||
|
||||
+17
@@ -180,6 +180,7 @@ public class WebSQLProcessor implements WebSessionProvider {
|
||||
session.getExecutionContext(),
|
||||
WebSQLProcessor.this,
|
||||
sqlQuery);
|
||||
|
||||
try (DBCStatement dbStat = DBUtils.makeStatement(
|
||||
source,
|
||||
session,
|
||||
@@ -188,6 +189,22 @@ public class WebSQLProcessor implements WebSessionProvider {
|
||||
webDataFilter.getOffset(),
|
||||
webDataFilter.getLimit()))
|
||||
{
|
||||
// Set query timeout
|
||||
int queryTimeout = (int) session.getDataSource().getContainer().getPreferenceStore()
|
||||
.getDouble(WebSQLConstants.QUOTA_PROP_SQL_QUERY_TIMEOUT);
|
||||
if (queryTimeout <= 0) {
|
||||
queryTimeout = CommonUtils.toInt(
|
||||
getWebSession().getApplication().getAppConfiguration()
|
||||
.getResourceQuota(WebSQLConstants.QUOTA_PROP_SQL_QUERY_TIMEOUT));
|
||||
}
|
||||
if (queryTimeout > 0) {
|
||||
try {
|
||||
dbStat.setStatementTimeout(queryTimeout);
|
||||
} catch (Throwable e) {
|
||||
log.debug("Can't set statement timeout:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasResultSet = dbStat.executeStatement();
|
||||
fillQueryResults(contextInfo, dataContainer, dbStat, hasResultSet, executeInfo, webDataFilter, dataFilter, dataFormat);
|
||||
} catch (DBException e) {
|
||||
|
||||
Reference in New Issue
Block a user