diff --git a/be/src/http/action/mini_load.cpp b/be/src/http/action/mini_load.cpp index 902e9f1f187c8e..fe9a8d315f2354 100644 --- a/be/src/http/action/mini_load.cpp +++ b/be/src/http/action/mini_load.cpp @@ -777,7 +777,11 @@ Status MiniLoadAction::_on_new_header(HttpRequest* req) { } auto timeout_it = params.find(TIMEOUT_KEY); if (timeout_it != params.end()) { - ctx->timeout_second = std::stoi(timeout_it->second); + try { + ctx->timeout_second = std::stoi(timeout_it->second); + } catch (const std::invalid_argument& e) { + return Status::InvalidArgument("Invalid timeout format"); + } } LOG(INFO) << "new income mini load request." << ctx->brief() diff --git a/be/src/http/action/stream_load.cpp b/be/src/http/action/stream_load.cpp index 83e6ec8f4854b0..42e083ba36391b 100644 --- a/be/src/http/action/stream_load.cpp +++ b/be/src/http/action/stream_load.cpp @@ -238,6 +238,14 @@ Status StreamLoadAction::_on_header(HttpRequest* http_req, StreamLoadContext* ct TNetworkAddress master_addr = _exec_env->master_info()->network_address; + if (!http_req->header(HTTP_TIMEOUT).empty()) { + try { + ctx->timeout_second = std::stoi(http_req->header(HTTP_TIMEOUT)); + } catch (const std::invalid_argument& e) { + return Status::InvalidArgument("Invalid timeout format"); + } + } + // begin transaction RETURN_IF_ERROR(_exec_env->stream_load_executor()->begin_txn(ctx)); diff --git a/docs/documentation/cn/administrator-guide/load-data/stream-load-manual.md b/docs/documentation/cn/administrator-guide/load-data/stream-load-manual.md index 444fdace323dc1..550d777cc707fd 100644 --- a/docs/documentation/cn/administrator-guide/load-data/stream-load-manual.md +++ b/docs/documentation/cn/administrator-guide/load-data/stream-load-manual.md @@ -182,7 +182,9 @@ Stream load 由于使用的是 HTTP 协议,所以所有导入任务有关的 导入任务的超时时间(以秒为单位),导入任务在设定的 timeout 时间内未完成则会被系统取消,变成 CANCELLED。 - 目前 Stream load 并不支持自定义导入的 timeout 时间,所有 Stream load 导入的超时时间是统一的,默认的 timeout 时间为300秒。如果导入的源文件无法再规定时间内完成导入,则需要调整 FE 的参数```stream_load_default_timeout_second```。 + 默认的 timeout 时间为 600 秒。如果导入的源文件无法再规定时间内完成导入,用户可以在 stream load 请求中设置单独的超时时间。 + + 或者调整 FE 的参数```stream_load_default_timeout_second``` 来设置全局的默认超时时间。 ### BE 配置 diff --git a/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/MINI LOAD.md b/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/MINI LOAD.md index bd9eba4bc6c77f..71abf0d313cd46 100644 --- a/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/MINI LOAD.md +++ b/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/MINI LOAD.md @@ -54,7 +54,7 @@ max_filter_ratio: 用于指定允许过滤不规范数据的最大比例,默认是0,不允许过滤 自定义指定应该如下:'max_filter_ratio=0.2',含义是允许20%的错误率 - timeout: 指定 load 作业的超时时间,单位是秒。当load执行时间超过该阈值时,会自动取消。默认超时时间是 86400 秒。 + timeout: 指定 load 作业的超时时间,单位是秒。当load执行时间超过该阈值时,会自动取消。默认超时时间是 600 秒。 建议指定 timeout 时间小于 86400 秒。 hll: 用于指定数据里面和表里面的HLL列的对应关系,表中的列和数据里面指定的列 diff --git a/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/STREAM LOAD.md b/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/STREAM LOAD.md index e8298dae3c063f..f0309025964c82 100644 --- a/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/STREAM LOAD.md +++ b/docs/documentation/cn/sql-reference/sql-statements/Data Manipulation/STREAM LOAD.md @@ -40,6 +40,8 @@ partitions: 用于指定这次导入所设计的partition。如果用户能够确定数据对应的partition,推荐指定该项。不满足这些分区的数据将被过滤掉。 比如指定导入到p1, p2分区,-H "partitions: p1, p2" + timeout: 指定导入的超时时间。单位秒。默认是 600 秒。可设置范围为 1 秒 ~ 259200 秒。 + RETURN VALUES 导入完成后,会以Json格式返回这次导入的相关内容。当前包括一下字段 Status: 导入最后的状态。 @@ -66,8 +68,8 @@ ## example - 1. 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表,使用Label用于去重 - curl --location-trusted -u root -H "label:123" -T testData http://host:port/api/testDb/testTbl/_stream_load + 1. 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表,使用Label用于去重。指定超时时间为 100 秒 + curl --location-trusted -u root -H "label:123" -H "timeout:100" -T testData http://host:port/api/testDb/testTbl/_stream_load 2. 将本地文件'testData'中的数据导入到数据库'testDb'中'testTbl'的表,使用Label用于去重, 并且只导入k1等于20180601的数据 curl --location-trusted -u root -H "label:123" -H "where: k1=20180601" -T testData http://host:port/api/testDb/testTbl/_stream_load diff --git a/fe/src/main/java/org/apache/doris/common/Config.java b/fe/src/main/java/org/apache/doris/common/Config.java index ba3074e9063fa5..1449d4b7e8bd00 100644 --- a/fe/src/main/java/org/apache/doris/common/Config.java +++ b/fe/src/main/java/org/apache/doris/common/Config.java @@ -373,7 +373,7 @@ public class Config extends ConfigBase { * Default stream load and streaming mini load timeout */ @ConfField(mutable = true, masterOnly = true) - public static int stream_load_default_timeout_second = 600; // 300s + public static int stream_load_default_timeout_second = 600; // 600s /* * Max load timeout applicable to all type of load