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_stream_load_err_log_limit" , " p0" ) {
19
+ sql " show tables"
20
+
21
+ def tableName = " test_stream_load_err_log_limit_table"
22
+
23
+ sql """ DROP TABLE IF EXISTS ${ tableName} """
24
+ sql """
25
+ CREATE TABLE IF NOT EXISTS ${ tableName} (
26
+ `k1` int NOT NULL,
27
+ `k2` varchar(20) NOT NULL
28
+ ) ENGINE=OLAP
29
+ DUPLICATE KEY(`k1`)
30
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 3
31
+ PROPERTIES ("replication_allocation" = "tag.location.default: 1");
32
+ """
33
+
34
+ def backendId_to_backendIP = [:]
35
+ def backendId_to_backendHttpPort = [:]
36
+ getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort);
37
+
38
+ def set_be_param = { paramName , paramValue ->
39
+ for (String id in backendId_to_backendIP. keySet()) {
40
+ def beIp = backendId_to_backendIP. get(id)
41
+ def bePort = backendId_to_backendHttpPort. get(id)
42
+ def (code, out, err) = curl(" POST" , String . format(" http://%s:%s/api/update_config?%s=%s" , beIp, bePort, paramName, paramValue))
43
+ assertTrue (out. contains(" OK" ))
44
+ }
45
+ }
46
+
47
+ try {
48
+ set_be_param. call(" load_error_log_limit_bytes" , " 100" )
49
+
50
+ streamLoad {
51
+ table " ${ tableName} "
52
+ set ' column_separator' , ' ,'
53
+ set ' columns' , ' k1, k2, k3'
54
+ file ' test_stream_load_err_log_limit.csv'
55
+
56
+ check { result , exception , startTime , endTime ->
57
+ if (exception != null ) {
58
+ throw exception
59
+ }
60
+ log. info(" Stream load result: ${ result} " . toString())
61
+ def json = parseJson(result)
62
+ def (code, out, err) = curl(" GET" , json.ErrorURL )
63
+ log. info(" error result: " + out)
64
+ def checkError = out. contains(" error log is too long" )
65
+ assertTrue (checkError)
66
+ log. info(" url: " + json.ErrorURL )
67
+ }
68
+ }
69
+ } finally {
70
+ set_be_param. call(" load_error_log_limit_bytes" , " 209715200" )
71
+ }
72
+
73
+ sql " sync"
74
+ qt_sql " select count(*) from ${ tableName} "
75
+ sql """ DROP TABLE IF EXISTS ${ tableName} """
76
+ }
0 commit comments