Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.

HDDS_VERSION=${hdds.version}
OZONE_RUNNER_VERSION=${docker.ozone-runner.version}
OZONE_RUNNER_IMAGE=apache/ozone-runner
OZONE_TEST_IMAGE=apache/ozone-runner:${docker.ozone-runner.version}
OZONE_DIR=/opt/hadoop
OZONE_VOLUME=./data
OM_SERVICE_ID=omservice
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# 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.

# reusable fragments (see https://docs.docker.com/compose/compose-file/#extension-fields)
x-common-config:
&common-config
env_file:
- docker-config
image: ${OZONE_TEST_IMAGE}

x-environment:
&environment
OZONE-SITE.XML_ozone.server.default.replication: ${OZONE_REPLICATION_FACTOR:-1}
OZONE_UPGRADE_TO: ${OZONE_UPGRADE_TO:-0}
OZONE_UPGRADE_FROM: ${OZONE_UPGRADE_FROM:-0}

x-datanode:
&datanode
command: ["ozone","datanode"]
<<: *common-config
environment:
<<: *environment
ports:
- 19864
- 9882

x-volumes:
- &ozone-dir ${TEST_DIR}/../..:${OZONE_DIR}
- &transformation ${TEST_DIR}/../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py

services:
om:
command: ["ozone","om"]
<<: *common-config
environment:
ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
<<: *environment
ports:
- 9862
- 9874
networks:
net:
ipv4_address: 10.9.0.11
volumes:
- ${OZONE_VOLUME}/om:/data
- *ozone-dir
- *transformation
scm:
command: ["ozone","scm"]
<<: *common-config
environment:
ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION
OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1}
<<: *environment
networks:
net:
ipv4_address: 10.9.0.12
ports:
- 9876:9876
volumes:
- ${OZONE_VOLUME}/scm:/data
- *ozone-dir
- *transformation
dn1:
<<: *datanode
networks:
net:
ipv4_address: 10.9.0.13
volumes:
- ${OZONE_VOLUME}/dn1:/data
- *ozone-dir
- *transformation
dn2:
<<: *datanode
networks:
net:
ipv4_address: 10.9.0.14
volumes:
- ${OZONE_VOLUME}/dn2:/data
- *ozone-dir
- *transformation
dn3:
<<: *datanode
networks:
net:
ipv4_address: 10.9.0.15
volumes:
- ${OZONE_VOLUME}/dn3:/data
- *ozone-dir
- *transformation
dn4:
<<: *datanode
networks:
net:
ipv4_address: 10.9.0.16
volumes:
- ${OZONE_VOLUME}/dn4:/data
- *ozone-dir
- *transformation
dn5:
<<: *datanode
networks:
net:
ipv4_address: 10.9.0.17
volumes:
- ${OZONE_VOLUME}/dn5:/data
- *ozone-dir
- *transformation
recon:
command: ["ozone","recon"]
<<: *common-config
environment:
<<: *environment
networks:
net:
ipv4_address: 10.9.0.18
ports:
- 9888:9888
volumes:
- ${OZONE_VOLUME}/recon:/data
- *ozone-dir
- *transformation
s3g:
command: ["ozone","s3g"]
<<: *common-config
environment:
<<: *environment
networks:
net:
ipv4_address: 10.9.0.19
ports:
- 9878:9878
volumes:
- ${OZONE_VOLUME}/s3g:/data
- *ozone-dir
- *transformation
networks:
net:
driver: bridge
ipam:
config:
- subnet: 10.9.0.0/16
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.

OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata

OZONE-SITE.XML_ozone.client.failover.max.attempts=6

OZONE-SITE.XML_ozone.om.service.ids=omservice
OZONE-SITE.XML_ozone.om.nodes.omservice=om1
OZONE-SITE.XML_ozone.om.address.omservice.om1=om
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to add OM service ID for non-ha test to pass means one of:

(1) Users with non-HA cluster will need to make config changes for the upgrade.
(2) The test is not modeling real-life upgrade steps correctly. We need to tweak the test, not the environment.

I tend to think it's the latter.

Proposed test fix: master...adoroszlai:ozone:refs/heads/HDDS-12327
test run: https://github.com/adoroszlai/ozone/actions/runs/14060297062/job/39370001881

Please take a look. If you agree, I'll push my additional commits to this PR's branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense to me. The Robot tests will closely resemble how the upgrade is actually executed by a user.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Feel free to push these commits in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i just updated the branch with these commits. Waiting for CI


#OZONE-SITE.XML_ozone.om.address=om
OZONE-SITE.XML_ozone.om.http-address=om:9874

OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.datanode.ratis.volume.free-space.min=10MB
OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
OZONE-SITE.XML_ozone.scm.pipeline.owner.container.count=1
OZONE-SITE.XML_ozone.scm.names=scm
OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data/metadata
OZONE-SITE.XML_ozone.scm.block.client.address=scm
OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.client.address=scm

OZONE-SITE.XML_hdds.datanode.dir=/data/hdds
OZONE-SITE.XML_hdds.datanode.volume.min.free.space=100MB

OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon
OZONE-SITE.XML_ozone.recon.om.snapshot.task.interval.delay=1m
OZONE-SITE.XML_hdds.scmclient.max.retry.timeout=30s
OZONE-SITE.XML_ozone.http.basedir=/tmp/ozone_http
OZONE-SITE.XML_ozone.fs.hsync.enabled=true

OZONE_CONF_DIR=/etc/hadoop
OZONE_LOG_DIR=/var/log/hadoop

no_proxy=om,scm,s3g,kdc,localhost,127.0.0.1

OM_SERVICE_ID=omservice

# Explicitly enable filesystem snapshot feature for this Docker compose cluster
# Does not take effect on Ozone versions < 1.4.0
OZONE-SITE.XML_ozone.filesystem.snapshot.enabled=true
31 changes: 31 additions & 0 deletions hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/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.

# Fail if required variables are not set.
set -u
: "${OZONE_VOLUME}"
: "${TEST_DIR}"
set +u

source "$TEST_DIR/testlib.sh"

export COMPOSE_FILE="$TEST_DIR/compose/non-ha/docker-compose.yaml"
export OM_SERVICE_ID=omservice
export SECURITY_ENABLED=false
create_data_dirs "${OZONE_VOLUME}"/{om,dn1,dn2,dn3,dn4,dn5,recon,s3g,scm}

echo "Using docker cluster defined in $COMPOSE_FILE"
3 changes: 2 additions & 1 deletion hadoop-ozone/dist/src/main/compose/upgrade/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ RESULT_DIR="$ALL_RESULT_DIR" create_results_dir

# This is the version of Ozone that should use the runner image to run the
# code that was built. Other versions will pull images from docker hub.
run_test ha non-rolling-upgrade 1.4.1 "$OZONE_CURRENT_VERSION"
run_test non-ha non-rolling-upgrade 1.4.1 "$OZONE_CURRENT_VERSION"
run_test ha non-rolling-upgrade 1.4.1 "$OZONE_CURRENT_VERSION"
# run_test ha non-rolling-upgrade 1.4.0 "$OZONE_CURRENT_VERSION"
# run_test ha non-rolling-upgrade 1.3.0 "$OZONE_CURRENT_VERSION"
# run_test ha non-rolling-upgrade 1.2.1 "$OZONE_CURRENT_VERSION"
Expand Down
4 changes: 2 additions & 2 deletions hadoop-ozone/dist/src/main/compose/upgrade/testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ callback() {
## @param The version of Ozone to upgrade from.
## @param The version of Ozone to upgrade to.
run_test() {
local compose_cluster="$1"
export COMPOSE_CLUSTER="$1"
local upgrade_type="$2"
export OZONE_UPGRADE_FROM="$3"
export OZONE_UPGRADE_TO="$4"

local test_dir="$_upgrade_dir/upgrades/$upgrade_type"
local callback_dir="$test_dir"/callbacks
local execution_dir="$test_dir"/execution/"${OZONE_UPGRADE_FROM}-${OZONE_UPGRADE_TO}"
local compose_dir="$_upgrade_dir"/compose/"$compose_cluster"
local compose_dir="$_upgrade_dir"/compose/"${COMPOSE_CLUSTER}"
# Export variables needed by test, since it is run in a subshell.
export OZONE_UPGRADE_CALLBACK="$callback_dir"/"$OZONE_UPGRADE_TO"/callback.sh
export OZONE_COMMON_CALLBACK="$callback_dir"/common/callback.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set -e -o pipefail

# Fail if required vars are not set.
set -u
: "${COMPOSE_CLUSTER}"
: "${OZONE_UPGRADE_FROM}"
: "${OZONE_UPGRADE_TO}"
: "${TEST_DIR}"
Expand Down Expand Up @@ -53,7 +54,9 @@ echo "--- RUNNING WITH OLD VERSION $OZONE_UPGRADE_FROM ---"
start_docker_env
callback with_old_version

execute_robot_test "$SCM" -N "${OUTPUT_NAME}-prepare" upgrade/prepare.robot
if [[ "$COMPOSE_CLUSTER" == 'ha' ]]; then
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-prepare" upgrade/prepare.robot
fi
stop_docker_env
prepare_for_image "$OZONE_UPGRADE_TO"
export OM_HA_ARGS='--upgrade'
Expand All @@ -62,7 +65,9 @@ echo "--- RUNNING WITH NEW VERSION $OZONE_UPGRADE_TO PRE-FINALIZED ---"
OUTPUT_NAME="${OZONE_UPGRADE_FROM}-${OZONE_UPGRADE_TO}-2-pre-finalized"
OZONE_KEEP_RESULTS=true start_docker_env
callback with_this_version_pre_finalized
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-prepare" upgrade/prepare.robot
if [[ "$COMPOSE_CLUSTER" == 'ha' ]]; then
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-prepare" upgrade/prepare.robot
fi
stop_docker_env
prepare_for_image "$OZONE_UPGRADE_FROM"
set_downgrade_om_args
Expand All @@ -72,7 +77,9 @@ OUTPUT_NAME="${OZONE_UPGRADE_FROM}-${OZONE_UPGRADE_TO}-3-downgraded"
OZONE_KEEP_RESULTS=true start_docker_env
callback with_old_version_downgraded

execute_robot_test "$SCM" -N "${OUTPUT_NAME}-prepare" upgrade/prepare.robot
if [[ "$COMPOSE_CLUSTER" == 'ha' ]]; then
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-prepare" upgrade/prepare.robot
fi
stop_docker_env
prepare_for_image "$OZONE_UPGRADE_TO"
export OM_HA_ARGS='--upgrade'
Expand Down