Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#355] fix(IT): Fix Github integration test flaky issue (#361)

Xun Liubb35dbc8ec9b
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index b8949c4cb9..ea6129cb76 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -1,4 +1,4 @@
-name: Docker Image
+name: Publish Docker Image
on:
workflow_dispatch:
@@ -32,7 +32,7 @@ jobs:
fi
- name: Set up QEMU
- uses: docker/setup-qemu-action@v1
+ uses: docker/setup-qemu-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
@@ -41,7 +41,7 @@ jobs:
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
+ uses: docker/setup-buildx-action@v2
- name: Build and Push the main branch Docker image
if: ${{ github.ref_name == 'main' }}
diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml
index 26ea0d7e54..5aa54ae9a7 100644
--- a/.github/workflows/integration-test.yml
+++ b/.github/workflows/integration-test.yml
@@ -10,7 +10,7 @@ on:
env:
HIVE_IMAGE_NAME: datastrato/graviton-ci-hive
- HIVE_IMAGE_TAG_NAME: 0.1.0
+ HIVE_IMAGE_TAG_NAME: 0.1.1
concurrency:
group: ${{ github.worklfow }}-${{ github.event.pull_request.number || github.ref }}
@@ -36,10 +36,10 @@ jobs:
distribution: 'temurin'
- name: Set up QEMU
- uses: docker/setup-qemu-action@v1
+ uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
+ uses: docker/setup-buildx-action@v2
- name: Build the hive Docker image for AMD64
if: ${{ contains(github.event.pull_request.labels.*.name, 'build docker image') }}
@@ -63,16 +63,29 @@ jobs:
gradle build
gradle compileDistribution
- - name: Setup Debug Action
- if: ${{ contains(github.event.pull_request.labels.*.name, 'debug action') }}
- uses: csexton/debugger-action@master
+ - name: Check docker container status
+ uses: nick-fields/retry@v2
+ with:
+ max_attempts: 3
+ timeout_seconds: 200
+ continue_on_error: false
+ command: |
+ docker exec -i ${DOCKER_RUN_NAME} bash /tmp/check-status.sh
+ on_retry_command: |
+ docker ps -a
+ docker stop ${DOCKER_RUN_NAME}
+ sleep 3
+ docker ps -a
+ docker run --rm --name ${DOCKER_RUN_NAME} --platform ${PLATFORM} -d -p 8088:8088 -p 50070:50070 -p 50075:50075 -p 10000:10000 -p 10002:10002 -p 8888:8888 -p 9083:9083 -p 8022:22 ${HIVE_IMAGE_NAME}:${HIVE_IMAGE_TAG_NAME}
+ sleep 60
- name: Integration Test
+ id: integrationTest
run: |
gradle integrationTest
- name: Print logs when Graviton integration tests failure
- if: ${{ failure() }}
+ if: ${{ failure() && steps.integrationTest.outcome == 'failure' }}
run: |
if [ -f "distribution/package/logs/graviton-server.out" ]; then
cat distribution/package/logs/graviton-server.out
diff --git a/dev/docker/hive/Dockerfile b/dev/docker/hive/Dockerfile
index 945da2737f..cb0507c917 100644
--- a/dev/docker/hive/Dockerfile
+++ b/dev/docker/hive/Dockerfile
@@ -50,7 +50,7 @@ COPY packages /tmp/packages
ENV JAVA_HOME=/usr/local/jdk
ENV HIVE_HOME=/usr/local/hive
ENV HADOOP_HOME=/usr/local/hadoop
-ENV HADOOP_HEAPSIZE=8192
+ENV HADOOP_HEAPSIZE=128
ENV HADOOP_INSTALL=${HADOOP_HOME}
ENV HADOOP_MAPRED_HOME=${HADOOP_INSTALL}
ENV HADOOP_COMMON_HOME=${HADOOP_INSTALL}
@@ -94,15 +94,18 @@ RUN tar -xz -C ${HADOOP_HOME} --strip-components 1 -f /tmp/packages/${HADOOP_PAC
# replace configuration templates
RUN rm -f ${HADOOP_CONF_DIR}/core-site.xml
RUN rm -f ${HADOOP_CONF_DIR}/hadoop-env.sh
+RUN rm -f ${HADOOP_CONF_DIR}/yarn-env.sh
RUN rm -f ${HADOOP_CONF_DIR}/hdfs-site.xml
RUN rm -f ${HADOOP_CONF_DIR}/mapred-site.xml
RUN rm -f ${HADOOP_CONF_DIR}/yarn-site.xml
ADD core-site.xml ${HADOOP_CONF_DIR}/core-site.xml
ADD hadoop-env.sh ${HADOOP_CONF_DIR}/hadoop-env.sh
+ADD yarn-env.sh ${HADOOP_CONF_DIR}/yarn-env.sh
ADD hdfs-site.xml ${HADOOP_CONF_DIR}/hdfs-site.xml
ADD mapred-site.xml ${HADOOP_CONF_DIR}/mapred-site.xml
ADD yarn-site.xml ${HADOOP_CONF_DIR}/yarn-site.xml
+ADD check-status.sh /tmp/check-status.sh
# format HFS
RUN ${HADOOP_HOME}/bin/hdfs namenode -format -nonInteractive
diff --git a/dev/docker/hive/README.md b/dev/docker/hive/README.md
index a82aec49f0..23f9e7fd33 100644
--- a/dev/docker/hive/README.md
+++ b/dev/docker/hive/README.md
@@ -8,7 +8,7 @@ Build docker image that includes Hadoop2, Hive2
Build Image
===========
```
-./build-docker.sh
+./build-docker.sh --platform [all|linux/amd64|linux/arm64] --image {image_name} --tag {tag_name}
```
Run container
diff --git a/dev/docker/hive/check-status.sh b/dev/docker/hive/check-status.sh
new file mode 100755
index 0000000000..8934bf4236
--- /dev/null
+++ b/dev/docker/hive/check-status.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
+set -ex
+
+hdfs_ready=$(hdfs dfsadmin -report | grep "Live datanodes" | awk '{print $3}')
+if [[ ${hdfs_ready} == "(1):" ]]; then
+ echo "HDFS is ready"
+else
+ echo "HDFS is not ready"
+ exit 1
+fi
+
+hive_ready=$(hive -e "show databases;" 2>&1)
+if [[ ${hive_ready} == *"FAILED"* ]]; then
+ echo "Hive is not ready"
+ exit 1
+else
+ echo "Hive is ready"
+fi
+
+exit 0
\ No newline at end of file
diff --git a/dev/docker/hive/hadoop-env.sh b/dev/docker/hive/hadoop-env.sh
index 856be5546d..f9d9cf0a9c 100644
--- a/dev/docker/hive/hadoop-env.sh
+++ b/dev/docker/hive/hadoop-env.sh
@@ -42,10 +42,10 @@ for f in ${HADOOP_HOME}/contrib/capacity-scheduler/*.jar; do
done
# The maximum amount of heap to use, in MB. Default is 1000.
-export HADOOP_HEAPSIZE=8192
+export HADOOP_HEAPSIZE=128
# Extra Java runtime options. Empty by default.
-export HADOOP_OPTS="${HADOOP_OPTS} -Djava.net.preferIPv4Stack=true -XX:MaxPermSize=512m"
+export HADOOP_OPTS="${HADOOP_OPTS} -Djava.net.preferIPv4Stack=true -XX:MaxPermSize=128m"
# Command specific options appended to HADOOP_OPTS when specified
export HADOOP_NAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} ${HADOOP_NAMENODE_OPTS}"
diff --git a/dev/docker/hive/yarn-env.sh b/dev/docker/hive/yarn-env.sh
new file mode 100644
index 0000000000..055f5f8378
--- /dev/null
+++ b/dev/docker/hive/yarn-env.sh
@@ -0,0 +1,124 @@
+# 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.
+
+# User for YARN daemons
+export HADOOP_YARN_USER=${HADOOP_YARN_USER:-yarn}
+
+# resolve links - $0 may be a softlink
+export YARN_CONF_DIR="${YARN_CONF_DIR:-$HADOOP_YARN_HOME/conf}"
+
+# some Java parameters
+# export JAVA_HOME=/home/y/libexec/jdk1.6.0/
+if [ "$JAVA_HOME" != "" ]; then
+ #echo "run java in $JAVA_HOME"
+ JAVA_HOME=$JAVA_HOME
+fi
+
+if [ "$JAVA_HOME" = "" ]; then
+ echo "Error: JAVA_HOME is not set."
+ exit 1
+fi
+
+JAVA=$JAVA_HOME/bin/java
+JAVA_HEAP_MAX=-Xmx128m
+
+# For setting YARN specific HEAP sizes please use this
+# Parameter and set appropriately
+# YARN_HEAPSIZE=1000
+YARN_HEAPSIZE=128
+
+# check envvars which might override default args
+if [ "$YARN_HEAPSIZE" != "" ]; then
+ JAVA_HEAP_MAX="-Xmx""$YARN_HEAPSIZE""m"
+fi
+
+# Resource Manager specific parameters
+
+# Specify the max Heapsize for the ResourceManager using a numerical value
+# in the scale of MB. For example, to specify an jvm option of -Xmx1000m, set
+# the value to 1000.
+# This value will be overridden by an Xmx setting specified in either YARN_OPTS
+# and/or YARN_RESOURCEMANAGER_OPTS.
+# If not specified, the default value will be picked from either YARN_HEAPMAX
+# or JAVA_HEAP_MAX with YARN_HEAPMAX as the preferred option of the two.
+#export YARN_RESOURCEMANAGER_HEAPSIZE=1000
+export YARN_RESOURCEMANAGER_HEAPSIZE=128
+
+# Specify the max Heapsize for the timeline server using a numerical value
+# in the scale of MB. For example, to specify an jvm option of -Xmx1000m, set
+# the value to 1000.
+# This value will be overridden by an Xmx setting specified in either YARN_OPTS
+# and/or YARN_TIMELINESERVER_OPTS.
+# If not specified, the default value will be picked from either YARN_HEAPMAX
+# or JAVA_HEAP_MAX with YARN_HEAPMAX as the preferred option of the two.
+#export YARN_TIMELINESERVER_HEAPSIZE=1000
+
+# Specify the JVM options to be used when starting the ResourceManager.
+# These options will be appended to the options specified as YARN_OPTS
+# and therefore may override any similar flags set in YARN_OPTS
+#export YARN_RESOURCEMANAGER_OPTS=
+
+# Node Manager specific parameters
+
+# Specify the max Heapsize for the NodeManager using a numerical value
+# in the scale of MB. For example, to specify an jvm option of -Xmx1000m, set
+# the value to 1000.
+# This value will be overridden by an Xmx setting specified in either YARN_OPTS
+# and/or YARN_NODEMANAGER_OPTS.
+# If not specified, the default value will be picked from either YARN_HEAPMAX
+# or JAVA_HEAP_MAX with YARN_HEAPMAX as the preferred option of the two.
+#export YARN_NODEMANAGER_HEAPSIZE=1000
+export YARN_NODEMANAGER_HEAPSIZE=128
+
+# Specify the JVM options to be used when starting the NodeManager.
+# These options will be appended to the options specified as YARN_OPTS
+# and therefore may override any similar flags set in YARN_OPTS
+#export YARN_NODEMANAGER_OPTS=
+
+# so that filenames w/ spaces are handled correctly in loops below
+IFS=
+
+
+# default log directory & file
+if [ "$YARN_LOG_DIR" = "" ]; then
+ YARN_LOG_DIR="$HADOOP_YARN_HOME/logs"
+fi
+if [ "$YARN_LOGFILE" = "" ]; then
+ YARN_LOGFILE='yarn.log'
+fi
+
+# default policy file for service-level authorization
+if [ "$YARN_POLICYFILE" = "" ]; then
+ YARN_POLICYFILE="hadoop-policy.xml"
+fi
+
+# restore ordinary behaviour
+unset IFS
+
+
+YARN_OPTS="$YARN_OPTS -Dhadoop.log.dir=$YARN_LOG_DIR"
+YARN_OPTS="$YARN_OPTS -Dyarn.log.dir=$YARN_LOG_DIR"
+YARN_OPTS="$YARN_OPTS -Dhadoop.log.file=$YARN_LOGFILE"
+YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
+YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$YARN_COMMON_HOME"
+YARN_OPTS="$YARN_OPTS -Dyarn.id.str=$YARN_IDENT_STRING"
+YARN_OPTS="$YARN_OPTS -Dhadoop.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
+YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
+if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
+ YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
+fi
+YARN_OPTS="$YARN_OPTS -Dyarn.policy.file=$YARN_POLICYFILE"
+
+
diff --git a/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java b/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java
index b8f57207b2..66711d023d 100644
--- a/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java
+++ b/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java
@@ -74,9 +74,9 @@ public class CatalogHiveIT extends AbstractIT {
Map<String, String> properties = Maps.newHashMap();
properties.put("provider", "hive");
properties.put(HiveConf.ConfVars.METASTOREURIS.varname, HIVE_METASTORE_URIS);
- properties.put(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES.varname, "10");
- properties.put(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES.varname, "10");
- properties.put(HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY.varname, "3");
+ properties.put(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES.varname, "30");
+ properties.put(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES.varname, "30");
+ properties.put(HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY.varname, "5");
Catalog catalog =
metalake.createCatalog(