Skip to content

Commit 81246f0

Browse files
committed
[fix](load) fix s3 load check failed when no source file found
1 parent 5e98aad commit 81246f0

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

fe/fe-core/src/main/java/org/apache/doris/load/loadv2/BrokerLoadPendingTask.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ protected void getAllFileStatus() throws UserException {
131131
groupNum, entry.getKey(), callback.getCallbackId(),
132132
brokerDesc.getStorageType() == StorageBackend.StorageType.BROKER
133133
? BrokerUtil.getAddress(brokerDesc) : brokerDesc.getStorageType());
134+
throw new UserException("No source files found in the specified paths: "
135+
+ fileGroup.getFilePaths());
134136
}
135137
groupNum++;
136138
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
suite("test_s3_load_with_no_file", "load_p0") {
19+
def tableName = "tbl_with_no_file"
20+
21+
sql """ DROP TABLE IF EXISTS ${tableName} """
22+
23+
sql """
24+
CREATE TABLE ${tableName} (
25+
user_id BIGINT NOT NULL COMMENT "用户 ID",
26+
name VARCHAR(20) COMMENT "用户姓名",
27+
age INT COMMENT "用户年龄"
28+
) DUPLICATE KEY(user_id)
29+
DISTRIBUTED BY HASH(user_id) BUCKETS 1
30+
PROPERTIES (
31+
"replication_num" = "1"
32+
)
33+
"""
34+
35+
def label = UUID.randomUUID().toString().replace("-", "0")
36+
37+
def sql_str = """
38+
LOAD LABEL $label (
39+
DATA INFILE("s3://${s3BucketName}/regression/load/data/xxxx_no_file.csv")
40+
INTO TABLE $tableName
41+
COLUMNS TERMINATED BY ","
42+
)
43+
WITH S3 (
44+
"AWS_ENDPOINT" = "${getS3Endpoint()}",
45+
"PROVIDER" = "${getS3Provider()}",
46+
"AWS_ACCESS_KEY" = "${getS3AK()}",
47+
"AWS_SECRET_KEY" = "${getS3SK()}"
48+
)
49+
"""
50+
logger.info("submit sql: ${sql_str}");
51+
sql """${sql_str}"""
52+
53+
def max_try_milli_secs = 600000
54+
while (max_try_milli_secs > 0) {
55+
String[][] result = sql """ show load where label="$label" order by createtime desc limit 1; """
56+
logger.info("show load result: " + result[0])
57+
if (result[0][2].equals("FINISHED")) {
58+
logger.info("Load FINISHED " + label)
59+
assertTrue(1 == 2)
60+
break
61+
}
62+
if (result[0][2].equals("CANCELLED")) {
63+
def reason = result[0][7]
64+
logger.info("load failed, reason:$reason")
65+
assertTrue(reason.contains("No source files found"))
66+
break
67+
}
68+
Thread.sleep(1000)
69+
max_try_milli_secs -= 1000
70+
if(max_try_milli_secs <= 0) {
71+
assertTrue(1 == 2, "load Timeout: $label")
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)