Skip to content

Commit

Permalink
[JD][optimize](regression-test) add some custom script for regression…
Browse files Browse the repository at this point in the history
… test (apache#120)
  • Loading branch information
duanxujian authored and caiconghui1 committed Jan 18, 2024
1 parent f61fccc commit e634d17
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 51 deletions.
61 changes: 61 additions & 0 deletions regression-test/custom/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Build Step: Command Line

#####################################################################################
## deploy.sh content ##

doris_build_dir="$(cd $(dirname $0); pwd)/../.."
source "${doris_build_dir}"/regression-test/custom/doris-utils.sh

if [[ -z "${doris_build_dir}" ]]; then echo "ERROR: env doris_build_dir not set" && exit 1; fi

echo "#### Deploy Doris ####"
DORIS_HOME="${doris_build_dir}/output"
export DORIS_HOME

if [[ -z "${DORIS_HOME}/fe" ]]; then echo "ERROR: NO FE" && exit 1; fi
if [[ -z "${DORIS_HOME}/fe" ]]; then echo "ERROR: NO BE" && exit 1; fi
exit_flag=0

(
set -e
echo "#### 1. install java and mysql"
install_java8
install_mysql

echo "#### 2. start Doris EF"
if ! start_doris_fe; then echo "ERROR: Start doris fe failed." && exit 1; fi

echo "#### 3. start Doris BE"
if ! start_doris_be; then echo "ERROR: Start doris be failed." && exit 1; fi

echo "#### 4. ADD BE TO FE"
if ! add_doris_be_to_fe; then echo "ERROR: Add doris be failed." && exit 1; fi
)
exit_flag="$?"

echo "#### . check if need backup doris logs"
if [[ ${exit_flag} != "0" ]]; then
stop_doris
print_doris_fe_log
print_doris_be_log
fi

exit "${exit_flag}"
152 changes: 152 additions & 0 deletions regression-test/custom/doris-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

function install_java8() {
if [[ ! -d "${DORIS_HOME:-}" ]]; then return 1; fi
if ! java -version >/dev/null ||
[[ -z "$(find /usr/lib/jvm -maxdepth 1 -type d -name 'java-1.8*')" ]]; then
yum install java-1.8.0-openjdk -y >/dev/null
fi
JAVA_HOME="$(find /usr/lib/jvm -maxdepth 1 -type d -name 'java-1.8*' | sed -n '1p')"
export JAVA_HOME
}

function install_mysql() {
if ! mysql --version >/dev/null; then
yum install -y mysql;
fi
}

function get_doris_conf_value() {
local conf_file="$1"
local conf_key="$2"
if [[ -z "${conf_key}" ]]; then return 1; fi

local conf_value
if line="$(grep "^${conf_key}" "${conf_file}")"; then
conf_value="${line#*=}" #取第一个等号后面的子串为value
conf_value="$(echo "${conf_value}" | xargs)" #去掉前导和尾随空格
echo "${conf_value}"
return 0
else
echo "ERROR: can not find ${conf_key} in ${conf_file}"
return 1
fi
}

function set_doris_conf_value() {
local conf_file="$1"
local conf_key="$2"
local conf_value="$3"
if [[ -z "${conf_value}" ]]; then return 1; fi

local origin_conf_value
if origin_conf_value="$(get_conf_value "${conf_file}" "${conf_key}")"; then
echo "origin_conf_value is ${origin_conf_value}"
sed -i "/^${conf_key}/d" "${conf_file}"
fi
echo "${conf_key}=${conf_value}" | tee -a "${conf_file}"
}

# set -x
# get_doris_conf_value "$1" "$2"
# set_doris_conf_value "$1" "$2" "$3"

function start_doris_fe() {
install_java8
"${DORIS_HOME}"/fe/bin/start_fe.sh --daemon
install_mysql
query_port=$(get_doris_conf_value "${DORIS_HOME}"/fe/conf/fe.conf query_port)
cl="mysql -h127.0.0.1 -P${query_port} -uroot "
local i=1
while [[ $((i++)) -lt 60 ]]; do
fe_version=$(${cl} -e 'show frontends\G' 2>/dev/null | grep -i version | cut -d: -f2)
if [[ -n "${fe_version}" ]] && [[ "${fe_version}" != "NULL" ]]; then
echo "INFO: doris fe started, fe version: ${fe_version}" && return 0
else
echo "${i}/60, Wait for Frontend ready, sleep 2 seconds ..." && sleep 2
fi
done
if [[ ${i} -ge 60 ]]; then echo "ERROR: Start Doris Frontend Failed after 2 mins wait..." && return 1; fi
}

function start_doris_be() {
install_java8
sysctl -w vm.max_map_count=2000000 &&
ulimit -n 200000 &&
ulimit -c unlimited &&
swapoff -a

"${DORIS_HOME}"/be/bin/start_be.sh --daemon

sleep 2
local i=1
while [[ $((i++)) -lt 5 ]]; do
if [[ -z "$(ps -ef | grep doris_be | grep -v grep | awk '{print $2}')" ]]; then
echo "ERROR: start doris be failed." && return 1
else
sleep 2
fi
done
if [[ ${i} -ge 5 ]]; then
echo "INFO: doris be started, be version: $("${DORIS_HOME}"/be/lib/doris_be --version)"
fi
}

function add_doris_be_to_fe() {
if [[ ! -d "${DORIS_HOME:-}" ]]; then return 1; fi
install_mysql
query_port=$(get_doris_conf_value "${DORIS_HOME}"/fe/conf/fe.conf query_port)
heartbeat_service_port=$(get_doris_conf_value "${DORIS_HOME}"/be/conf/be.conf heartbeat_service_port)
cl="mysql -h127.0.0.1 -P${query_port} -uroot "
if ${cl} -e "ALTER SYSTEM ADD BACKEND '127.0.0.1:${heartbeat_service_port}';"; then echo; else echo; fi

i=1
while [[ $((i++)) -lt 60 ]]; do
if be_ready_count=$(${cl} -e 'show backends\G' | grep -c 'Alive: true') &&
[[ ${be_ready_count} -eq 1 ]]; then
echo -e "INFO: add doris be success, be version: \n$(${cl} -e 'show backends\G' | grep 'Version')" && break
else
echo 'Wait for Backends ready, sleep 2 seconds ...' && sleep 2
fi
done
if [[ ${i} -ge 60 ]]; then echo "ERROR: Add Doris Backend Failed after 2 mins wait..." && return 1; fi

# wait 10s for doris totally started, otherwize may encounter the error below,
# ERROR 1105 (HY000) at line 102: errCode = 2, detailMessage = Failed to find enough backend, please check the replication num,replication tag and storage medium.
sleep 10s
}


print_doris_fe_log() {
if [[ ! -d "${DORIS_HOME:-}" ]]; then return 1; fi
echo "WARNING: --------------------tail -n 100 ${DORIS_HOME}/fe/log/fe.out--------------------"
tail -n 100 "${DORIS_HOME}"/fe/log/fe.out
echo "WARNING: --------------------tail -n 100 ${DORIS_HOME}/fe/log/fe.log--------------------"
tail -n 100 "${DORIS_HOME}"/fe/log/fe.log
echo "WARNING: ----------------------------------------"
}

print_doris_be_log() {
if [[ ! -d "${DORIS_HOME:-}" ]]; then return 1; fi
echo "WARNING: --------------------tail -n 100 ${DORIS_HOME}/be/log/be.out--------------------"
tail -n 100 "${DORIS_HOME}"/be/log/be.out
echo "WARNING: --------------------tail -n 100 ${DORIS_HOME}/be/log/be.INFO--------------------"
tail -n 100 "${DORIS_HOME}"/be/log/be.INFO
echo "WARNING: ----------------------------------------"
}
11 changes: 4 additions & 7 deletions regression-test/pipeline/p0/conf/be.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ PPROF_TMPDIR="$DORIS_HOME/log/"
sys_log_level = INFO

# ports for admin, web, heartbeat service
be_port = 9161
webserver_port = 8141
heartbeat_service_port = 9151
brpc_port = 8161
be_port = 9060
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060

mem_limit = 90%
disable_minidump = true
Expand Down Expand Up @@ -63,16 +63,13 @@ log_buffer_level = -1
# palo_cgroups
#storage_root_path=/mnt/hdd01/doris.SSD/NON_VEC_RELEASE;/mnt/hdd01/doris.HDD/NON_VEC_RELEASE;/mnt/hdd02/doris.SSD/NON_VEC_RELEASE;/mnt/hdd02/doris.HDD/NON_VEC_RELEASE;/mnt/hdd03/doris.SSD/NON_VEC_RELEASE;/mnt/hdd03/doris.HDD/NON_VEC_RELEASE;/mnt/hdd04/doris.SSD/NON_VEC_RELEASE;/mnt/hdd04/doris.HDD/NON_VEC_RELEASE;/mnt/hdd05/doris.SSD/NON_VEC_RELEASE;/mnt/hdd05/doris.HDD/NON_VEC_RELEASE;/mnt/hdd06/doris.SSD/NON_VEC_RELEASE;/mnt/hdd06/doris.HDD/NON_VEC_RELEASE;

storage_root_path=/mnt/ssd01/cluster_storage/doris.SSD/P0/cluster1
disable_auto_compaction=true
tablet_map_shard_size=256
priority_networks=172.19.0.0/24
fragment_pool_thread_num_max=5000
enable_fuzzy_mode=true
max_depth_of_expr_tree=200
enable_set_in_bitmap_value=true
enable_feature_binlog=true
max_sys_mem_available_low_water_mark_bytes=69206016
user_files_secure_path=/
enable_merge_on_write_correctness_check=false
enable_debug_points=true
5 changes: 5 additions & 0 deletions regression-test/pipeline/p0/conf/fe.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ sys_log_level = INFO
# Default value is ${DORIS_HOME}/doris-meta
# meta_dir = ${DORIS_HOME}/doris-meta

http_port = 8030
rpc_port = 9020
query_port = 9030
edit_log_port = 9010

disable_decimalv2 = false
disable_datev1 = false
catalog_trash_expire_second=1
Expand Down
48 changes: 4 additions & 44 deletions regression-test/pipeline/p0/conf/regression-conf.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
// **Note**: default db will be create if not exist
defaultDb = "regression_test"

jdbcUrl = "jdbc:mysql://172.19.0.2:9131/?useLocalSessionState=true&allowLoadLocalInfile=true"
targetJdbcUrl = "jdbc:mysql://172.19.0.2:9131/?useLocalSessionState=true&allowLoadLocalInfile=true"
jdbcUrl = "jdbc:mysql://127.0.0.1:9030/?useLocalSessionState=true&allowLoadLocalInfile=true"
targetJdbcUrl = "jdbc:mysql://127.0.0.1:9030/?useLocalSessionState=true&allowLoadLocalInfile=true"
jdbcUser = "root"
jdbcPassword = ""

Expand All @@ -30,7 +30,7 @@ feTargetThriftAddress = "127.0.0.1:9020"
feSyncerUser = "root"
feSyncerPassword = ""

feHttpAddress = "172.19.0.2:8131"
feHttpAddress = "127.0.0.1:8030"
feHttpUser = "root"
feHttpPassword = ""

Expand All @@ -54,53 +54,13 @@ testDirectories = ""
// this groups will not be executed
excludeGroups = ""
// this suites will not be executed
excludeSuites = "test_information_schema_external,test_outfile_exception,test_digest,test_aggregate_all_functions2,test_hive_read_orc_complex_type,test_with_and_two_phase_agg,explode,test_cast_function,test_profile,test_broker_load_p2,test_spark_load,test_analyze_stats_p1,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog"
excludeSuites = "test_information_schema_external,test_outfile_exception,test_digest,test_aggregate_all_functions2,test_hive_read_orc_complex_type,test_with_and_two_phase_agg,explode,test_cast_function,test_profile,test_broker_load_p2,test_spark_load,test_analyze_stats_p1,test_refresh_mtmv,test_bitmap_filter,test_export_parquet,test_doris_jdbc_catalog,,create_table_use_partition_policy,create_table_use_policy,doris_source,double_write_schema_change,flink_connector,load,load_four_step,load_one_step,load_three_step,load_two_step,modify_replica_use_partition,spark_connector,table_modify_resouce,test_big_kv_map,test_bitmap_index_load,test_bloom_filter_hit,test_build_index,test_build_index_fault,test_delete_where_in,test_point_query_load,test_scalar_types_load,test_scalar_types_load_p2,test_unique_mow_sequence,test_unique_mow_sequence"

// this directories will not be executed
excludeDirectories = "nereids_tpcds_shape_sf100_p0,nereids_tpch_shape_sf1000_p0,nereids_tpch_shape_sf500_p0,workload_manager_p1,fault_injection_p0"

customConf1 = "test_custom_conf_value"

// for test csv with header
enableHdfs=false // set to true if hdfs is ready
hdfsFs = "hdfs://127.0.0.1:9000"
hdfsUser = "doris-test"
hdfsPasswd = ""
brokerName = "broker_name"

// broker load test config
enableBrokerLoad=true

// jdbc connector test config
// To enable jdbc test, you need first start mysql/pg container.
// See `docker/thirdparties/start-thirdparties-docker.sh`
enableJdbcTest=false
mysql_57_port=7111
pg_14_port=7121
mariadb_10_port=3326
// hive catalog test config
// To enable jdbc test, you need first start hive container.
// See `docker/thirdparties/start-thirdparties-docker.sh`
enableHiveTest=false
hms_port=7141
hiveServerPort=10000

// kafka test config
// to enable kafka test, you need firstly to start kafka container
// See `docker/thirdparties/start-thirdparties-docker.sh`
enableKafkaTest=true
kafka_port=19193

// iceberg test config
iceberg_rest_uri_port=18181

enableEsTest=false
es_6_port=19200
es_7_port=29200
es_8_port=39200

cacheDataPath = "/data/regression/"

s3Endpoint = "cos.ap-hongkong.myqcloud.com"
s3BucketName = "doris-build-hk-1308700295"
s3Region = "ap-hongkong"
Expand Down

0 comments on commit e634d17

Please sign in to comment.