diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/README.md b/hadoop-ozone/dist/src/main/compose/upgrade/README.md index 27d6afa26ee8..78a5b0e67059 100644 --- a/hadoop-ozone/dist/src/main/compose/upgrade/README.md +++ b/hadoop-ozone/dist/src/main/compose/upgrade/README.md @@ -18,39 +18,60 @@ This directory contains cluster definitions and scripts for testing upgrades fro previous version, or to the local build of the code. It is designed to catch backwards incompatible changes made between an older release of Ozone and a later release (which may be the local build). -## IMPORTANT NOTES +## Quick Guide For Release Managers -1. Backwards Incompatibility - - These tests will not catch backwards incompatible changes against commits in between releases. - - Example: - 1. After 1.0.0, a change *c1* is made that is backwards compatible with 1.0.0. - 2. After *c1*, a new change *c2* is made that is also backwards compatible with 1.0.0 but backwards *incompatible* with *c1*. +- The whole test matrix of upgrading and downgrading to/from previous releases to the current code is too time consuming to do on every CI run. Instead we recommend release managers manually test the full matrix before each release, and let only the tests from the previous release to the current code be run in CI. - - This test suite will not raise an error for *c2*, because it only tests against the last release - (1.0.0), and not the last commit (*c1*). +1. Before the release, test the whole matrix of upgrades from the previous version to the version you are releasing. + - This is important manual verification that the release does not break backwards compatibility, and the results can be included in the release vote mailing thread. + - To do this, uncomment all lines that contain `run_test` in the *test.sh* file, and execute *test.sh* either locally or on GitHub actions. + +2. After the release is finished and its docker image is published, add the new version to the test matrix. + 1. Change the `OZONE_CURRENT_VERSION` variable to `OZONE_CURRENT_VERSION=`. + 2. Comment out all `run_test` lines in *test.sh*. + 3. Add a new line: `run_test ha non-rolling-upgrade "$OZONE_CURRENT_VERSION"` before the commented out lines. + +## Important Notes on Test Scope + +- These tests will not catch backwards incompatible changes against commits in between releases. + - Example: + 1. After 1.2.0, a change *c1* is made that is backwards compatible with 1.2.0. + 2. After *c1*, a new change *c2* is made that is also backwards compatible with 1.0.0 but backwards *incompatible* with *c1*. + + - This test suite will not raise an error for *c2*, because it only tests against the last release + (1.2.0), and not the last commit (*c1*). + +## Supported Versions + +Non-rolling upgrades and downgrades are supported from 1.1.0 to any later version. Note that 1.1.0 did not have the non-rolling upgrade framework, so things like preparing the OMs for upgrade and checking finalization status are not present in that version. Manual upgrade is the only supported upgrade option from 1.0.0 to 1.1.0. ## Directory Layout ### upgrades -Each type of upgrade has a subdirectory under the *upgrades* directory. Each upgrade's steps are controlled by a *driver.sh* script in its *upgrades/\* directory. Callbacks to execute throughout the upgrade are called by this script and should be placed in a file called *callback.sh* in the *upgrades/\/\-\* directory. After the test is run, results and docker volume data for the upgrade for these versions will also be placed in this directory. The results of all upgrades run as part of the tests will be placed in a *results* folder in the top level upgrade directory. +Each type of upgrade has a subdirectory under the *upgrades* directory. + +- Each upgrade's steps are controlled by a *driver.sh* script in its *upgrades/\* directory. Callbacks to execute throughout the upgrade are called by this script and should be placed in a file called *callback.sh* in the *upgrades/\/\* directory. + +- As the test is run, result logs and docker volume data for the upgrade for these versions will be placed in *upgrades/\/execution/\-\*. This allows a suite of upgrades to be run without conflicting directory names. + +- The result logs of all upgrades run as part of the tests will be copied to a *result* directory in the top level upgrade directory. #### non-rolling-upgrade - Any necessary conversion of on disk structures from the old version to the new version are handled by Ozone's non-rolling upgrade framework. +- The name of each subdirectory in *non-rolling-upgrade* is a version to start the upgrade test from, with a *callback.sh* file whose callbacks will be invoked for any upgrade starting in that version. + +- The *common* directory contains callbacks used for all upgrade tests regardless of the version. + - Supported Callbacks: - 1. `setup`: Run before ozone is started in the old version. - 3. `with_old_version`: Run while ozone is running in the old version. - 3. `with_new_version_pre_finalized`: Run after ozone is stopped in the old version, and brought back up and running in the new version pre-finalized. - 4. `with_old_version_downgraded`: Run after ozone is stopped in the new version pre-finalized, and restarted in the old version again. - 5. `with_new_version_finalized`: Run after ozone is stopped in the old version after donwgrade, started again in the new version pre-finalized, and then finalized. + 1. `with_old_version`: Run while ozone is in the original version to start the upgrade from, before any upgrade steps have been done. + 2. `with_this_version_pre_finalized`: Run after ozone is stopped in the old version, and brought back up and running in the new version pre-finalized. + 3. `with_old_version_downgraded`: Run after ozone is stopped in the new version pre-finalized, and restarted in the old version again. + 4. `with_this_version_finalized`: Run after ozone is stopped in the old version after donwgrade, started again in the new version pre-finalized, and then finalized. - The upgrade is complete when this callback runs. -- Note that on the first upgrade after the non-rolling upgrade framework is added, the old version does not have the non-rolling upgrade framework, but the new version does. - - The non-rolling upgrade framework can still be used, the only difference is that OMs cannot be prepared before moving from the old version to the new version. - - Set the variable `OZONE_PREPARE_OMS` to `false` in `callback.sh` setup function to disable OM preparation as part of the upgrade. - #### manual-upgrade - This is a legacy option that was used before the upgrade framework was introduced in 1.2.0. This option is left as an example in case it needs to be used for some reason in the future. @@ -60,22 +81,22 @@ Each type of upgrade has a subdirectory under the *upgrades* directory. Each upg - This is primarily for testing upgrades from versions before the non-rolling upgrade framework was introduced. - Supported Callbacks: - 1. `setup_with_old_version`: Run before ozone is started in the old version. + 1. `setup_old_version`: Run before ozone is started in the old version. 3. `with_old_version`: Run while ozone is running in the old version. - 3. `setup_with_new_version`: Run after ozone is stopped in the old version, but before it is restarted in the new version. - 4. `with_new_version`: Run while ozone is running in the new version. + 3. `setup_this_version`: Run after ozone is stopped in the old version, but before it is restarted in the new version. + 4. `with_this_version`: Run while ozone is running in the new version. ### compose -Docker compose cluster definitions to be used in upgrade testing are defined in the *compose* directory. A compose cluster can be selected by sourcing the *load.sh* script in the compose cluster's directory on the setup callback for the upgrade test. +Docker compose cluster definitions to be used in upgrade testing are defined in the *compose* directory. A compose cluster can be selected by specifying the name of its subdirectory as the first argument to `run_test`. `run_test` will then source the `load.sh` script in the cluster's directory so it is used during the test. For manual testing, docker compose can be used normally from the compose cluster directory. Note that some clusters may not work with older versions. Ozone 1.1.0, for example, does not support SCM HA. ## Persisting Data - Data for each container is persisted in a mounted volume. -- By default it's `data` under the *compose/upgrade/\* directory, but can be overridden with the `OZONE_VOLUME` environment variable. +- By default it's *data* under the *upgrades/\/execution/\-\* directory, but can be overridden with the `OZONE_VOLUME` environment variable. -- This allows data to be persisted in the cluster throughout container restarts, meaning that tests can check that data written in older versions is still readable in newer versions. +- Mounting volumes allows data to be persisted in the cluster throughout container restarts, meaning that tests can check that data written in older versions is still readable in newer versions. - Data will be available after the tests finish for debugging purposes. It will be erased on a following run of the test. @@ -83,17 +104,23 @@ Docker compose cluster definitions to be used in upgrade testing are defined in ### Adding New Tests -- To add tests to an existing upgrade type, edit its *compose/upgrade/\/\/callback.sh* file and add commands in the callback function when they should be run. +- Tests that should run for all upgrades, regardless of the version being tested, can be added to *compose/upgrade/\/common/callback.sh*. + +- Tests that should run only for an upgrade to a specific version can be added to *compose/upgrade/\/\/callback.sh*. -- Each callback file will have access to the following environment variables: - - `OZONE_UPGRADE_FROM`: The version of ozone being upgraded from. - - `OZONE_UPGRADE_TO`: The version of ozone being upgraded to. - - `TEST_DIR`: The top level *upgrade* directory containing all files for upgrade testing. +- Add commands in the callback function when they should be run. Each callback file will have access to the following environment variables: + - `OZONE_UPGRADE_FROM`: The version of ozone being upgraded from. + - `OZONE_UPGRADE_TO`: The version of ozone being upgraded to. + - `TEST_DIR`: The top level *upgrade* directory containing all files for upgrade testing. + - `SCM`: The name of the SCM container to run robot tests from. + - This can be passed as the first argument to `execute_robot_test`. + - This allows the same tests to work with and without SCM HA. ### Testing New Versions -- To test upgrade between different versions, add a line `run_test ` to the top level *test.sh* file. - - The `run_test` function will execute *\/test.sh* with the callbacks defined in *\/\-\/callback.sh*. +- To test upgrade between different versions, add a line `run_test ` to the top level *test.sh* file. + - The `run_test` function will execute *upgrades/\/driver.sh* with the callbacks defined in *upgrades/\/common/callback.sh* and *upgrades/\/\/callback.sh*. + +- The variable `OZONE_CURRENT_VERSION` is used to define the version corresponding to the locally built source code in the `apache/ozone-runner` image. + - All other versions will be treated as tags specifying a released version of the `apache/ozone` docker image to use. -- If one of the specified versions does not match the current version defined by `OZONE_CURRENT_VERSION`, it will be pulled from the corresponding *apache/ozone* docker image. - - Else, the current version will be used, which will run the locally built source code in the `apache/ozone-runner` image. diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml index 7f52d73a8eb0..af0566aac885 100644 --- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml @@ -23,27 +23,37 @@ x-common-config: - docker-config image: ${OZONE_IMAGE} -x-replication: - &replication +x-environment: + &environment OZONE-SITE.XML_ozone.replication: ${OZONE_REPLICATION_FACTOR:-3} + OZONE_UPGRADE_TO: ${OZONE_UPGRADE_TO:-0} + OZONE_UPGRADE_FROM: ${OZONE_UPGRADE_FROM:-0} + OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1} x-datanode: &datanode command: ["ozone","datanode"] <<: *common-config environment: - <<: *replication + <<: *environment ports: - 9864 - 9882 +x-scm: + &scm + command: ["ozone","scm"] + <<: *common-config + ports: + - 9876 + x-om: &om command: ["ozone","om","${OM_HA_ARGS}"] <<: *common-config environment: ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - <<: *replication + <<: *environment ports: - 9862 - 9872 @@ -81,27 +91,50 @@ services: - *ozone-dir - *transformation - scm: - command: ["ozone","scm"] - <<: *common-config + scm1: + <<: *scm environment: ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION - OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1} - <<: *replication + <<: *environment networks: net: ipv4_address: 10.9.0.14 - ports: - - 9876:9876 volumes: - - ${OZONE_VOLUME}/scm:/data + - ${OZONE_VOLUME}/scm1:/data - *ozone-dir - *transformation + scm2: + <<: *scm + environment: + WAITFOR: scm1:9894 + ENSURE_SCM_BOOTSTRAPPED: /data/metadata/scm/current/VERSION + <<: *environment + networks: + net: + ipv4_address: 10.9.0.15 + volumes: + - ${OZONE_VOLUME}/scm2:/data + - *ozone-dir + - *transformation + scm3: + <<: *scm + environment: + WAITFOR: scm2:9894 + ENSURE_SCM_BOOTSTRAPPED: /data/metadata/scm/current/VERSION + <<: *environment + networks: + net: + ipv4_address: 10.9.0.16 + volumes: + - ${OZONE_VOLUME}/scm3:/data + - *ozone-dir + - *transformation + dn1: <<: *datanode networks: net: - ipv4_address: 10.9.0.15 + ipv4_address: 10.9.0.17 volumes: - ${OZONE_VOLUME}/dn1:/data - *ozone-dir @@ -110,7 +143,7 @@ services: <<: *datanode networks: net: - ipv4_address: 10.9.0.16 + ipv4_address: 10.9.0.18 volumes: - ${OZONE_VOLUME}/dn2:/data - *ozone-dir @@ -119,7 +152,7 @@ services: <<: *datanode networks: net: - ipv4_address: 10.9.0.17 + ipv4_address: 10.9.0.19 volumes: - ${OZONE_VOLUME}/dn3:/data - *ozone-dir @@ -128,7 +161,7 @@ services: <<: *datanode networks: net: - ipv4_address: 10.9.0.18 + ipv4_address: 10.9.0.20 volumes: - ${OZONE_VOLUME}/dn4:/data - *ozone-dir @@ -137,7 +170,7 @@ services: <<: *datanode networks: net: - ipv4_address: 10.9.0.19 + ipv4_address: 10.9.0.21 volumes: - ${OZONE_VOLUME}/dn5:/data - *ozone-dir @@ -146,10 +179,10 @@ services: command: ["ozone","recon"] <<: *common-config environment: - <<: *replication + <<: *environment networks: net: - ipv4_address: 10.9.0.20 + ipv4_address: 10.9.0.22 ports: - 9888:9888 volumes: @@ -160,16 +193,17 @@ services: command: ["ozone","s3g"] <<: *common-config environment: - <<: *replication + <<: *environment networks: net: - ipv4_address: 10.9.0.21 + ipv4_address: 10.9.0.23 ports: - 9878:9878 volumes: - ${OZONE_VOLUME}/s3g:/data - *ozone-dir - *transformation + networks: net: driver: bridge diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-config b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-config index e2540baaa49b..e241b69be5a5 100644 --- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-config +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-config @@ -24,14 +24,19 @@ OZONE-SITE.XML_ozone.om.address.omservice.om1=om1 OZONE-SITE.XML_ozone.om.address.omservice.om2=om2 OZONE-SITE.XML_ozone.om.address.omservice.om3=om3 OZONE-SITE.XML_ozone.om.ratis.enable=true + +OZONE-SITE.XML_ozone.scm.service.ids=scmservice +OZONE-SITE.XML_ozone.scm.nodes.scmservice=scm1,scm2,scm3 +OZONE-SITE.XML_ozone.scm.address.scmservice.scm1=scm1 +OZONE-SITE.XML_ozone.scm.address.scmservice.scm2=scm2 +OZONE-SITE.XML_ozone.scm.address.scmservice.scm3=scm3 +OZONE-SITE.XML_ozone.scm.ratis.enable=true +OZONE-SITE.XML_ozone.scm.primordial.node.id=scm1 + 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 -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 # If SCM sends container close commands as part of upgrade finalization while @@ -53,6 +58,6 @@ OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon OZONE-SITE.XML_ozone.recon.om.snapshot.task.interval.delay=1m OZONE-SITE.XML_ozone.recon.address=recon:9891 -no_proxy=om1,om2,om3,scm,s3g,kdc,localhost,127.0.0.1 +no_proxy=om1,om2,om3,scm1,scm2,scm3,s3g,kdc,localhost,127.0.0.1 OM_SERVICE_ID=omservice diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/load.sh b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/load.sh index 43c668804b2f..59ec12f4c664 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/load.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/load.sh @@ -25,4 +25,6 @@ source "$TEST_DIR/testlib.sh" export COMPOSE_FILE="$TEST_DIR/compose/ha/docker-compose.yaml" export OM_SERVICE_ID=omservice -create_data_dirs "${OZONE_VOLUME}"/{om1,om2,om3,dn1,dn2,dn3,dn4,dn5,recon,s3g,scm} +create_data_dirs "${OZONE_VOLUME}"/{om1,om2,om3,dn1,dn2,dn3,dn4,dn5,recon,s3g,scm1,scm2,scm3} + +echo "Using docker cluster defined in $COMPOSE_FILE" diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/docker-compose.yaml index 14617ccef53b..7f35733dc285 100644 --- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/docker-compose.yaml +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/docker-compose.yaml @@ -23,16 +23,18 @@ x-common-config: - docker-config image: ${OZONE_IMAGE} -x-replication: - &replication +x-environment: + &environment OZONE-SITE.XML_ozone.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: - <<: *replication + <<: *environment ports: - 9864 - 9882 @@ -47,7 +49,7 @@ services: <<: *common-config environment: ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - <<: *replication + <<: *environment ports: - 9862 - 9874 @@ -64,7 +66,7 @@ services: environment: ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1} - <<: *replication + <<: *environment networks: net: ipv4_address: 10.9.0.12 @@ -123,7 +125,7 @@ services: command: ["ozone","recon"] <<: *common-config environment: - <<: *replication + <<: *environment networks: net: ipv4_address: 10.9.0.18 @@ -137,7 +139,7 @@ services: command: ["ozone","s3g"] <<: *common-config environment: - <<: *replication + <<: *environment networks: net: ipv4_address: 10.9.0.19 diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/load.sh b/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/load.sh index 0e8fc0567fea..c1bd0d3724a8 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/load.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/non-ha/load.sh @@ -25,3 +25,5 @@ source "$TEST_DIR/testlib.sh" export COMPOSE_FILE="$TEST_DIR/compose/non-ha/docker-compose.yaml" create_data_dirs "${OZONE_VOLUME}"/{om,dn1,dn2,dn3,dn4,dn5,recon,s3g,scm} + +echo "Using docker cluster defined in $COMPOSE_FILE" diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/.env b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/.env new file mode 100644 index 000000000000..4d1c35c3b2d3 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/.env @@ -0,0 +1,27 @@ +# 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_IMAGE=apache/ozone-runner:${docker.ozone-runner.version} +OZONE_DIR=/opt/hadoop +OZONE_VOLUME=./data +OM_SERVICE_ID=omservice +# Indicates no arguments to the OM. +# This variable must be set to some non-empty value, or docker compose will +# expand it to an empty string and pass that to the OM as an argument. +OM_HA_ARGS=-- diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/docker-compose.yaml new file mode 100644 index 000000000000..d4f97885aaa8 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/docker-compose.yaml @@ -0,0 +1,180 @@ +# 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. + +version: "3.4" + +# reusable fragments (see https://docs.docker.com/compose/compose-file/#extension-fields) +x-common-config: + &common-config + env_file: + - docker-config + image: ${OZONE_IMAGE} + +x-environment: + &environment + OZONE-SITE.XML_ozone.replication: ${OZONE_REPLICATION_FACTOR:-3} + 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: + - 9864 + - 9882 + +x-om: + &om + command: ["ozone","om","${OM_HA_ARGS}"] + <<: *common-config + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + <<: *environment + ports: + - 9862 + - 9872 + +x-volumes: + - &ozone-dir ../../../..:${OZONE_DIR} + - &transformation ../../../../libexec/transformation.py:/opt/hadoop/libexec/transformation.py + +services: + om1: + <<: *om + networks: + net: + ipv4_address: 10.9.0.11 + volumes: + - ${OZONE_VOLUME}/om1:/data + - *ozone-dir + - *transformation + om2: + <<: *om + networks: + net: + ipv4_address: 10.9.0.12 + volumes: + - ${OZONE_VOLUME}/om2:/data + - *ozone-dir + - *transformation + om3: + <<: *om + networks: + net: + ipv4_address: 10.9.0.13 + volumes: + - ${OZONE_VOLUME}/om3:/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.14 + ports: + - 9876:9876 + volumes: + - ${OZONE_VOLUME}/scm:/data + - *ozone-dir + - *transformation + dn1: + <<: *datanode + networks: + net: + ipv4_address: 10.9.0.15 + volumes: + - ${OZONE_VOLUME}/dn1:/data + - *ozone-dir + - *transformation + dn2: + <<: *datanode + networks: + net: + ipv4_address: 10.9.0.16 + volumes: + - ${OZONE_VOLUME}/dn2:/data + - *ozone-dir + - *transformation + dn3: + <<: *datanode + networks: + net: + ipv4_address: 10.9.0.17 + volumes: + - ${OZONE_VOLUME}/dn3:/data + - *ozone-dir + - *transformation + dn4: + <<: *datanode + networks: + net: + ipv4_address: 10.9.0.18 + volumes: + - ${OZONE_VOLUME}/dn4:/data + - *ozone-dir + - *transformation + dn5: + <<: *datanode + networks: + net: + ipv4_address: 10.9.0.19 + volumes: + - ${OZONE_VOLUME}/dn5:/data + - *ozone-dir + - *transformation + recon: + command: ["ozone","recon"] + <<: *common-config + environment: + <<: *environment + networks: + net: + ipv4_address: 10.9.0.20 + 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.21 + ports: + - 9878:9878 + volumes: + - ${OZONE_VOLUME}/s3g:/data + - *ozone-dir + - *transformation +networks: + net: + driver: bridge + ipam: + config: + - subnet: 10.9.0.0/16 diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/docker-config b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/docker-config new file mode 100644 index 000000000000..e2540baaa49b --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/docker-config @@ -0,0 +1,58 @@ +# 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,om2,om3 +OZONE-SITE.XML_ozone.om.address.omservice.om1=om1 +OZONE-SITE.XML_ozone.om.address.omservice.om2=om2 +OZONE-SITE.XML_ozone.om.address.omservice.om3=om3 +OZONE-SITE.XML_ozone.om.ratis.enable=true +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 +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 + +# If SCM sends container close commands as part of upgrade finalization while +# datanodes are doing a leader election, all 3 replicas may end up in the +# CLOSING state. The replication manager must be running to later move them to +# a CLOSED state so the datanodes can progress with finalization. +# +# This config sets the amount of time SCM will wait after safemode exit to +# start the replication manager and pipeline scrubber. The default of 5 minutes +# is fine in real clusters to prevent unnecessary over-replication, +# but it is too long for this test. +OZONE-SITE.XML_hdds.scm.wait.time.after.safemode.exit=5s +# If datanodes take too long to close pipelines during finalization, let the +# scrubber force close them to move the test forward. +OZONE-SITE.XML_ozone.scm.pipeline.scrub.interval=1m +OZONE-SITE.XML_ozone.scm.pipeline.allocated.timeout=2m + +OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon +OZONE-SITE.XML_ozone.recon.om.snapshot.task.interval.delay=1m +OZONE-SITE.XML_ozone.recon.address=recon:9891 + +no_proxy=om1,om2,om3,scm,s3g,kdc,localhost,127.0.0.1 + +OM_SERVICE_ID=omservice diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/load.sh b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/load.sh new file mode 100755 index 000000000000..a2f2603414fc --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/om-ha/load.sh @@ -0,0 +1,30 @@ +#!/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/om-ha/docker-compose.yaml" +export OM_SERVICE_ID=omservice +create_data_dirs "${OZONE_VOLUME}"/{om1,om2,om3,dn1,dn2,dn3,dn4,dn5,recon,s3g,scm} + +echo "Using docker cluster defined in $COMPOSE_FILE" diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/test.sh b/hadoop-ozone/dist/src/main/compose/upgrade/test.sh index b0cdf877e618..a267080bb190 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/test.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/test.sh @@ -17,9 +17,6 @@ #suite:compat -# Version that will be run using the local build. -: "${OZONE_CURRENT_VERSION:=1.3.0}" -export OZONE_CURRENT_VERSION TEST_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd ) source "$TEST_DIR/testlib.sh" @@ -35,8 +32,13 @@ RESULT_DIR="$ALL_RESULT_DIR" create_results_dir # Upgrade tests to be run. In CI we want to run just one set, but for a release # we might advise the release manager to run the full matrix. -#run_test non-rolling-upgrade 1.1.0 1.3.0 -run_test non-rolling-upgrade 1.2.1 1.3.0 + +# 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. +export OZONE_CURRENT_VERSION=1.4.0 +run_test ha non-rolling-upgrade 1.3.0 "$OZONE_CURRENT_VERSION" +# run_test ha non-rolling-upgrade 1.2.1 "$OZONE_CURRENT_VERSION" +# run_test om-ha non-rolling-upgrade 1.1.0 "$OZONE_CURRENT_VERSION" generate_report "upgrade" "$ALL_RESULT_DIR" diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/testlib.sh b/hadoop-ozone/dist/src/main/compose/upgrade/testlib.sh index b3fa1df3bc7e..099134e93839 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/testlib.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/testlib.sh @@ -17,11 +17,6 @@ set -e -o pipefail -# Fail if required variables are not set. -set -u -: "${OZONE_CURRENT_VERSION}" -set +u - _upgrade_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # Cumulative result of all tests run with run_test function. @@ -29,7 +24,6 @@ _upgrade_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" : "${RESULT:=0}" : "${OZONE_REPLICATION_FACTOR:=3}" : "${OZONE_VOLUME_OWNER:=}" -: "${OZONE_CURRENT_VERSION:=}" : "${ALL_RESULT_DIR:="$_upgrade_dir"/result}" # export for docker-compose @@ -53,7 +47,8 @@ create_data_dirs() { ## @description Prepares to run an image with `start_docker_env`. ## @param the version of Ozone to be run. -## If this is equal to `OZONE_CURRENT_VERSION`, then the ozone runner image wil be used. +## If this is equal to the string 'current', then the ozone runner image will +# be used. ## Else, a binary image will be used. prepare_for_image() { local image_version="$1" @@ -65,96 +60,70 @@ prepare_for_image() { fi } -## @description Runs a callback function only if it exists. +## @description Run the common callback function first, then the one specific to +## the upgrade being tested if one exists. If neither exists, print a +## warning that nothing was tested. ## @param The name of the function to run. callback() { local func="$1" - if [[ "$(type -t "$func")" = function ]]; then - "$func" - else - echo "Skipping callback $func. No function implementation found." - fi + + set -u + : "${OZONE_UPGRADE_CALLBACK}" + : "${OZONE_COMMON_CALLBACK}" + set +u + + ( + # Common callback always exists. + source "$OZONE_COMMON_CALLBACK" + if [[ "$(type -t "$func")" = function ]]; then + "$func" + fi + ) + + ( + # Version specific callback is optional. + if [[ -f "$OZONE_UPGRADE_CALLBACK" ]]; then + source "$OZONE_UPGRADE_CALLBACK" + if [[ "$(type -t "$func")" = function ]]; then + "$func" + fi + fi + ) } -## @description Sets up and runs the test defined by "$1"/test.sh. -## @param The directory for the upgrade type whose test.sh file will be run. +## @description Sets up and runs the upgrade test using the provided ozone +# versions and docker compose cluster. +## @param The directory with a load.sh file that can be sourced to load the +# docker compose cluster to run the test in. +## @param The directory of the upgrade type to run. ## @param The version of Ozone to upgrade from. ## @param The version of Ozone to upgrade to. run_test() { + local 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" # Export variables needed by test, since it is run in a subshell. - local test_dir="$_upgrade_dir/upgrades/$1" - export OZONE_UPGRADE_FROM="$2" - export OZONE_UPGRADE_TO="$3" - local test_subdir="$test_dir"/"$OZONE_UPGRADE_FROM"-"$OZONE_UPGRADE_TO" - export OZONE_UPGRADE_CALLBACK="$test_subdir"/callback.sh - export OZONE_VOLUME="$test_subdir"/data - export RESULT_DIR="$test_subdir"/result + export OZONE_UPGRADE_CALLBACK="$callback_dir"/"$OZONE_UPGRADE_TO"/callback.sh + export OZONE_COMMON_CALLBACK="$callback_dir"/common/callback.sh + export OZONE_VOLUME="$execution_dir"/data + export RESULT_DIR="$execution_dir"/result + + # Load docker compose setup. + source "$compose_dir"/load.sh + + # The container to run test commands from. Use one of the SCM containers, + # but SCM HA may or may not be used. + export SCM="$(docker compose --project-directory="$compose_dir" config --services | grep --max-count=1 scm)" if ! run_test_script "$test_dir" ./driver.sh; then RESULT=1 fi - copy_results "$test_subdir" "$ALL_RESULT_DIR" -} - -## @description Generates data on the cluster. -## @param The prefix to use for data generated. -## @param All parameters after the first one are passed directly to the robot command, -## see https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options -generate() { - execute_robot_test scm -v PREFIX:"$1" ${@:2} upgrade/generate.robot -} - -## @description Validates that data exists on the cluster. -## @param The prefix of the data to be validated. -## @param All parameters after the first one are passed directly to the robot command, -## see https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options -validate() { - execute_robot_test scm -v PREFIX:"$1" ${@:2} upgrade/validate.robot + copy_results "$execution_dir" "$ALL_RESULT_DIR" } - -## @description Checks that the metadata layout version of the provided node matches what is expected. -## @param The name of the docker-compose service to run the check on. -## @param The path to the VERSION file in the container. -## @param The metadata layout version expected for that service. -check_mlv() { - service="$1" - container_id="$(docker container ps --quiet --filter "name=$service")" - - # If some containers go down during the test run due to resources issues, - # just print a message instead of failing the test. - if [[ -n "$container_id" ]]; then - execute_robot_test "$service" -v VERSION_FILE:"$2" -v VERSION:"$3" upgrade/check-mlv.robot - else - echo "No matching containers for docker-compose service $service found. Skipping MLV check." - fi -} - -## @description Checks that the metadata layout version of a datanode matches what is expected. -## @param The name of the docker-compose service to run the check on. -## @param The metadata layout version expected for that service. -check_dn_mlv() { - check_mlv "$1" /data/metadata/dnlayoutversion/VERSION "$2" -} - -## @description Checks that the metadata layout version of an OM matches what is expected. -## @param The name of the docker-compose service to run the check on. -## @param The metadata layout version expected for that service. -check_om_mlv() { - check_mlv "$1" /data/metadata/om/current/VERSION "$2" -} - -## @description Checks that the metadata layout version of an SCM matches what is expected. -## @param The name of the docker-compose service to run the check on. -## @param The metadata layout version expected for that service. -check_scm_mlv() { - check_mlv "$1" /data/metadata/scm/current/VERSION "$2" -} - -check_ec_is_disabled() { - execute_robot_test scm --include pre-finalized-ec-tests ec/upgrade-ec-check.robot -} - -check_ec_is_enabled() { - execute_robot_test scm --include post-finalized-ec-tests ec/upgrade-ec-check.robot -} \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/manual-upgrade/driver.sh b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/manual-upgrade/driver.sh index de016bf10b47..fe6188758045 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/manual-upgrade/driver.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/manual-upgrade/driver.sh @@ -47,10 +47,10 @@ stop_docker_env echo "--- SETTING UP NEW VERSION $OZONE_UPGRADE_TO ---" OUTPUT_NAME="$OZONE_UPGRADE_TO" prepare_for_image "$OZONE_UPGRADE_TO" -callback setup_new_version +callback setup_this_version echo "--- RUNNING WITH NEW VERSION $OZONE_UPGRADE_TO ---" OZONE_KEEP_RESULTS=true start_docker_env -callback with_new_version +callback with_this_version stop_docker_env diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/1.2.1-1.3.0/callback.sh b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/1.2.1-1.3.0/callback.sh deleted file mode 100755 index 36667300857f..000000000000 --- a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/1.2.1-1.3.0/callback.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/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. - -source "$TEST_DIR"/testlib.sh - -# Helper function, not a callback. -_check_hdds_mlvs() { - mlv="$1" - check_scm_mlv scm "$mlv" - check_dn_mlv dn1 "$mlv" - check_dn_mlv dn2 "$mlv" - check_dn_mlv dn3 "$mlv" -} - -# Helper function, not a callback. -_check_om_mlvs() { - mlv="$1" - check_om_mlv om1 "$mlv" - check_om_mlv om2 "$mlv" - check_om_mlv om3 "$mlv" -} - -setup() { - export OZONE_OM_PREPARE='true' -} - -with_old_version() { - generate old1 - validate old1 -} - -with_new_version_pre_finalized() { - _check_hdds_mlvs 2 - _check_om_mlvs 0 - - validate old1 -# HDDS-6261: overwrite the same keys intentionally - generate old1 --exclude create-volume-and-bucket - - generate new1 - validate new1 - - check_ec_is_disabled -} - -with_old_version_downgraded() { - validate old1 - validate new1 - - generate old2 - validate old2 - - # HDDS-6261: overwrite the same keys again to trigger the precondition check - # that exists <= 1.1.0 OM - generate old1 --exclude create-volume-and-bucket -} - -with_new_version_finalized() { - _check_hdds_mlvs 4 - _check_om_mlvs 3 - - validate old1 - validate new1 - validate old2 - - generate new2 - validate new2 - - check_ec_is_enabled -} diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/1.3.0/callback.sh b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/1.3.0/callback.sh new file mode 100755 index 000000000000..eb8f0ba6dc9e --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/1.3.0/callback.sh @@ -0,0 +1,30 @@ +#!/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. + +source "$TEST_DIR"/testlib.sh + +with_this_version_pre_finalized() { + # New layout features were added in this version, so OM and SCM should be + # pre-finalized. + execute_robot_test "$SCM" --include pre-finalized upgrade/check-finalization.robot + # Test that EC is disabled when pre-finalized. + execute_robot_test "$SCM" --include pre-finalized-ec-tests ec/upgrade-ec-check.robot +} + +with_this_version_finalized() { + execute_robot_test "$SCM" --include post-finalized-ec-tests ec/upgrade-ec-check.robot +} diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/1.1.0-1.2.0/callback.sh b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/common/callback.sh similarity index 52% rename from hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/1.1.0-1.2.0/callback.sh rename to hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/common/callback.sh index 8bf5fd13fb82..76d45deed78b 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/1.1.0-1.2.0/callback.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/common/callback.sh @@ -17,37 +17,35 @@ source "$TEST_DIR"/testlib.sh -# Helper function, not a callback. -_check_hdds_mlvs() { - mlv="$1" - check_scm_mlv scm "$mlv" - check_dn_mlv dn1 "$mlv" - check_dn_mlv dn2 "$mlv" - check_dn_mlv dn3 "$mlv" -} +### HELPER METHODS ### -# Helper function, not a callback. -_check_om_mlvs() { - mlv="$1" - check_om_mlv om1 "$mlv" - check_om_mlv om2 "$mlv" - check_om_mlv om3 "$mlv" +## @description Generates data on the cluster. +## @param The prefix to use for data generated. +## @param All parameters after the first one are passed directly to the robot command, +## see https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options +generate() { + execute_robot_test "$SCM" -v PREFIX:"$1" ${@:2} upgrade/generate.robot } -setup() { - # OM preparation is not implemented until 1.2.0. - export OZONE_OM_PREPARE='false' +## @description Validates that data exists on the cluster. +## @param The prefix of the data to be validated. +## @param All parameters after the first one are passed directly to the robot command, +## see https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options +validate() { + execute_robot_test "$SCM" -v PREFIX:"$1" ${@:2} upgrade/validate.robot } +### CALLBACKS ### + with_old_version() { + execute_robot_test "$SCM" --include finalized upgrade/check-finalization.robot generate old1 validate old1 } -with_new_version_pre_finalized() { - _check_hdds_mlvs 0 - _check_om_mlvs 0 - +with_this_version_pre_finalized() { + # No check for pre-finalized status here, because the release may not have + # added layout features to OM or HDDS. validate old1 # HDDS-6261: overwrite the same keys intentionally generate old1 --exclude create-volume-and-bucket @@ -57,6 +55,7 @@ with_new_version_pre_finalized() { } with_old_version_downgraded() { + execute_robot_test "$SCM" --include finalized upgrade/check-finalization.robot validate old1 validate new1 @@ -68,11 +67,8 @@ with_old_version_downgraded() { generate old1 --exclude create-volume-and-bucket } -with_new_version_finalized() { - _check_hdds_mlvs 2 - # In Ozone 1.2.0, OM has only one layout version. - _check_om_mlvs 0 - +with_this_version_finalized() { + execute_robot_test "$SCM" --include finalized upgrade/check-finalization.robot validate old1 validate new1 validate old2 diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/driver.sh b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/driver.sh index 7b95238bf1da..0bb2c3896722 100755 --- a/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/driver.sh +++ b/hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/driver.sh @@ -26,27 +26,18 @@ set -u : "${OZONE_UPGRADE_FROM}" : "${OZONE_UPGRADE_TO}" : "${TEST_DIR}" -: "${OZONE_UPGRADE_CALLBACK}" +: "${SCM}" +: "${OZONE_CURRENT_VERSION}" set +u echo "--- RUNNING NON-ROLLING UPGRADE TEST FROM $OZONE_UPGRADE_FROM TO $OZONE_UPGRADE_TO ---" -# Prepare OMs before upgrade unless this variable is not 'true'. -: "${OZONE_PREPARE_OMS:='true'}" - -# Default compose cluster to use. May be overridden by callback.sh. -source "$TEST_DIR"/compose/ha/load.sh source "$TEST_DIR"/testlib.sh -[[ -f "$OZONE_UPGRADE_CALLBACK" ]] && source "$OZONE_UPGRADE_CALLBACK" - -prepare_oms() { - if [[ "$OZONE_PREPARE_OMS" = 'true' ]]; then - execute_robot_test scm upgrade/prepare.robot - fi -} set_downgrade_om_args() { - if [[ "$OZONE_PREPARE_OMS" = 'true' ]]; then + # 1.1.0 Is the earliest version we support upgrade/downgrade to, but it did + # not have OM prepare. + if [[ "$OZONE_UPGRADE_FROM" != '1.1.0' ]]; then export OM_HA_ARGS='--downgrade' else export OM_HA_ARGS='--' @@ -54,8 +45,7 @@ set_downgrade_om_args() { } echo "--- SETTING UP OLD VERSION $OZONE_UPGRADE_FROM ---" -OUTPUT_NAME="$OZONE_UPGRADE_FROM" -callback setup +OUTPUT_NAME="$OZONE_UPGRADE_FROM"-original export OM_HA_ARGS='--' prepare_for_image "$OZONE_UPGRADE_FROM" @@ -63,7 +53,7 @@ echo "--- RUNNING WITH OLD VERSION $OZONE_UPGRADE_FROM ---" start_docker_env callback with_old_version -prepare_oms +execute_robot_test "$SCM" upgrade/prepare.robot stop_docker_env prepare_for_image "$OZONE_UPGRADE_TO" export OM_HA_ARGS='--upgrade' @@ -71,8 +61,8 @@ export OM_HA_ARGS='--upgrade' echo "--- RUNNING WITH NEW VERSION $OZONE_UPGRADE_TO PRE-FINALIZED ---" OUTPUT_NAME="$OZONE_UPGRADE_TO"-pre-finalized OZONE_KEEP_RESULTS=true start_docker_env -callback with_new_version_pre_finalized -prepare_oms +callback with_this_version_pre_finalized +execute_robot_test "$SCM" upgrade/prepare.robot stop_docker_env prepare_for_image "$OZONE_UPGRADE_FROM" set_downgrade_om_args @@ -82,7 +72,7 @@ OUTPUT_NAME="$OZONE_UPGRADE_FROM"-downgraded OZONE_KEEP_RESULTS=true start_docker_env callback with_old_version_downgraded -prepare_oms +execute_robot_test "$SCM" upgrade/prepare.robot stop_docker_env prepare_for_image "$OZONE_UPGRADE_TO" export OM_HA_ARGS='--upgrade' @@ -92,8 +82,8 @@ OUTPUT_NAME="$OZONE_UPGRADE_TO"-finalized OZONE_KEEP_RESULTS=true start_docker_env # Sends commands to finalize OM and SCM. -execute_robot_test scm upgrade/finalize.robot -callback with_new_version_finalized +execute_robot_test "$SCM" upgrade/finalize.robot +callback with_this_version_finalized stop_docker_env generate_report diff --git a/hadoop-ozone/dist/src/main/smoketest/upgrade/check-finalization.robot b/hadoop-ozone/dist/src/main/smoketest/upgrade/check-finalization.robot new file mode 100644 index 000000000000..0c73a777b5ce --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/upgrade/check-finalization.robot @@ -0,0 +1,50 @@ +# 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. + +*** Settings *** +Documentation Finalize Upgrade of the Ozone cluster +Resource ../commonlib.robot +Test Timeout 10 minutes +Test Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab + +*** Test Cases *** +Check OM Finalized + [Tags] om finalized + ${result} = Execute env + Log ${result} + Pass Execution If '%{OZONE_UPGRADE_FROM}' == '1.1.0' OM finalization not supported in version %{OZONE_UPGRADE_FROM} + ${result} = Execute ozone admin om finalizationstatus + Log ${result} + Should Contain Any ${result} ALREADY_FINALIZED FINALIZATION_DONE + +Check SCM Finalized + [Tags] scm finalized + Pass Execution If '%{OZONE_UPGRADE_FROM}' == '1.1.0' HDDS finalization not supported in version %{OZONE_UPGRADE_FROM} + ${result} = Execute ozone admin scm finalizationstatus + Log ${result} + Should Contain Any ${result} ALREADY_FINALIZED FINALIZATION_DONE + +Check OM Pre Finalized + [Tags] om pre-finalized + ${result} = Execute ozone admin om finalizationstatus + Log ${result} + Should Contain Any ${result} FINALIZATION_REQUIRED + +Check SCM Pre Finalized + [Tags] scm pre-finalized + ${result} = Execute ozone admin scm finalizationstatus + Log ${result} + Should Contain Any ${result} FINALIZATION_REQUIRED + diff --git a/hadoop-ozone/dist/src/main/smoketest/upgrade/check-mlv.robot b/hadoop-ozone/dist/src/main/smoketest/upgrade/check-mlv.robot deleted file mode 100644 index 271b6dd17504..000000000000 --- a/hadoop-ozone/dist/src/main/smoketest/upgrade/check-mlv.robot +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -*** Settings *** -Documentation Check Metadata layout version present in a version file. -Library OperatingSystem -Library BuiltIn -Resource ../commonlib.robot -Test Timeout 5 minutes - -*** Variables *** -${version_prefix} layoutVersion= - -*** Keywords *** -Check version - ${version_file_contents} = Get file ${VERSION_FILE} - ${version_line} = Catenate SEPARATOR= ${version_prefix} ${VERSION} - Should contain ${version_file_contents} ${version_line} - -*** Test Cases *** -Check MLV - # Fail if required variables are not set. - Should not be empty ${VERSION_FILE} - Should not be empty ${VERSION} - - File should exist ${VERSION_FILE} - File should not be empty ${VERSION_FILE} - - Wait until keyword succeeds 3min 10sec Check version diff --git a/hadoop-ozone/dist/src/main/smoketest/upgrade/finalize.robot b/hadoop-ozone/dist/src/main/smoketest/upgrade/finalize.robot index 521147ff6a62..535b22b0a30d 100644 --- a/hadoop-ozone/dist/src/main/smoketest/upgrade/finalize.robot +++ b/hadoop-ozone/dist/src/main/smoketest/upgrade/finalize.robot @@ -14,18 +14,16 @@ # limitations under the License. *** Settings *** -Documentation Finalize Upgrade of OMs and SCM +Documentation Finalize Upgrade of the Ozone cluster Resource ../commonlib.robot Test Timeout 10 minutes Test Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab *** Test Cases *** -Finalize SCM +Finalize HDDS ${result} = Execute ozone admin scm finalizeupgrade - #Wait Until Keyword Succeeds 3min 10sec Should contain ${result} OM Preparation successful! Log ${result} Finalize OMs ${result} = Execute ozone admin om finalizeupgrade -id %{OM_SERVICE_ID} - #Wait Until Keyword Succeeds 3min 10sec Should contain ${result} OM Preparation successful! Log ${result} diff --git a/hadoop-ozone/dist/src/main/smoketest/upgrade/prepare.robot b/hadoop-ozone/dist/src/main/smoketest/upgrade/prepare.robot index b1b4095d6eb2..b0cd8a5ba678 100644 --- a/hadoop-ozone/dist/src/main/smoketest/upgrade/prepare.robot +++ b/hadoop-ozone/dist/src/main/smoketest/upgrade/prepare.robot @@ -21,6 +21,7 @@ Test Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit t *** Test Cases *** Prepare Ozone Manager + Pass Execution If '%{OZONE_UPGRADE_FROM}' == '1.1.0' OM prepare is skipped for version %{OZONE_UPGRADE_FROM} ${result} = Execute ozone admin om prepare -id %{OM_SERVICE_ID} Wait Until Keyword Succeeds 3min 10sec Should contain ${result} OM Preparation successful!