Skip to content

Commit

Permalink
[opt](hive docker)Exit on creating table failed (#47390)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Problem Summary:

There're some table not found error when querying external hive catalog
in CI, like
[#614159](http://43.132.222.7:8111/buildConfiguration/Doris_External_Regression/614159?buildTab=overview&hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandPull+Request+Details=true&expandBuildTestsSection=true&expandBuildChangesSection=true&expandBuildDeploymentsSection=false)
and
[#613945](http://43.132.222.7:8111/buildConfiguration/Doris_External_Regression/613945?buildTab=tests&status=failed&expandedTest=build%3A%28id%3A613945%29%2Cid%3A2000000035).
<img width="782" alt="image"
src="https://github.com/user-attachments/assets/74ce8b6f-3116-4aca-a5a5-3d7f3845a1c9"
/>

The create table script should exit once the sql failed, so we can
easily to see which script failed.

#### Failed scripts

Total 7 ~ 10+ failures, you can search `FAILED: ` in [hive metastore
docker
logs](https://github.com/user-attachments/files/18532083/logs.txt).

1. Create table when hive metastore is not ready , like `student`:
    ```bash
2025-01-24T04:30:01.794131928Z FAILED: SemanticException
org.apache.hadoop.hive.ql.metadata.HiveException:
java.lang.RuntimeException: Unable to instantiate
org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
    ```
2. HQL grammar wrong, like
`/mnt/scripts/data/regression/crdmm_data/run.sh` :
    ```bash
FAILED: ParseException line 3:12 extraneous input 'crdmm_data' expecting
EOF near '<EOF>'
    ```

3. Error at `msck repair table partition_location_2;`, need `set
hive.msck.path.validation=ignore;`, like
`/mnt/scripts/data/multi_catalog/partition_location_2/run.sh`:
    ```bash
FAILED: Execution Error, return code 1 from
org.apache.hadoop.hive.ql.exec.DDLTask
    ```
  • Loading branch information
Thearas authored Jan 26, 2025
1 parent 92e2285 commit 15acf46
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
3 changes: 3 additions & 0 deletions docker/thirdparties/docker-compose/hive/hive-2x.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ version: "3.8"
services:
namenode:
image: bde2020/hadoop-namenode:2.0.0-hadoop2.7.4-java8
restart: always
environment:
- CLUSTER_NAME=test
env_file:
Expand All @@ -38,6 +39,7 @@ services:

datanode:
image: bde2020/hadoop-datanode:2.0.0-hadoop2.7.4-java8
restart: always
env_file:
- ./hadoop-hive-2x.env
environment:
Expand Down Expand Up @@ -82,6 +84,7 @@ services:
command: /bin/bash /mnt/scripts/hive-metastore.sh
environment:
SERVICE_PRECONDITION: "${IP_HOST}:50070 ${IP_HOST}:50075 ${IP_HOST}:${PG_PORT}"
HMS_PORT: "${HMS_PORT}"
container_name: ${CONTAINER_UID}hive2-metastore
expose:
- "${HMS_PORT}"
Expand Down
3 changes: 3 additions & 0 deletions docker/thirdparties/docker-compose/hive/hive-3x.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ version: "3.8"
services:
namenode:
image: bde2020/hadoop-namenode:2.0.0-hadoop3.2.1-java8
restart: always
environment:
- CLUSTER_NAME=test
env_file:
Expand All @@ -38,6 +39,7 @@ services:

datanode:
image: bde2020/hadoop-datanode:2.0.0-hadoop3.2.1-java8
restart: always
env_file:
- ./hadoop-hive-3x.env
environment:
Expand Down Expand Up @@ -82,6 +84,7 @@ services:
command: /bin/bash /mnt/scripts/hive-metastore.sh
environment:
SERVICE_PRECONDITION: "${IP_HOST}:9870 ${IP_HOST}:9864 ${IP_HOST}:${PG_PORT}"
HMS_PORT: "${HMS_PORT}"
container_name: ${CONTAINER_UID}hive3-metastore
expose:
- "${HMS_PORT}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ TBLPROPERTIES (
'transient_lastDdlTime'='1682405696');

ALTER TABLE partition_location_1 ADD PARTITION (part='part1') LOCATION '/user/doris/suites/multi_catalog/partition_location_1/part=part1';
ALTER TABLE partition_location_1 ADD PARTITION (part='part2') LOCATION '/user/doris/suites/multi_catalog/partition_location_1/20230425';
ALTER TABLE partition_location_1 ADD PARTITION (part='part2') LOCATION '/user/doris/suites/multi_catalog/partition_location_1/part=part2';

set hive.msck.path.validation=ignore;
msck repair table partition_location_1;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ TBLPROPERTIES (
ALTER TABLE partition_location_2 ADD PARTITION (part1='part1_1', part2='part2_1') LOCATION '/user/doris/suites/multi_catalog/partition_location_2/part1=part1_1/part2=part2_1';
ALTER TABLE partition_location_2 ADD PARTITION (part1='part1_2', part2='part2_2') LOCATION '/user/doris/suites/multi_catalog/partition_location_2/20230425';

set hive.msck.path.validation=ignore;
msck repair table partition_location_2;
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,5 @@ LOCATION
TBLPROPERTIES (
'transient_lastDdlTime'='1685331029');

msck repair crdmm_data;
msck repair table crdmm_data;

28 changes: 14 additions & 14 deletions docker/thirdparties/docker-compose/hive/scripts/hive-metastore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ parallel=$(getconf _NPROCESSORS_ONLN)

nohup /opt/hive/bin/hive --service metastore &

# wait metastore start
sleep 10s

# create tables for other cases
# new cases should use separate dir
hadoop fs -mkdir -p /user/doris/suites/

lockfile1="/mnt/scripts/run-data.lock"

# wait lockfile
lockfile1="/mnt/scripts/run-data.lock"
while [[ -f "${lockfile1}" ]]; do
sleep 10
done

touch "${lockfile1}"

# wait metastore start
while ! $(nc -z localhost "${HMS_PORT:-9083}"); do
sleep 5s
done

# create tables for other cases
# new cases should use separate dir
hadoop fs -mkdir -p /user/doris/suites/

DATA_DIR="/mnt/scripts/data/"
find "${DATA_DIR}" -type f -name "run.sh" -print0 | xargs -0 -n 1 -P "${parallel}" -I {} sh -c '
find "${DATA_DIR}" -type f -name "run.sh" -print0 | xargs -0 -n 1 -P "${parallel}" -I {} bash -ec '
START_TIME=$(date +%s)
chmod +x "{}" && "{}"
bash -e "{}" || (echo "Failed to executing script: {}" && exit 1)
END_TIME=$(date +%s)
EXECUTION_TIME=$((END_TIME - START_TIME))
echo "Script: {} executed in $EXECUTION_TIME seconds"
Expand Down Expand Up @@ -145,9 +145,9 @@ if [[ -z "$(hadoop fs -ls /user/doris/tvf_data)" ]]; then
fi

# create tables
ls /mnt/scripts/create_preinstalled_scripts/*.hql | xargs -n 1 -P "${parallel}" -I {} bash -c '
ls /mnt/scripts/create_preinstalled_scripts/*.hql | xargs -n 1 -P "${parallel}" -I {} bash -ec '
START_TIME=$(date +%s)
hive -f {}
hive -f {} || (echo "Failed to executing hql: {}" && exit 1)
END_TIME=$(date +%s)
EXECUTION_TIME=$((END_TIME - START_TIME))
echo "Script: {} executed in $EXECUTION_TIME seconds"
Expand Down

0 comments on commit 15acf46

Please sign in to comment.